From 99a95ad6f8e25114513808bd8e7e890c4a7f3170 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Sat, 16 Dec 2023 08:31:23 +0530 Subject: [PATCH] adding new modules and update the proto of umee --- .gitignore | 3 +- .telescope.json | 44 +- .vscode/settings.json | 2 +- package.json | 8 +- proto/umee/incentive/v1/genesis.proto | 75 + proto/umee/incentive/v1/incentive.proto | 69 + proto/umee/incentive/v1/query.proto | 253 ++ proto/umee/incentive/v1/tx.proto | 127 + proto/umee/leverage/v1/events.proto | 2 +- proto/umee/leverage/v1/genesis.proto | 3 +- proto/umee/leverage/v1/gov.proto | 22 - proto/umee/leverage/v1/leverage.proto | 85 +- proto/umee/leverage/v1/query.proto | 215 +- proto/umee/leverage/v1/tx.proto | 173 +- proto/umee/metoken/v1/events.proto | 55 + proto/umee/metoken/v1/genesis.proto | 40 + proto/umee/metoken/v1/metoken.proto | 156 + proto/umee/metoken/v1/query.proto | 117 + proto/umee/metoken/v1/tx.proto | 88 + proto/umee/oracle/v1/events.proto | 2 +- proto/umee/oracle/v1/genesis.proto | 37 +- proto/umee/oracle/v1/oracle.proto | 77 +- proto/umee/oracle/v1/query.proto | 122 +- proto/umee/oracle/v1/tx.proto | 2 +- proto/umee/ugov/v1/events.proto | 25 + proto/umee/ugov/v1/genesis.proto | 25 + proto/umee/ugov/v1/query.proto | 69 + proto/umee/ugov/v1/tx.proto | 61 + proto/umee/ugov/v1/ugov.proto | 27 + proto/umee/uibc/v1/events.proto | 21 + proto/umee/uibc/v1/genesis.proto | 44 + proto/umee/uibc/v1/query.proto | 109 + proto/umee/uibc/v1/quota.proto | 67 + proto/umee/uibc/v1/tx.proto | 86 + src/codegen/binary.ts | 534 +++ src/codegen/confio/proofs.ts | 1215 ++++-- src/codegen/cosmos/app/v1alpha1/config.ts | 162 +- src/codegen/cosmos/app/v1alpha1/module.ts | 247 +- .../cosmos/app/v1alpha1/query.rpc.Query.ts | 9 +- src/codegen/cosmos/app/v1alpha1/query.ts | 131 +- src/codegen/cosmos/auth/v1beta1/auth.ts | 356 +- src/codegen/cosmos/auth/v1beta1/genesis.ts | 92 +- src/codegen/cosmos/auth/v1beta1/query.lcd.ts | 20 +- .../cosmos/auth/v1beta1/query.rpc.Query.ts | 39 +- src/codegen/cosmos/auth/v1beta1/query.ts | 949 +++- src/codegen/cosmos/authz/v1beta1/authz.ts | 319 +- src/codegen/cosmos/authz/v1beta1/event.ts | 183 +- src/codegen/cosmos/authz/v1beta1/genesis.ts | 73 +- src/codegen/cosmos/authz/v1beta1/query.lcd.ts | 19 +- .../cosmos/authz/v1beta1/query.rpc.Query.ts | 19 +- src/codegen/cosmos/authz/v1beta1/query.ts | 499 ++- src/codegen/cosmos/authz/v1beta1/tx.amino.ts | 122 +- .../cosmos/authz/v1beta1/tx.registry.ts | 9 - .../cosmos/authz/v1beta1/tx.rpc.msg.ts | 16 +- src/codegen/cosmos/authz/v1beta1/tx.ts | 449 +- src/codegen/cosmos/bank/v1beta1/authz.ts | 78 +- src/codegen/cosmos/bank/v1beta1/bank.ts | 626 ++- src/codegen/cosmos/bank/v1beta1/genesis.ts | 202 +- src/codegen/cosmos/bank/v1beta1/query.lcd.ts | 36 +- .../cosmos/bank/v1beta1/query.rpc.Query.ts | 49 +- src/codegen/cosmos/bank/v1beta1/query.ts | 1460 +++++-- src/codegen/cosmos/bank/v1beta1/tx.amino.ts | 105 +- .../cosmos/bank/v1beta1/tx.registry.ts | 6 - src/codegen/cosmos/bank/v1beta1/tx.rpc.msg.ts | 12 +- src/codegen/cosmos/bank/v1beta1/tx.ts | 282 +- src/codegen/cosmos/base/abci/v1beta1/abci.ts | 1123 +++-- src/codegen/cosmos/base/kv/v1beta1/kv.ts | 145 +- .../cosmos/base/query/v1beta1/pagination.ts | 243 +- .../base/reflection/v1beta1/reflection.ts | 273 +- .../base/reflection/v2alpha1/reflection.ts | 1907 +++++--- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 740 +++- .../cosmos/base/store/v1beta1/commit_info.ts | 264 +- .../cosmos/base/store/v1beta1/listening.ts | 103 +- .../base/tendermint/v1beta1/query.lcd.ts | 20 +- .../tendermint/v1beta1/query.rpc.Service.ts | 34 +- .../cosmos/base/tendermint/v1beta1/query.ts | 1225 ++++-- src/codegen/cosmos/base/v1beta1/coin.ts | 291 +- src/codegen/cosmos/bundle.ts | 415 +- .../cosmos/capability/v1beta1/capability.ts | 231 +- .../cosmos/capability/v1beta1/genesis.ts | 191 +- src/codegen/cosmos/client.ts | 8 +- src/codegen/cosmos/crisis/v1beta1/genesis.ts | 79 +- src/codegen/cosmos/crisis/v1beta1/tx.amino.ts | 33 +- .../cosmos/crisis/v1beta1/tx.registry.ts | 3 - .../cosmos/crisis/v1beta1/tx.rpc.msg.ts | 8 +- src/codegen/cosmos/crisis/v1beta1/tx.ts | 141 +- src/codegen/cosmos/crypto/ed25519/keys.ts | 145 +- src/codegen/cosmos/crypto/hd/v1/hd.ts | 115 +- .../cosmos/crypto/keyring/v1/record.ts | 388 +- src/codegen/cosmos/crypto/multisig/keys.ts | 84 +- .../crypto/multisig/v1beta1/multisig.ts | 154 +- src/codegen/cosmos/crypto/secp256k1/keys.ts | 142 +- src/codegen/cosmos/crypto/secp256r1/keys.ts | 140 +- .../distribution/v1beta1/distribution.ts | 1039 +++-- .../cosmos/distribution/v1beta1/genesis.ts | 865 ++-- .../cosmos/distribution/v1beta1/query.lcd.ts | 28 +- .../distribution/v1beta1/query.rpc.Query.ts | 49 +- .../cosmos/distribution/v1beta1/query.ts | 1375 ++++-- .../cosmos/distribution/v1beta1/tx.amino.ts | 113 +- .../distribution/v1beta1/tx.registry.ts | 12 - .../cosmos/distribution/v1beta1/tx.rpc.msg.ts | 20 +- src/codegen/cosmos/distribution/v1beta1/tx.ts | 556 ++- .../cosmos/evidence/v1beta1/evidence.ts | 124 +- .../cosmos/evidence/v1beta1/genesis.ts | 75 +- .../cosmos/evidence/v1beta1/query.lcd.ts | 10 +- .../evidence/v1beta1/query.rpc.Query.ts | 14 +- src/codegen/cosmos/evidence/v1beta1/query.ts | 299 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 37 +- .../cosmos/evidence/v1beta1/tx.registry.ts | 3 - .../cosmos/evidence/v1beta1/tx.rpc.msg.ts | 8 +- src/codegen/cosmos/evidence/v1beta1/tx.ts | 150 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 398 +- .../cosmos/feegrant/v1beta1/genesis.ts | 73 +- .../cosmos/feegrant/v1beta1/query.lcd.ts | 14 +- .../feegrant/v1beta1/query.rpc.Query.ts | 19 +- src/codegen/cosmos/feegrant/v1beta1/query.ts | 470 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 69 +- .../cosmos/feegrant/v1beta1/tx.registry.ts | 6 - .../cosmos/feegrant/v1beta1/tx.rpc.msg.ts | 12 +- src/codegen/cosmos/feegrant/v1beta1/tx.ts | 293 +- src/codegen/cosmos/genutil/v1beta1/genesis.ts | 74 +- src/codegen/cosmos/gov/v1/genesis.ts | 155 +- src/codegen/cosmos/gov/v1/gov.ts | 866 ++-- src/codegen/cosmos/gov/v1/query.lcd.ts | 33 +- src/codegen/cosmos/gov/v1/query.rpc.Query.ts | 44 +- src/codegen/cosmos/gov/v1/query.ts | 1294 ++++-- src/codegen/cosmos/gov/v1/tx.amino.ts | 218 +- src/codegen/cosmos/gov/v1/tx.registry.ts | 15 - src/codegen/cosmos/gov/v1/tx.rpc.msg.ts | 24 +- src/codegen/cosmos/gov/v1/tx.ts | 795 +++- src/codegen/cosmos/gov/v1beta1/genesis.ts | 169 +- src/codegen/cosmos/gov/v1beta1/gov.ts | 989 +++-- src/codegen/cosmos/gov/v1beta1/query.lcd.ts | 33 +- .../cosmos/gov/v1beta1/query.rpc.Query.ts | 44 +- src/codegen/cosmos/gov/v1beta1/query.ts | 1332 ++++-- src/codegen/cosmos/gov/v1beta1/tx.amino.ts | 167 +- src/codegen/cosmos/gov/v1beta1/tx.registry.ts | 12 - src/codegen/cosmos/gov/v1beta1/tx.rpc.msg.ts | 20 +- src/codegen/cosmos/gov/v1beta1/tx.ts | 636 ++- src/codegen/cosmos/group/v1/events.ts | 721 +++- src/codegen/cosmos/group/v1/genesis.ts | 190 +- src/codegen/cosmos/group/v1/query.lcd.ts | 46 +- .../cosmos/group/v1/query.rpc.Query.ts | 69 +- src/codegen/cosmos/group/v1/query.ts | 2060 ++++++--- src/codegen/cosmos/group/v1/tx.amino.ts | 568 +-- src/codegen/cosmos/group/v1/tx.registry.ts | 42 - src/codegen/cosmos/group/v1/tx.rpc.msg.ts | 60 +- src/codegen/cosmos/group/v1/tx.ts | 2341 +++++++--- src/codegen/cosmos/group/v1/types.ts | 1448 ++++--- src/codegen/cosmos/lcd.ts | 2 +- src/codegen/cosmos/mint/v1beta1/genesis.ts | 94 +- src/codegen/cosmos/mint/v1beta1/mint.ts | 242 +- src/codegen/cosmos/mint/v1beta1/query.lcd.ts | 10 +- .../cosmos/mint/v1beta1/query.rpc.Query.ts | 19 +- src/codegen/cosmos/mint/v1beta1/query.ts | 399 +- src/codegen/cosmos/nft/v1beta1/event.ts | 250 +- src/codegen/cosmos/nft/v1beta1/genesis.ts | 165 +- src/codegen/cosmos/nft/v1beta1/nft.ts | 251 +- src/codegen/cosmos/nft/v1beta1/query.lcd.ts | 24 +- .../cosmos/nft/v1beta1/query.rpc.Query.ts | 39 +- src/codegen/cosmos/nft/v1beta1/query.ts | 1010 +++-- src/codegen/cosmos/nft/v1beta1/tx.amino.ts | 38 +- src/codegen/cosmos/nft/v1beta1/tx.registry.ts | 3 - src/codegen/cosmos/nft/v1beta1/tx.rpc.msg.ts | 8 +- src/codegen/cosmos/nft/v1beta1/tx.ts | 162 +- src/codegen/cosmos/orm/v1/orm.ts | 332 +- src/codegen/cosmos/orm/v1alpha1/schema.ts | 242 +- src/codegen/cosmos/params/v1beta1/params.ts | 168 +- .../cosmos/params/v1beta1/query.lcd.ts | 11 +- .../cosmos/params/v1beta1/query.rpc.Query.ts | 14 +- src/codegen/cosmos/params/v1beta1/query.ts | 368 +- .../cosmos/slashing/v1beta1/genesis.ts | 361 +- .../cosmos/slashing/v1beta1/query.lcd.ts | 12 +- .../slashing/v1beta1/query.rpc.Query.ts | 19 +- src/codegen/cosmos/slashing/v1beta1/query.ts | 434 +- .../cosmos/slashing/v1beta1/slashing.ts | 280 +- .../cosmos/slashing/v1beta1/tx.amino.ts | 23 +- .../cosmos/slashing/v1beta1/tx.registry.ts | 3 - .../cosmos/slashing/v1beta1/tx.rpc.msg.ts | 8 +- src/codegen/cosmos/slashing/v1beta1/tx.ts | 127 +- src/codegen/cosmos/staking/v1beta1/authz.ts | 214 +- src/codegen/cosmos/staking/v1beta1/genesis.ts | 252 +- .../cosmos/staking/v1beta1/query.lcd.ts | 53 +- .../cosmos/staking/v1beta1/query.rpc.Query.ts | 74 +- src/codegen/cosmos/staking/v1beta1/query.ts | 2202 +++++++--- src/codegen/cosmos/staking/v1beta1/staking.ts | 2011 ++++++--- .../cosmos/staking/v1beta1/tx.amino.ts | 286 +- .../cosmos/staking/v1beta1/tx.registry.ts | 15 - .../cosmos/staking/v1beta1/tx.rpc.msg.ts | 24 +- src/codegen/cosmos/staking/v1beta1/tx.ts | 833 +++- .../cosmos/tx/signing/v1beta1/signing.ts | 487 ++- src/codegen/cosmos/tx/v1beta1/service.lcd.ts | 16 +- .../cosmos/tx/v1beta1/service.rpc.Service.ts | 29 +- src/codegen/cosmos/tx/v1beta1/service.ts | 928 ++-- src/codegen/cosmos/tx/v1beta1/tx.ts | 1335 ++++-- .../cosmos/upgrade/v1beta1/query.lcd.ts | 16 +- .../cosmos/upgrade/v1beta1/query.rpc.Query.ts | 29 +- src/codegen/cosmos/upgrade/v1beta1/query.ts | 732 +++- .../cosmos/upgrade/v1beta1/tx.amino.ts | 81 +- .../cosmos/upgrade/v1beta1/tx.registry.ts | 6 - .../cosmos/upgrade/v1beta1/tx.rpc.msg.ts | 12 +- src/codegen/cosmos/upgrade/v1beta1/tx.ts | 290 +- src/codegen/cosmos/upgrade/v1beta1/upgrade.ts | 408 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 149 +- .../cosmos/vesting/v1beta1/tx.registry.ts | 9 - .../cosmos/vesting/v1beta1/tx.rpc.msg.ts | 16 +- src/codegen/cosmos/vesting/v1beta1/tx.ts | 484 ++- src/codegen/cosmos/vesting/v1beta1/vesting.ts | 536 ++- src/codegen/cosmos_proto/bundle.ts | 3 +- src/codegen/cosmos_proto/cosmos.ts | 192 +- src/codegen/gogoproto/bundle.ts | 3 +- src/codegen/google/api/http.ts | 578 ++- src/codegen/google/bundle.ts | 6 +- src/codegen/google/protobuf/any.ts | 155 +- src/codegen/google/protobuf/descriptor.ts | 2923 ++++++++----- src/codegen/google/protobuf/duration.ts | 147 +- src/codegen/google/protobuf/empty.ts | 65 +- src/codegen/google/protobuf/timestamp.ts | 166 +- src/codegen/helpers.ts | 344 +- .../ibc/applications/transfer/v1/genesis.ts | 93 +- .../ibc/applications/transfer/v1/query.lcd.ts | 12 +- .../transfer/v1/query.rpc.Query.ts | 19 +- .../ibc/applications/transfer/v1/query.ts | 430 +- .../ibc/applications/transfer/v1/transfer.ts | 169 +- .../ibc/applications/transfer/v1/tx.amino.ts | 69 +- .../applications/transfer/v1/tx.registry.ts | 3 - .../applications/transfer/v1/tx.rpc.msg.ts | 8 +- .../ibc/applications/transfer/v1/tx.ts | 223 +- .../ibc/applications/transfer/v2/packet.ts | 108 +- src/codegen/ibc/bundle.ts | 133 +- src/codegen/ibc/client.ts | 8 +- src/codegen/ibc/core/channel/v1/channel.ts | 790 ++-- src/codegen/ibc/core/channel/v1/genesis.ts | 245 +- src/codegen/ibc/core/channel/v1/query.lcd.ts | 49 +- .../ibc/core/channel/v1/query.rpc.Query.ts | 69 +- src/codegen/ibc/core/channel/v1/query.ts | 2593 +++++++---- src/codegen/ibc/core/channel/v1/tx.amino.ts | 657 +-- .../ibc/core/channel/v1/tx.registry.ts | 30 - src/codegen/ibc/core/channel/v1/tx.rpc.msg.ts | 44 +- src/codegen/ibc/core/channel/v1/tx.ts | 1666 +++++-- src/codegen/ibc/core/client/v1/client.ts | 647 ++- src/codegen/ibc/core/client/v1/genesis.ts | 309 +- src/codegen/ibc/core/client/v1/query.lcd.ts | 28 +- .../ibc/core/client/v1/query.rpc.Query.ts | 44 +- src/codegen/ibc/core/client/v1/query.ts | 1262 ++++-- src/codegen/ibc/core/client/v1/tx.amino.ts | 198 +- src/codegen/ibc/core/client/v1/tx.registry.ts | 12 - src/codegen/ibc/core/client/v1/tx.rpc.msg.ts | 20 +- src/codegen/ibc/core/client/v1/tx.ts | 643 ++- .../ibc/core/commitment/v1/commitment.ts | 291 +- .../ibc/core/connection/v1/connection.ts | 731 ++-- src/codegen/ibc/core/connection/v1/genesis.ts | 118 +- .../ibc/core/connection/v1/query.lcd.ts | 18 +- .../ibc/core/connection/v1/query.rpc.Query.ts | 29 +- src/codegen/ibc/core/connection/v1/query.ts | 914 ++-- .../ibc/core/connection/v1/tx.amino.ts | 336 +- .../ibc/core/connection/v1/tx.registry.ts | 12 - .../ibc/core/connection/v1/tx.rpc.msg.ts | 20 +- src/codegen/ibc/core/connection/v1/tx.ts | 825 ++-- .../ibc/core/port/v1/query.rpc.Query.ts | 9 +- src/codegen/ibc/core/port/v1/query.ts | 196 +- src/codegen/ibc/core/types/v1/genesis.ts | 110 +- src/codegen/ibc/lcd.ts | 2 +- .../lightclients/localhost/v1/localhost.ts | 93 +- .../solomachine/v1/solomachine.ts | 1534 +++++-- .../solomachine/v2/solomachine.ts | 1524 +++++-- .../lightclients/tendermint/v1/tendermint.ts | 608 ++- src/codegen/ics23/bundle.ts | 3 +- src/codegen/index.ts | 7 +- src/codegen/tendermint/abci/types.ts | 3835 ++++++++++++----- src/codegen/tendermint/bundle.ts | 18 +- src/codegen/tendermint/crypto/keys.ts | 71 +- src/codegen/tendermint/crypto/proof.ts | 389 +- src/codegen/tendermint/libs/bits/types.ts | 94 +- src/codegen/tendermint/p2p/types.ts | 444 +- src/codegen/tendermint/types/block.ts | 103 +- src/codegen/tendermint/types/evidence.ts | 369 +- src/codegen/tendermint/types/params.ts | 571 ++- src/codegen/tendermint/types/types.ts | 1323 ++++-- src/codegen/tendermint/types/validator.ts | 275 +- src/codegen/tendermint/version/types.ts | 181 +- src/codegen/umee/bundle.ts | 181 +- src/codegen/umee/client.ts | 24 +- src/codegen/umee/incentive/v1/genesis.ts | 860 ++++ src/codegen/umee/incentive/v1/incentive.ts | 390 ++ src/codegen/umee/incentive/v1/query.lcd.ts | 115 + .../umee/incentive/v1/query.rpc.Query.ts | 168 + src/codegen/umee/incentive/v1/query.ts | 2107 +++++++++ src/codegen/umee/incentive/v1/tx.amino.ts | 38 + src/codegen/umee/incentive/v1/tx.registry.ts | 142 + src/codegen/umee/incentive/v1/tx.rpc.msg.ts | 77 + src/codegen/umee/incentive/v1/tx.ts | 1207 ++++++ src/codegen/umee/lcd.ts | 22 +- src/codegen/umee/leverage/v1/events.ts | 970 +++-- src/codegen/umee/leverage/v1/genesis.ts | 468 +- src/codegen/umee/leverage/v1/leverage.ts | 817 +++- src/codegen/umee/leverage/v1/query.lcd.ts | 119 +- .../umee/leverage/v1/query.rpc.Query.ts | 109 +- src/codegen/umee/leverage/v1/query.ts | 2781 ++++++++++-- src/codegen/umee/leverage/v1/tx.amino.ts | 332 +- src/codegen/umee/leverage/v1/tx.registry.ts | 136 +- src/codegen/umee/leverage/v1/tx.rpc.msg.ts | 113 +- src/codegen/umee/leverage/v1/tx.ts | 2501 +++++++++-- src/codegen/umee/metoken/v1/events.ts | 569 +++ src/codegen/umee/metoken/v1/genesis.ts | 395 ++ src/codegen/umee/metoken/v1/metoken.ts | 935 ++++ src/codegen/umee/metoken/v1/query.lcd.ts | 85 + .../umee/metoken/v1/query.rpc.Query.ts | 88 + src/codegen/umee/metoken/v1/query.ts | 1079 +++++ src/codegen/umee/metoken/v1/tx.amino.ts | 23 + src/codegen/umee/metoken/v1/tx.registry.ts | 88 + src/codegen/umee/metoken/v1/tx.rpc.msg.ts | 47 + src/codegen/umee/metoken/v1/tx.ts | 788 ++++ src/codegen/umee/oracle/v1/events.ts | 154 +- src/codegen/umee/oracle/v1/genesis.ts | 452 +- src/codegen/umee/oracle/v1/oracle.ts | 967 ++++- src/codegen/umee/oracle/v1/query.lcd.ts | 82 +- src/codegen/umee/oracle/v1/query.rpc.Query.ts | 116 +- src/codegen/umee/oracle/v1/query.ts | 2291 ++++++++-- src/codegen/umee/oracle/v1/tx.amino.ts | 97 +- src/codegen/umee/oracle/v1/tx.registry.ts | 9 - src/codegen/umee/oracle/v1/tx.rpc.msg.ts | 16 +- src/codegen/umee/oracle/v1/tx.ts | 409 +- src/codegen/umee/rpc.query.ts | 12 + src/codegen/umee/rpc.tx.ts | 12 + src/codegen/umee/ugov/v1/events.ts | 254 ++ src/codegen/umee/ugov/v1/genesis.ts | 139 + src/codegen/umee/ugov/v1/query.lcd.ts | 36 + src/codegen/umee/ugov/v1/query.rpc.Query.ts | 63 + src/codegen/umee/ugov/v1/query.ts | 593 +++ src/codegen/umee/ugov/v1/tx.amino.ts | 18 + src/codegen/umee/ugov/v1/tx.registry.ts | 70 + src/codegen/umee/ugov/v1/tx.rpc.msg.ts | 36 + src/codegen/umee/ugov/v1/tx.ts | 495 +++ src/codegen/umee/ugov/v1/ugov.ts | 122 + src/codegen/umee/uibc/v1/events.ts | 187 + src/codegen/umee/uibc/v1/genesis.ts | 176 + src/codegen/umee/uibc/v1/query.lcd.ts | 56 + src/codegen/umee/uibc/v1/query.rpc.Query.ts | 80 + src/codegen/umee/uibc/v1/query.ts | 816 ++++ src/codegen/umee/uibc/v1/quota.ts | 253 ++ src/codegen/umee/uibc/v1/tx.amino.ts | 13 + src/codegen/umee/uibc/v1/tx.registry.ts | 52 + src/codegen/umee/uibc/v1/tx.rpc.msg.ts | 31 + src/codegen/umee/uibc/v1/tx.ts | 416 ++ src/codegen/utf8.ts | 148 + src/codegen/varint.ts | 488 +++ 347 files changed, 82697 insertions(+), 30967 deletions(-) create mode 100644 proto/umee/incentive/v1/genesis.proto create mode 100644 proto/umee/incentive/v1/incentive.proto create mode 100644 proto/umee/incentive/v1/query.proto create mode 100644 proto/umee/incentive/v1/tx.proto delete mode 100644 proto/umee/leverage/v1/gov.proto create mode 100644 proto/umee/metoken/v1/events.proto create mode 100644 proto/umee/metoken/v1/genesis.proto create mode 100644 proto/umee/metoken/v1/metoken.proto create mode 100644 proto/umee/metoken/v1/query.proto create mode 100644 proto/umee/metoken/v1/tx.proto create mode 100644 proto/umee/ugov/v1/events.proto create mode 100644 proto/umee/ugov/v1/genesis.proto create mode 100644 proto/umee/ugov/v1/query.proto create mode 100644 proto/umee/ugov/v1/tx.proto create mode 100644 proto/umee/ugov/v1/ugov.proto create mode 100644 proto/umee/uibc/v1/events.proto create mode 100644 proto/umee/uibc/v1/genesis.proto create mode 100644 proto/umee/uibc/v1/query.proto create mode 100644 proto/umee/uibc/v1/quota.proto create mode 100644 proto/umee/uibc/v1/tx.proto create mode 100644 src/codegen/binary.ts create mode 100644 src/codegen/umee/incentive/v1/genesis.ts create mode 100644 src/codegen/umee/incentive/v1/incentive.ts create mode 100644 src/codegen/umee/incentive/v1/query.lcd.ts create mode 100644 src/codegen/umee/incentive/v1/query.rpc.Query.ts create mode 100644 src/codegen/umee/incentive/v1/query.ts create mode 100644 src/codegen/umee/incentive/v1/tx.amino.ts create mode 100644 src/codegen/umee/incentive/v1/tx.registry.ts create mode 100644 src/codegen/umee/incentive/v1/tx.rpc.msg.ts create mode 100644 src/codegen/umee/incentive/v1/tx.ts create mode 100644 src/codegen/umee/metoken/v1/events.ts create mode 100644 src/codegen/umee/metoken/v1/genesis.ts create mode 100644 src/codegen/umee/metoken/v1/metoken.ts create mode 100644 src/codegen/umee/metoken/v1/query.lcd.ts create mode 100644 src/codegen/umee/metoken/v1/query.rpc.Query.ts create mode 100644 src/codegen/umee/metoken/v1/query.ts create mode 100644 src/codegen/umee/metoken/v1/tx.amino.ts create mode 100644 src/codegen/umee/metoken/v1/tx.registry.ts create mode 100644 src/codegen/umee/metoken/v1/tx.rpc.msg.ts create mode 100644 src/codegen/umee/metoken/v1/tx.ts create mode 100644 src/codegen/umee/ugov/v1/events.ts create mode 100644 src/codegen/umee/ugov/v1/genesis.ts create mode 100644 src/codegen/umee/ugov/v1/query.lcd.ts create mode 100644 src/codegen/umee/ugov/v1/query.rpc.Query.ts create mode 100644 src/codegen/umee/ugov/v1/query.ts create mode 100644 src/codegen/umee/ugov/v1/tx.amino.ts create mode 100644 src/codegen/umee/ugov/v1/tx.registry.ts create mode 100644 src/codegen/umee/ugov/v1/tx.rpc.msg.ts create mode 100644 src/codegen/umee/ugov/v1/tx.ts create mode 100644 src/codegen/umee/ugov/v1/ugov.ts create mode 100644 src/codegen/umee/uibc/v1/events.ts create mode 100644 src/codegen/umee/uibc/v1/genesis.ts create mode 100644 src/codegen/umee/uibc/v1/query.lcd.ts create mode 100644 src/codegen/umee/uibc/v1/query.rpc.Query.ts create mode 100644 src/codegen/umee/uibc/v1/query.ts create mode 100644 src/codegen/umee/uibc/v1/quota.ts create mode 100644 src/codegen/umee/uibc/v1/tx.amino.ts create mode 100644 src/codegen/umee/uibc/v1/tx.registry.ts create mode 100644 src/codegen/umee/uibc/v1/tx.rpc.msg.ts create mode 100644 src/codegen/umee/uibc/v1/tx.ts create mode 100644 src/codegen/utf8.ts create mode 100644 src/codegen/varint.ts diff --git a/.gitignore b/.gitignore index 5e09c6c..a702512 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ npm-debug.log* pids *.pid *.seed +.vscode/* # out out @@ -48,4 +49,4 @@ package-lock.json yarn.lock # others -.DS_Store \ No newline at end of file +.DS_Store diff --git a/.telescope.json b/.telescope.json index 38014c6..9b14c2c 100644 --- a/.telescope.json +++ b/.telescope.json @@ -4,6 +4,47 @@ ], "outPath": "./src/codegen", "options": { + "interfaces": { + "enabled": false, + "useByDefault": false, + "useUnionTypes": false + }, + "prototypes": { + "enabled": true, + "parser": { + "keepCase": false + }, + "methods": { + "fromJSON": false, + "toJSON": false, + "encode": true, + "decode": true, + "fromPartial": true, + "toAmino": true, + "fromAmino": true, + "fromProto": true, + "toProto": true + }, + "addTypeUrlToObjects": true, + "addTypeUrlToDecoders": true, + "typingsFormat": { + "duration": "duration", + "timestamp": "date", + "useExact": false, + "useDeepPartial": false, + "num64": "bigint", + "customTypes": { + "useCosmosSDKDec": true + } + } + }, + "bundle": { + "enabled": true + }, + "stargateClients": { + "enabled": true, + "includeCosmosDefaultTypes": true + }, "aminoEncoding": { "enabled": true }, @@ -11,7 +52,8 @@ "enabled": true }, "rpcClients": { - "enabled": true + "enabled": true, + "camelCase": true } } } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 55c8b9b..e730562 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,7 @@ "editor.formatOnSave": false }, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "eslint.validate": [ "javascript", diff --git a/package.json b/package.json index 3804627..e30299a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.3", "description": "interact with the umee blockchain", "author": "Ebrahim Elbagory ", - "homepage": "https://github.com/ebrahimUmee/umeejs#readme", + "homepage": "https://github.com/umee-network/umeejs#readme", "license": "SEE LICENSE IN LICENSE", "main": "main/index.js", "module": "module/index.js", @@ -85,8 +85,8 @@ "@babel/runtime": "^7.19.4", "@cosmjs/amino": "^0.29.3", "@cosmjs/proto-signing": "^0.29.3", - "@cosmjs/stargate": "^0.29.3", - "@cosmjs/tendermint-rpc": "^0.29.3", + "@cosmjs/stargate": "^0.32.1", + "@cosmjs/tendermint-rpc": "^0.32.1", "protobufjs": "^6.11.2" } -} +} \ No newline at end of file diff --git a/proto/umee/incentive/v1/genesis.proto b/proto/umee/incentive/v1/genesis.proto new file mode 100644 index 0000000..01d2479 --- /dev/null +++ b/proto/umee/incentive/v1/genesis.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +package umee.incentive.v1; + +option go_package = "github.com/umee-network/umee/v6/x/incentive"; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "umee/incentive/v1/incentive.proto"; + +// GenesisState defines the x/incentive module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + uint32 next_program_id = 2; + int64 last_rewards_time = 3; + repeated RewardTracker reward_trackers = 4 [(gogoproto.nullable) = false]; + repeated RewardAccumulator reward_accumulators = 5 [(gogoproto.nullable) = false]; + repeated IncentiveProgram upcoming_programs = 6 [(gogoproto.nullable) = false]; + repeated IncentiveProgram ongoing_programs = 7 [(gogoproto.nullable) = false]; + repeated IncentiveProgram completed_programs = 8 [(gogoproto.nullable) = false]; + repeated Bond bonds = 9 [(gogoproto.nullable) = false]; + repeated AccountUnbondings account_unbondings = 10 [(gogoproto.nullable) = false]; +} + +// Bond tracks the amount of coins of one uToken denomination bonded +// by a single account. +message Bond { + string account = 1; + cosmos.base.v1beta1.Coin uToken = 2 [(gogoproto.nullable) = false]; +} + +// RewardTracker tracks the value of a given lock denom's RewardAccumulator at the +// last time a specific account calculated pending rewards for it. When calculating +// available rewards, this value is used to determine the difference between the current +// RewardAccumulator for a uToken and the last value at which the user updated bonds or claimed +// tokens. Their pending rewards increase by only the rewards accrued in that time period. +message RewardTracker { + string account = 1; + string uToken = 2; + repeated cosmos.base.v1beta1.DecCoin rewards = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; +} + +// RewardAccumulator is a global reward tracking struct that indicates the amount +// of rewards that a reference amount of a bonded uToken denom would have accumulated +// if it was bonded since genesis. To prevent rounding issues, the reference amount is +// 10^exponent of the uToken's smallest possible amount, generally matching the exponent +// of the associated base token registered with the leverage module. +message RewardAccumulator { + string uToken = 1; + repeated cosmos.base.v1beta1.DecCoin rewards = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; + uint32 exponent = 3; +} + +// Unbonding is a structure that tracks an in-progress token unbonding. +// It tracks both its start time and end time, so that if the module's +// unbonding time changes, the unbonding can complete at the earlier of +// its original end time or its new one based on the new parameter. +message Unbonding { + int64 start = 1; + int64 end = 2; + cosmos.base.v1beta1.Coin uToken = 3 [(gogoproto.nullable) = false]; +} + +// AccountUnbondings is a structure that is used to store all of an account's unbondings +// for a single bonded uToken denom in both KVStore and genesis state. +message AccountUnbondings { + string account = 1; + string uToken = 2; + repeated Unbonding unbondings = 3 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/umee/incentive/v1/incentive.proto b/proto/umee/incentive/v1/incentive.proto new file mode 100644 index 0000000..687b860 --- /dev/null +++ b/proto/umee/incentive/v1/incentive.proto @@ -0,0 +1,69 @@ +syntax = "proto3"; +package umee.incentive.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/incentive"; + +// Params defines the parameters for the incentive module. +message Params { + option (gogoproto.equal) = true; + + // max_unbondings is the maximum amount of concurrent unbondings an address can have + // of each bonded uToken denom. Zero is interpreted as no limit. + uint32 max_unbondings = 1; + + // unbonding_duration is the unbonding duration (in seconds). + int64 unbonding_duration = 2; + + // emergency_unbond_fee is the portion of a bond that is paid when it is instantly + // released using MsgEmergencyUnbond. For example, 0.01 is a 1% fee. Ranges 0-1. + string emergency_unbond_fee = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// IncentiveProgram defines a liquidity mining incentive program on a single +// locked uToken denom that will run for a set amount of time. +message IncentiveProgram { + option (gogoproto.equal) = true; + + // ID uniquely identifies the incentive program after it has been created. + // It is zero when the program is being proposed by governance, and is set + // to its final value when the proposal passes. + uint32 ID = 1; + + // start_time is the unix time (in seconds) at which the incentives begin. + // If a program is passed after its intended start time, its start time + // will be increased to the current time, with program duration unchanged. + int64 start_time = 2; + + // duration is the length of the incentive program from start time to + // completion in seconds. + int64 duration = 3; + + // uToken is the incentivized uToken collateral denom. Suppliers who collateralize + // this asset then bond it to the incentive module are eligible for this program's + // rewards. + string uToken = 4; + + // funded indicates whether a program bas been funded. This can happen when + // a program passes if funding from community fund, or any time before the + // program's start time if funding with MsgSponsor. A program that reaches + // its start time without being funded is cancelled. + bool funded = 5; + + // total_rewards are total amount of rewards which can be distributed to + // suppliers by this program. This is set to its final value when the program + // is proposed by governance. + cosmos.base.v1beta1.Coin total_rewards = 6 [(gogoproto.nullable) = false]; + + // remaining_rewards are total amount of this program's funded rewards + // which have not yet been allocated to suppliers. This is zero until the + // program is both passed by governance and funded, at which point it + // starts at the same value as total_rewards then begins decreasing + // to zero as the program runs to completion. + cosmos.base.v1beta1.Coin remaining_rewards = 7 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/umee/incentive/v1/query.proto b/proto/umee/incentive/v1/query.proto new file mode 100644 index 0000000..c6d6849 --- /dev/null +++ b/proto/umee/incentive/v1/query.proto @@ -0,0 +1,253 @@ +syntax = "proto3"; +package umee.incentive.v1; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "umee/incentive/v1/incentive.proto"; +import "umee/incentive/v1/genesis.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/incentive"; + +// Query defines the gRPC querier service. +service Query { + // Params queries the parameters of the x/incentive module. + rpc Params(QueryParams) returns (QueryParamsResponse) { + option (google.api.http).get = "/umee/incentive/v1/params"; + } + + // TotalBonded queries the sum of all bonded collateral uTokens. + rpc TotalBonded(QueryTotalBonded) + returns (QueryTotalBondedResponse) { + option (google.api.http).get = "/umee/incentive/v1/total_bonded"; + } + + // TotalUnbonding queries the sum of all unbonding collateral uTokens. + rpc TotalUnbonding(QueryTotalUnbonding) + returns (QueryTotalUnbondingResponse) { + option (google.api.http).get = "/umee/incentive/v1/total_unbonding"; + } + + // AccountBonds queries all bonded collateral and unbondings associated with an account. + rpc AccountBonds(QueryAccountBonds) + returns (QueryAccountBondsResponse) { + option (google.api.http).get = "/umee/incentive/v1/account_bonds/{address}"; + } + + // PendingRewards queries unclaimed incentive rewards associated with an account. + rpc PendingRewards(QueryPendingRewards) + returns (QueryPendingRewardsResponse) { + option (google.api.http).get = "/umee/incentive/v1/pending_rewards/{address}"; + } + + // CompletedIncentivePrograms queries for all incentives programs that have been passed + // by governance, and either run to completion or expired immediately due to not being funded. + rpc CompletedIncentivePrograms(QueryCompletedIncentivePrograms) + returns (QueryCompletedIncentiveProgramsResponse) { + option (google.api.http).get = "/umee/incentive/v1/programs/completed"; + } + + // OngoingIncentivePrograms queries for all incentives programs that have been passed + // by governance, funded, and started but not yet completed. + rpc OngoingIncentivePrograms(QueryOngoingIncentivePrograms) + returns (QueryOngoingIncentiveProgramsResponse) { + option (google.api.http).get = "/umee/incentive/v1/programs/ongoing"; + } + + // UpcomingIncentivePrograms queries for all incentives programs that have been passed + // by governance, but not yet started. They may or may not have been funded. + rpc UpcomingIncentivePrograms(QueryUpcomingIncentivePrograms) + returns (QueryUpcomingIncentiveProgramsResponse) { + option (google.api.http).get = "/umee/incentive/v1/programs/upcoming"; + } + + // IncentiveProgram queries a single incentive program by ID. + rpc IncentiveProgram(QueryIncentiveProgram) + returns (QueryIncentiveProgramResponse) { + option (google.api.http).get = "/umee/incentive/v1/program/{id}"; + } + + // CurrentRates queries the hypothetical return of a bonded uToken denomination + // if current incentive rewards continued for one year. The response is an sdk.Coins + // of base token rewards, per reference amount (usually 10^exponent of the uToken.) + rpc CurrentRates(QueryCurrentRates) + returns (QueryCurrentRatesResponse) { + option (google.api.http).get = "/umee/incentive/v1/current_rates"; + } + + // ActualRates queries the hypothetical return of a bonded uToken denomination + // if current incentive rewards continued for one year. The response is an sdk.Dec + // representing an oracle-adjusted APY. + rpc ActualRates(QueryActualRates) + returns (QueryActualRatesResponse) { + option (google.api.http).get = "/umee/incentive/v1/actual_rates"; + } + + // LastRewardTime queries the last block time at which incentive rewards were calculated. + rpc LastRewardTime(QueryLastRewardTime) + returns (QueryLastRewardTimeResponse) { + option (google.api.http).get = "/umee/incentive/v1/last_reward_time"; + } +} + +// QueryParams defines the request structure for the Params gRPC service +// handler. +message QueryParams {} + +// QueryParamsResponse defines the response structure for the Params gRPC +// service handler. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QueryPendingRewards defines the request structure for the PendingRewards gRPC service handler. +message QueryPendingRewards { + string address = 1; +} + +// QueryPendingRewardsResponse defines the response structure for the PendingRewards gRPC service handler. +message QueryPendingRewardsResponse { + repeated cosmos.base.v1beta1.Coin rewards = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// QueryAccountBonds defines the request structure for the AccountBonds gRPC service handler. +message QueryAccountBonds { + string address = 1; +} + +// QueryAccountBondsResponse defines the response structure for the AccountBonds gRPC service handler. +message QueryAccountBondsResponse { + repeated cosmos.base.v1beta1.Coin bonded = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + repeated cosmos.base.v1beta1.Coin unbonding = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + repeated Unbonding unbondings = 3 [(gogoproto.nullable) = false]; +} + +// QueryTotalBonded defines the request structure for the TotalBonded gRPC service handler. +message QueryTotalBonded { + // denom is an optional field which causes the query to return the totals of only one uToken + string denom = 1; +} + +// QueryTotalBondedResponse defines the response structure for the TotalBonded gRPC service handler. +message QueryTotalBondedResponse { + repeated cosmos.base.v1beta1.Coin bonded = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// QueryTotalUnbonding defines the request structure for the TotalUnbonding gRPC service handler. +message QueryTotalUnbonding { + // denom is an optional field which causes the query to return the totals of only one uToken + string denom = 1; +} + +// QueryTotalUnbondingResponse defines the response structure for the TotalUnbonding gRPC service handler. +message QueryTotalUnbondingResponse { + repeated cosmos.base.v1beta1.Coin unbonding = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// QueryUpcomingIncentivePrograms defines the request structure for the +// OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. +message QueryUpcomingIncentivePrograms { +} + +// QueryUpcomingIncentiveProgramsResponse defines the response structure for the +// OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. +message QueryUpcomingIncentiveProgramsResponse { + repeated IncentiveProgram programs = 1 [(gogoproto.nullable) = false]; +} + +// QueryOngoingIncentivePrograms defines the request structure for the +// OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. +message QueryOngoingIncentivePrograms { +} + +// QueryOngoingIncentiveProgramsResponse defines the response structure for the +// OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. +message QueryOngoingIncentiveProgramsResponse { + repeated IncentiveProgram programs = 1 [(gogoproto.nullable) = false]; +} + +// QueryCompletedIncentivePrograms defines the request structure for the +// CompletedIncentivePrograms gRPC service handler. +message QueryCompletedIncentivePrograms {} + +// QueryCompletedIncentiveProgramsResponse defines the response structure for the +// CompletedIncentivePrograms gRPC service handler. +message QueryCompletedIncentiveProgramsResponse { + repeated IncentiveProgram programs = 1 [(gogoproto.nullable) = false]; +} + +// QueryIncentiveProgram defines the request structure for the IncentiveProgram +// gRPC service handler. +message QueryIncentiveProgram { + // ID specifies which program to query for + uint32 id = 1; +} + +// QueryIncentivePrograResponse defines the response structure for the +// IncentiveProgram gRPC service handler. +message QueryIncentiveProgramResponse { + IncentiveProgram program = 1 [(gogoproto.nullable) = false]; +} + +// QueryCurrentRates defines the request structure for the CurrentRates gRPC service handler. +message QueryCurrentRates { + // uToken is the uToken denomination whose current annual rate of rewards is being queried + string uToken = 1; +} + +// QueryCurrentRatesResponse defines the response structure for the CurrentRates gRPC service handler. +message QueryCurrentRatesResponse { + // Reference Bond is an amount of bonded uTokens (usually 10^exponent) whose current rewards are being + // calculated. This amount can be used to compute an individual user's rewards: for example, if a user has + // 2.5x the reference amount currently bonded, then they would receive 2.5x the rewards below annually + // at current rates. + cosmos.base.v1beta1.Coin reference_bond = 1 [ + (gogoproto.nullable) = false + ]; + // Rewards are the amount of base token rewards that the reference amount of bonded uTokens would earn + // if current rates continued for a full year. + repeated cosmos.base.v1beta1.Coin rewards = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// QueryLastRewardTime defines the request structure for the LastRewardTime gRPC service +// handler. +message QueryLastRewardTime {} + +// QueryLastRewardTimeResponse defines the response structure for the LastRewardTime gRPC +// service handler. +message QueryLastRewardTimeResponse { + int64 time = 1; +} + +// QueryActualRates defines the request structure for the ActualRates gRPC service handler. +message QueryActualRates { + // uToken is the uToken denomination whose current annual rate of rewards is being queried + string uToken = 1; +} + +// QueryActualRatesResponse defines the response structure for the ActualRates gRPC service handler. +message QueryActualRatesResponse { + // APY is the oracle price-adjusted APY of the bonded uToken. + string APY = 1 [ + (gogoproto.nullable) = false, + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + ]; +} \ No newline at end of file diff --git a/proto/umee/incentive/v1/tx.proto b/proto/umee/incentive/v1/tx.proto new file mode 100644 index 0000000..73745d2 --- /dev/null +++ b/proto/umee/incentive/v1/tx.proto @@ -0,0 +1,127 @@ +syntax = "proto3"; +package umee.incentive.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "umee/incentive/v1/incentive.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/incentive"; + +// Msg defines the x/incentive module's Msg service. +service Msg { + // Claim defines a method for claiming any pending incentive rewards. + rpc Claim(MsgClaim) returns (MsgClaimResponse); + + // Bond defines a method for bonding uToken collateral. + rpc Bond(MsgBond) returns (MsgBondResponse); + + // BeginUnbonding defines a method for starting to unbond uToken collateral. + // Only max_unbondings unbondings can be active at per user, per denom, at once. + rpc BeginUnbonding(MsgBeginUnbonding) returns (MsgBeginUnbondingResponse); + + // EmergencyUnbond defines a method for instantly unbonding uToken collateral in exchange for a fee. + // This can finish existing unbondings or unbond bonded tokens, and is not restricted by max_unbondings. + rpc EmergencyUnbond(MsgEmergencyUnbond) returns (MsgEmergencyUnbondResponse); + + // Sponsor defines a permissionless method for sponsoring an upcoming, not yet funded incentive program. + // The sponsor must be a single account and the MsgSponsor must fully cover the expected program rewards. + rpc Sponsor(MsgSponsor) returns (MsgSponsorResponse); + + // GovSetParams is used by governance proposals to update parameters. + rpc GovSetParams(MsgGovSetParams) returns (MsgGovSetParamsResponse); + + // GovCreatePrograms is used by governance proposals to create and optionally fund incentive programs. + rpc GovCreatePrograms(MsgGovCreatePrograms) returns (MsgGovCreateProgramsResponse); +} + +// MsgClaim represents a account's request to claim pending rewards. +message MsgClaim { + string account = 1; +} + +// MsgClaimResponse defines the Msg/Claim response type. +message MsgClaimResponse { + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// MsgBond represents a account's request to bond uToken collateral. +message MsgBond { + string account = 1; + cosmos.base.v1beta1.Coin uToken = 2 [(gogoproto.nullable) = false]; +} + +// MsgBondResponse defines the Msg/Lock response type. +message MsgBondResponse {} + +// MsgBeginUnbonding represents a account's request to begin unbonding uToken collateral. +message MsgBeginUnbonding { + string account = 1; + cosmos.base.v1beta1.Coin uToken = 2 [(gogoproto.nullable) = false]; +} + +// MsgBeginUnbondingResponse defines the Msg/BeginUnbonding response type. +message MsgBeginUnbondingResponse {} + +// MsgEmergencyUnbond represents a account's request to instantly unbond uToken collateral for a fee. +message MsgEmergencyUnbond { + string account = 1; + cosmos.base.v1beta1.Coin uToken = 2 [(gogoproto.nullable) = false]; +} + +// MsgEmergencyUnbondResponse defines the Msg/EmergencyUnbond response type. +message MsgEmergencyUnbondResponse {} + +// MsgSponsor represents a sponsor's request to fund rewards for an incentive program. +// The program must have been passed by governance, not yet started, and not yet funded. +// Funded assets must be the full amount required by the program. +message MsgSponsor { + // Sponsor bech32 account address + string sponsor = 1; + uint32 program = 2; +} + +// MsgSponsorResponse defines the Msg/Sponsor response type. +message MsgSponsorResponse {} + +// MsgGovSetParams is used by governance to update module parameters. +message MsgGovSetParams { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgGovSetParamsResponse defines the Msg/SetParams response type. +message MsgGovSetParamsResponse {} + +// MsgGovCreatePrograms is used by governance to create one or more incentive programs. +// There are two funding scenarios, depending on from_community_fund. +// If it is true,the programs' total rewards will be automatically withdrawn from +// the (parameter) community_fund_address to the incentive module account when this +// message is passed. (Insufficient funds cause the parameter to be treated as false.) +// If it is false, a MsgSponsor funding each program's full amount must be submitted +// after this message passes, but before the program's start_time, or the program +// will be cancelled when it would otherwise start. +message MsgGovCreatePrograms { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + repeated IncentiveProgram programs = 2 [(gogoproto.nullable) = false]; + + // from_community_fund defines the source of funds for proposed incentive programs. + bool from_community_fund = 3; +} + +// MsgGovCreateProgramsResponse defines the Msg/CreatePrograms response type. +message MsgGovCreateProgramsResponse {} diff --git a/proto/umee/leverage/v1/events.proto b/proto/umee/leverage/v1/events.proto index b59878f..3b9eaf7 100644 --- a/proto/umee/leverage/v1/events.proto +++ b/proto/umee/leverage/v1/events.proto @@ -5,7 +5,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/umee-network/umee/v3/x/leverage/types"; +option go_package = "github.com/umee-network/umee/v6/x/leverage/types"; option (gogoproto.goproto_getters_all) = false; diff --git a/proto/umee/leverage/v1/genesis.proto b/proto/umee/leverage/v1/genesis.proto index 1289dd1..600b4af 100644 --- a/proto/umee/leverage/v1/genesis.proto +++ b/proto/umee/leverage/v1/genesis.proto @@ -5,7 +5,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "umee/leverage/v1/leverage.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/umee-network/umee/v3/x/leverage/types"; +option go_package = "github.com/umee-network/umee/v6/x/leverage/types"; option (gogoproto.goproto_getters_all) = false; @@ -26,6 +26,7 @@ message GenesisState { (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; + repeated SpecialAssetPair special_pairs = 10 [(gogoproto.nullable) = false]; } // AdjustedBorrow is a borrow struct used in the leverage module's genesis diff --git a/proto/umee/leverage/v1/gov.proto b/proto/umee/leverage/v1/gov.proto deleted file mode 100644 index 98359f5..0000000 --- a/proto/umee/leverage/v1/gov.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package umee.leverage.v1; - -import "gogoproto/gogo.proto"; -import "umee/leverage/v1/leverage.proto"; - -option go_package = "github.com/umee-network/umee/v3/x/leverage/types"; - -option (gogoproto.goproto_getters_all) = false; - -// UpdateRegistryProposal defines a governance proposal type where the token -// registry can be updated in the Umee capital facility. Note, the registry -// defined in the proposal replaces the current registry in its entirety. -message UpdateRegistryProposal { - option (gogoproto.equal) = true; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - string title = 1; - string description = 2; - repeated Token registry = 3 [(gogoproto.nullable) = false]; -} diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index b51845f..4637a0d 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -3,15 +3,13 @@ package umee.leverage.v1; import "gogoproto/gogo.proto"; -option go_package = "github.com/umee-network/umee/v3/x/leverage/types"; +option go_package = "github.com/umee-network/umee/v6/x/leverage/types"; option (gogoproto.goproto_getters_all) = false; // Params defines the parameters for the leverage module. -// See https://github.com/umee-network/umee/blob/main/docs/design_docs/010-market-params.md -// for more details. message Params { - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // Complete Liquidation Threshold determines how far between // liquidation_threshold (LT) and collateral_value (CV) a borrower's @@ -81,7 +79,8 @@ message Params { message Token { option (gogoproto.equal) = true; - // Base Denom is the denomination of the underlying base token. + // Base Denom is the denomination of the underlying base token. Must be the base + // denom as registered in the Bank module (so IBC denom for IBC tokens). string base_denom = 1 [(gogoproto.moretags) = "yaml:\"base_denom\""]; // Reserve Factor defines what portion of accrued interest goes to reserves @@ -96,6 +95,7 @@ message Token { // Collateral Weight defines what portion of the total value of the asset // can contribute to a users borrowing power. If the collateral weight is // zero, using this asset as collateral against borrowing will be disabled. + // Must be smaller than `liquidation_threshold`. // Valid values: 0-1. string collateral_weight = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -106,8 +106,9 @@ message Token { // Liquidation Threshold defines what amount of the total value of the // asset as a collateral can contribute to a user's liquidation threshold // (above which they become eligible for liquidation). - // See also: min_close_factor. + // Must be bigger than `collateral_weight`. // Valid values: 0-1. + // See also: min_close_factor. string liquidation_threshold = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -214,7 +215,10 @@ message Token { // Borrowing, collateralizing, or withdrawing assets is not allowed when the // result of such action invalidates min_collateral_liquidity. // Liquidity can only drop below this value due to interest or liquidations. - // Valid values: 0 - 1 + // The goal is to assure that there is enough available (not borrowed) token to be available + // for withdraw when there is a collateral liquidation and the liquidator needs to + // withdraw uToken. + // Valid values: 0 - inf string min_collateral_liquidity = 17 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -230,4 +234,71 @@ message Token { (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"max_supply\"" ]; + + // Historic Medians is the number of median historic prices to request from + // the oracle module when evaluating new borrow positions containing this token. + // All MsgBorrow, MsgWithdraw, and MsgDecollateralize must result in healthy + // borrow positions under both current and historic prices. The default value of + // zero for this field causes current price to be used in those calculations + // for the affected Token. + // The time span covered by the historic median will be: + // oracle.Params.median_stamp_period * oracle.Params.historic_stamp_period * historic_medians. + uint32 historic_medians = 19 [ + (gogoproto.moretags) = "yaml:\"historic_medians\"" + ]; +} + +// SpecialAssetPair defines a special (increased) CollateralWeight used when a specified Collateral is used +// to collateralize a specified Borrow. This association is one-way (so it does not work in reverse). +message SpecialAssetPair { + option (gogoproto.equal) = true; + + // Collateral base token denom. + string collateral = 1; + + // Borrow base token denom. + string borrow = 2; + + // Collateral Weight defines what portion of the total value of the asset + // can contribute to a users borrowing power. For special asset pairs, this + // also overrides the borrowed asset's collateral weight when evaluating borrow + // factor. Valid values: 0-1. + string collateral_weight = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Liquidation threshold defines what portion of the total value of the assets + // can contribute to a users liquidation threshold, when borrowing within the pair. + // Valid values in range [collateral_weight,1] + string liquidation_threshold = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// SpecialAssetSet defines a special (increased) CollateralWeight used when any of a set +// of assets are used to borrow each other (except for looping). It is used in gov proposals +// to create all the pairs that make up a set at once. +message SpecialAssetSet { + option (gogoproto.equal) = true; + + // Collateral or borrowed base token denoms. + repeated string assets = 1; + + // Collateral Weight defines what portion of the total value of the assets + // can contribute to a users borrowing power, when borrowing within the set. + // Valid values: 0-1. + string collateral_weight = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Liquidation threshold defines what portion of the total value of the assets + // can contribute to a users liquidation threshold, when borrowing within the set. + // Valid values in range [collateral_weight,1] + string liquidation_threshold = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } diff --git a/proto/umee/leverage/v1/query.proto b/proto/umee/leverage/v1/query.proto index 2cd6f8e..7bb6cdc 100644 --- a/proto/umee/leverage/v1/query.proto +++ b/proto/umee/leverage/v1/query.proto @@ -7,7 +7,7 @@ import "umee/leverage/v1/leverage.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/umee-network/umee/v3/x/leverage/types"; +option go_package = "github.com/umee-network/umee/v6/x/leverage/types"; option (gogoproto.goproto_getters_all) = false; @@ -24,6 +24,12 @@ service Query { option (google.api.http).get = "/umee/leverage/v1/registered_tokens"; } + // SpecialAssets queries for all special asset pairs. + rpc SpecialAssets(QuerySpecialAssets) + returns (QuerySpecialAssetsResponse) { + option (google.api.http).get = "/umee/leverage/v1/special_assets"; + } + // MarketSummary queries a base asset's current borrowing and supplying conditions. rpc MarketSummary(QueryMarketSummary) returns (QueryMarketSummaryResponse) { @@ -53,6 +59,35 @@ service Query { returns (QueryBadDebtsResponse) { option (google.api.http).get = "/umee/leverage/v1/bad_debts"; } + + // MaxWithdraw queries the maximum amount of a given token an address can withdraw. + rpc MaxWithdraw(QueryMaxWithdraw) + returns (QueryMaxWithdrawResponse) { + option (google.api.http).get = "/umee/leverage/v1/max_withdraw"; + } + + // MaxBorrow queries the maximum amount of a given token an address can borrow. + rpc MaxBorrow(QueryMaxBorrow) + returns (QueryMaxBorrowResponse) { + option (google.api.http).get = "/umee/leverage/v1/max_borrow"; + } + + // Inspect is the customizable inspector query. It returns a list of all borrowers, + // starting from the highest borrowed value, filtered by any combination of: minimum + // borrowed value (optionally of a specified token), minimum collateral value, minimum + // progress toward liquidation threshold, and minimum LTV. Each account is displayed + // with its address and borrowed/liquidation/collateral USD values, as well as its + // actual token positions in human-readable symbol denoms instead of uTokens or ibc denoms. + rpc Inspect(QueryInspect) + returns (QueryInspectResponse) { + option (google.api.http).get = "/umee/leverage/v1/inspect"; + } + + // InspectAccount runs the inspect query on a single address + rpc InspectAccount(QueryInspectAccount) + returns (QueryInspectAccountResponse) { + option (google.api.http).get = "/umee/leverage/v1/inspect-account"; + } } // QueryParams defines the request structure for the Params gRPC service @@ -67,7 +102,9 @@ message QueryParamsResponse { // QueryRegisteredTokens defines the request structure for the RegisteredTokens // gRPC service handler. -message QueryRegisteredTokens {} +message QueryRegisteredTokens { + string base_denom = 1; +} // QueryRegisteredTokensResponse defines the response structure for the // RegisteredTokens gRPC service handler. @@ -75,6 +112,19 @@ message QueryRegisteredTokensResponse { repeated Token registry = 1 [(gogoproto.nullable) = false]; } +// QuerySpecialAssets defines the request structure for the SpecialAssets +// gRPC service handler. +message QuerySpecialAssets { + // denom can be used to query only pairs affecting a specific asset + string denom = 1; +} + +// QuerySpecialAssetsResponse defines the response structure for the +// SpecialAssets gRPC service handler. +message QuerySpecialAssetsResponse { + repeated SpecialAssetPair pairs = 1 [(gogoproto.nullable) = false]; +} + // QueryMarketSummary defines the request structure for the MarketSummary gRPC service handler. message QueryMarketSummary { string denom = 1; @@ -86,7 +136,7 @@ message QueryMarketSummaryResponse { string symbol_denom = 1; // Exponent is the power of ten required to get from base denom to symbol denom. For example, an exponent of 6 means 10^6 uumee = 1 UMEE. uint32 exponent = 2; - // Oracle Price is the current USD value of a base token. Exponent must be applied to reach the price from symbol_denom. For example, a price of $0.000001 for 1 uumee is equivalent to $1.00 for 1 UMEE. Oracle price is nil when the oracle is down. + // Oracle Price is the current USD value of a token. Oracle price is nil when the oracle is down. string oracle_price = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = true @@ -119,7 +169,7 @@ message QueryMarketSummaryResponse { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - // Collateral is the total amount of uTokens collateralized by all borrowers. Collateral is denominated in uTokenso, so both uToken exchange rate and exponent must also be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee and uToken exhange rate is 1.2, then 5 UMEE have been collateralized. + // Collateral is the total amount of uTokens collateralized by all borrowers. Collateral is denominated in uTokenso, so both uToken exchange rate and exponent must also be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee and uToken exchange rate is 1.2, then 5 UMEE have been collateralized. string collateral = 9 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false @@ -139,12 +189,12 @@ message QueryMarketSummaryResponse { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - // Maximum Collateral is the amount of a token that can be collateralized, including that which is already collateral. This amount is less than total supply due to safety limits. It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee, uToken exhange rate is 1.2, and maximum borrow is 7000000 uumee, then a maximum of 2 additional UMEE is permitted to be collateralized. + // Maximum Collateral is the amount of a token that can be collateralized, including that which is already collateral. This amount is less than total supply due to safety limits. It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee, uToken exchange rate is 1.2, and maximum borrow is 7000000 uumee, then a maximum of 2 additional UMEE is permitted to be collateralized. string maximum_collateral = 13 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - // Mimimum Liquidity is the minimum amount of liquidity in the module required by safety limits, based on the current collateral. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if liquidity is 9000000 uumee and minimum liquidity is 8000000 uumee, then a maximum of 1 additional UMEE is currently available for borrowing or withdrawal. + // Minimum Liquidity is the minimum amount of liquidity in the module required by safety limits, based on the current collateral. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if liquidity is 9000000 uumee and minimum liquidity is 8000000 uumee, then a maximum of 1 additional UMEE is currently available for borrowing or withdrawal. string minimum_liquidity = 14 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false @@ -170,6 +220,12 @@ message QueryMarketSummaryResponse { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // Oracle Historic Price is the historic USD value of a token. Historic price is defined as the median of the last N historic median prices from the oracle module, with N being this token's HistoricMedians in the leverage registry. Current price is used if required medians is zero. Price is nil when the oracle is down or insufficient historic medians are available. + string oracle_historic_price = 19 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = true + ]; + string errors = 20; } // QueryAccountBalances defines the request structure for the AccountBalances gRPC service handler. @@ -203,28 +259,59 @@ message QueryAccountSummary { // QueryAccountSummaryResponse defines the response structure for the AccountSummary gRPC service handler. message QueryAccountSummaryResponse { - // Supplied Value is the sum of the USD value of all tokens the account has supplied, includng interest earned. + // Supplied Value is the sum of the USD value of all tokens the account has supplied, including interest earned. + // It uses the lower of spot or historic price for each token. + // Computation skips assets which are missing oracle prices, potentially resulting in a lower supplied + // value than if prices were all available. string supplied_value = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; // Collateral Value is the sum of the USD value of all uTokens the account has collateralized. + // It uses the lower of spot or historic price for each token. + // Computation skips collateral which is missing an oracle price, potentially resulting in a lower collateral + // value than if prices were all available. string collateral_value = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; // Borrowed Value is the sum of the USD value of all tokens the account has borrowed, including interest owed. + // It uses the higher of spot or historic price for each token. + // Computation skips borrows which are missing oracle prices, potentially resulting in a lower borrowed + // value than if prices were all available. string borrowed_value = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; // Borrow Limit is the maximum Borrowed Value the account is allowed to reach through direct borrowing. + // The lower of spot or historic price for each collateral token is used when calculating borrow limits. + // Computation skips collateral which is missing an oracle price, potentially resulting in a lower borrow + // limit than if prices were all available. Will be null if an oracle price required for computation is + // missing. string borrow_limit = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = true ]; // Liquidation Threshold is the Borrowed Value at which the account becomes eligible for liquidation. + // Computation skips borrows which are missing an oracle price, potentially resulting in a lower borrow + // limit than if prices were all available. Will be null if an oracle price required for computation is + // missing. string liquidation_threshold = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = true + ]; + // Spot Supplied Value is supplied value but always uses the most recent available spot prices. + string spot_supplied_value = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Spot Collateral Value is collateral value but always uses the most recent available spot prices. + string spot_collateral_value = 7 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Spot Borrowed Value is borrowed value but always uses the most recent available spot prices. + string spot_borrowed_value = 8 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; @@ -250,3 +337,115 @@ message QueryBadDebtsResponse { (gogoproto.nullable) = false ]; } + +// QueryMaxWithdraw defines the request structure for the MaxWithdraw gRPC service handler. +message QueryMaxWithdraw { + string address = 1; + // denom is the base token denom associated with the uToken to withdraw. + // empty denom will query all registered tokens. + string denom = 2; +} + +// QueryMaxWithdrawResponse defines the response structure for the MaxWithdraw gRPC service handler. +message QueryMaxWithdrawResponse { + // uTokens is the maximum amount of uTokens that can be withdrawn + repeated cosmos.base.v1beta1.Coin uTokens = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // Tokens is the equivalent of max uTokens converted to base tokens + repeated cosmos.base.v1beta1.Coin tokens = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// QueryMaxBorrow defines the request structure for the MaxBorrow gRPC service handler. +message QueryMaxBorrow { + string address = 1; + // denom is the base token denom to borrow. + // empty denom will query all registered tokens. + string denom = 2; +} + +// QueryMaxBorrowResponse defines the response structure for the MaxBorrow gRPC service handler. +message QueryMaxBorrowResponse { + // Tokens is the maximum amount of tokens that can be borrowed + repeated cosmos.base.v1beta1.Coin tokens = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// QueryInspect defines the request structure for the Inspect gRPC service handler. +message QueryInspect { + // Symbol selects a symbol denom to sort accounts by borrowed value. Use "all" or empty string to show all. + string symbol = 1; + // Borrowed is the minimum USD value an account must have borrowed to show. Use 0 to show all. + double borrowed = 2; + // Collateral is the minimum USD value of collateral an account must have to show. Use 0 to show all. + double collateral = 3; + // Danger is the minimum progress toward liquidation an account must have to show. Use 0 to show all. + // Measured as the ratio (borrowed value / liquidation threshold), where > 1 is liquidation-eligible. + double danger = 4; + // LTV is the minimum ratio (borrowed value / collateral value) an account must have to show. Use 0 to show all. + double ltv = 5; +} + +// QueryInspectAccount defines the request structure for the InspectAccount gRPC service handler. +message QueryInspectAccount { + string address = 1; +} + +// QueryInspectResponse defines the response structure for the Inspect gRPC service handler. +message QueryInspectResponse { + repeated InspectAccount borrowers = 1 [ + (gogoproto.nullable) = false + ]; + // Failures is a list of addresses for which the position calculation failed. + repeated string failures = 2; +} + +// QueryInspectAccountResponse defines the response structure for the InspectAccount gRPC service handler. +message QueryInspectAccountResponse { + InspectAccount borrower = 1 [ + (gogoproto.nullable) = false + ]; +} + +// InspectAccount contains risk and balance info for a single account for the inspector query. +message InspectAccount { + // Address of a borrower + string address = 1; + // USD totals of borrower's collateral, debt, and liquidation threshold. + RiskInfo analysis = 2; + // Collateral and borrowed tokens, denoted in human-readable symbol denom instead of ibc denom. + DecBalances position = 3; + // Info is a string which can be used to report additional information of any type. + // UNSTABLE: We do not guarantee consistency of any data structures contained within the string. + string info = 4; +} + +// RiskInfo defines a borrower's account health without requiring sdk.Dec formatting. +message RiskInfo { + // Borrowed is account's borrowed value in USD. + double Borrowed = 1; + // Liquidation is account's liquidation threshold in USD. + double Liquidation = 2; + // Value is account's collateral value in USD. + double Value = 3; +} + +// DecBalances contains an account's position denoted in symbol denom tokens. +message DecBalances { + // Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens. + repeated cosmos.base.v1beta1.DecCoin collateral = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; + // Borrowed contains all tokens the account has borrowed, including interest owed. + repeated cosmos.base.v1beta1.DecCoin borrowed = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; +} diff --git a/proto/umee/leverage/v1/tx.proto b/proto/umee/leverage/v1/tx.proto index 62dc2af..46a47c8 100644 --- a/proto/umee/leverage/v1/tx.proto +++ b/proto/umee/leverage/v1/tx.proto @@ -2,9 +2,12 @@ syntax = "proto3"; package umee.leverage.v1; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; +import "umee/leverage/v1/leverage.proto"; -option go_package = "github.com/umee-network/umee/v3/x/leverage/types"; +option go_package = "github.com/umee-network/umee/v6/x/leverage/types"; option (gogoproto.goproto_getters_all) = false; option (gogoproto.messagename_all) = true; @@ -19,6 +22,11 @@ service Msg { // exchange for burning uTokens. rpc Withdraw(MsgWithdraw) returns (MsgWithdrawResponse); + // MaxWithdraw moves previously supplied tokens from the module back to the user balance in + // exchange for burning uTokens. It automatically calculates the maximum valid amount to withdraw. + // Zero is returned if no more tokens can be withdrawn. + rpc MaxWithdraw(MsgMaxWithdraw) returns (MsgMaxWithdrawResponse); + // Collateralize enables selected uTokens as collateral, which moves them to the module. rpc Collateralize(MsgCollateralize) returns (MsgCollateralizeResponse); @@ -29,6 +37,10 @@ service Msg { // Borrow allows a user to borrow tokens from the module if they have sufficient collateral. rpc Borrow(MsgBorrow) returns (MsgBorrowResponse); + // MaxBorrow allows a user to borrow the maximum amount of tokens their collateral will allow. + // Zero is returned if no more can be borrowed. + rpc MaxBorrow(MsgMaxBorrow) returns (MsgMaxBorrowResponse); + // Repay allows a user to repay previously borrowed tokens and interest. rpc Repay(MsgRepay) returns (MsgRepayResponse); @@ -36,8 +48,34 @@ service Msg { // of the target's collateral. rpc Liquidate(MsgLiquidate) returns (MsgLiquidateResponse); + // LeveragedLiquidate allows a user to repay a different user's borrowed coins in exchange for some + // of the target's collateral. For leveraged liquidations, the tokens to repay are borrowed instead of + // being taken from the liquidator's wallet, and the reward is immediately collateralized. Borrow + // limit checks for the liquidator are deferred until after the reward is collateralized, allowing + // this initial borrow to exceed the liquidator's borrow limit as long as it is healthy by the end + // of the transaction. Repay amount is calculated automatically, so the liquidator only specifies + // repay and reward token denoms. For safety, the liquidator cannot exceed 80% of their borrow limit when + // executing this transaction, instead of the regular 100%. Also allows repayment and reward denoms to + // be left blank - if not specified, the module will automatically select the first (alphabetically by denom) + // borrow and/or collateral on the target account and the proceed normally. + // After v6.0, includes a MaxRepay field which limits repay value in USD. To prevent dust exploits, this + // value cannot be below $1.00 + rpc LeveragedLiquidate(MsgLeveragedLiquidate) returns (MsgLeveragedLiquidateResponse); + // SupplyCollateral combines the Supply and Collateralize actions. rpc SupplyCollateral(MsgSupplyCollateral) returns (MsgSupplyCollateralResponse); + + // GovUpdateRegistry adds new tokens to the token registry or + // updates existing tokens with new settings. + rpc GovUpdateRegistry(MsgGovUpdateRegistry) returns (MsgGovUpdateRegistryResponse); + + // GovUpdateSpecialAssets adds, updates, or removes special asset pairs. Note that a special asset + // pair can be removed by setting its special collateral weight to negative one. Also allows for the creation + // of sets of assets, where each asset in the set forms a special asset pair with all of the others. + rpc GovUpdateSpecialAssets(MsgGovUpdateSpecialAssets) returns (MsgGovUpdateSpecialAssetsResponse); + + // GovSetParams is used by governance proposals to update parameters. + rpc GovSetParams(MsgGovSetParams) returns (MsgGovSetParamsResponse); } // MsgSupply represents a user's request to supply assets to the module. @@ -55,6 +93,14 @@ message MsgWithdraw { cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false]; } +// MsgMaxWithdraw represents a user's request to withdraw the maximum valid amount of supplied assets. +message MsgMaxWithdraw { + // Supplier is the account address withdrawing assets and the signer of the message. + string supplier = 1; + // Denom is base token denom to withdraw + string denom = 2; +} + // MsgCollateralize represents a user's request to enable selected // uTokens as collateral. message MsgCollateralize { @@ -80,6 +126,15 @@ message MsgBorrow { cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false]; } +// MsgMaxBorrow represents a user's request to borrow a base asset type +// from the module, using the maximum available amount. +message MsgMaxBorrow { + // Borrower is the account address taking a loan and the signer + // of the message. + string borrower = 1; + string denom = 2; +} + // MsgRepay represents a user's request to repay a borrowed base asset // type to the module. message MsgRepay { @@ -107,6 +162,27 @@ message MsgLiquidate { string reward_denom = 4; } +// MsgLeveragedLiquidate is the request structure for the LeveragedLiquidate RPC. +message MsgLeveragedLiquidate { + // Liquidator is the account address performing a liquidation and the signer + // of the message. + string liquidator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Borrower is the account whose borrow is being repaid, and collateral consumed, + // by the liquidation. It does not sign the message. + string borrower = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // RepayDenom is the base token that the liquidator will borrow in order to repay on behalf of + // the borrower. + string repay_denom = 3; + // RewardDenom is the uToken denom that the liquidator will receive as a liquidation reward + // and immediately collateralize. + string reward_denom = 4; + // MaxRepay optionally limits the USD value to repay. If specified, this cannot be below $1.00 + string max_repay = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + // MsgSupplyCollateral represents a user's request to supply and collateralize assets to the module. message MsgSupplyCollateral { // Supplier is the account address supplying assets and the signer of the message. @@ -126,6 +202,14 @@ message MsgWithdrawResponse { cosmos.base.v1beta1.Coin received = 1 [(gogoproto.nullable) = false]; } +// MsgMaxWithdrawResponse defines the Msg/MaxWithdraw response type. +message MsgMaxWithdrawResponse { + // Withdrawn is the amount of uTokens withdrawn. + cosmos.base.v1beta1.Coin withdrawn = 1 [(gogoproto.nullable) = false]; + // Received is the amount of base tokens received. + cosmos.base.v1beta1.Coin received = 2 [(gogoproto.nullable) = false]; +} + // MsgCollateralizeResponse defines the Msg/Collateralize response type. message MsgCollateralizeResponse {} @@ -135,6 +219,12 @@ message MsgDecollateralizeResponse {} // MsgBorrowResponse defines the Msg/Borrow response type. message MsgBorrowResponse {} +// MsgMaxBorrowResponse defines the Msg/MaxBorrow response type. +message MsgMaxBorrowResponse { + // Borrowed is the amount of tokens borrowed. + cosmos.base.v1beta1.Coin borrowed = 1 [(gogoproto.nullable) = false]; +} + // MsgRepayResponse defines the Msg/Repay response type. message MsgRepayResponse { // Repaid is the amount of base tokens repaid to the module. @@ -154,8 +244,89 @@ message MsgLiquidateResponse { cosmos.base.v1beta1.Coin reward = 3 [(gogoproto.nullable) = false]; } +// MsgLeveragedLiquidateResponse defines the Msg/LeveragedLiquidate response type. +message MsgLeveragedLiquidateResponse { + // Repaid is the amount of base tokens that the liquidator borrowed and repaid + // to the module on behalf of the borrower. + cosmos.base.v1beta1.Coin repaid = 1 [(gogoproto.nullable) = false]; + // Reward is the amount of collateral that the liquidator gained + // as reward for the liquidation. + cosmos.base.v1beta1.Coin reward = 2 [(gogoproto.nullable) = false]; +} + // MsgSupplyCollateralResponse defines the Msg/SupplyCollateral response type. message MsgSupplyCollateralResponse { // Collateralized is the amount of uTokens collateralized. cosmos.base.v1beta1.Coin collateralized = 1 [(gogoproto.nullable) = false]; } + +// MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type. +message MsgGovUpdateRegistry { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // field 2 (title) is removed. Proposal metadata should be used instead. + reserved 2; + + // authority is the address of the governance account or the Emergency Group. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // description motivating the change. Should be used only when executing by the + // Emergency Group. Otherwise the x/gov Proposal metadata should be used. + string description = 3; + // add_tokens defines new token settings. + repeated Token add_tokens = 4 [(gogoproto.nullable) = false]; + // update_tokens defines the new settings for existed tokens. + repeated Token update_tokens = 5 [(gogoproto.nullable) = false]; +} + +// MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type. +message MsgGovUpdateRegistryResponse {} + +// MsgGovUpdateSpecialAssets defines the Msg/GovUpdateSpecialAssets request type. +message MsgGovUpdateSpecialAssets { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account or the Emergency Group. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // description motivating the change. Should be used only when executing by the + // Emergency Group. Otherwise the x/gov Proposal metadata should be used. + string description = 2; + + // sets are bidirectional groups of special asset pairs. Creating a special asset + // set causes all assets in the set to have a certain collateral weight when borrowing + // against each other (but not looping with themselves). Overrides any existing + // special asset pairs between assets in the set. Using both collateral weight + // and liquidation theshold of zero will clear all existing special pairs in the set instead. + repeated SpecialAssetSet sets = 3 [(gogoproto.nullable) = false]; + + // pairs are new or updated special asset pairs. Updating both a special asset pair's + // collateral weight and liquidation threshold to zero deletes the pair instead. + // These pairs will be applied after any sets above when passing a proposal, + // so they can be used to override certain set elements, set directional relationships, + // or set an asset's relation to itself (looping). + repeated SpecialAssetPair pairs = 4 [(gogoproto.nullable) = false]; +} + +// MsgGovUpdateSpecialAssetsResponse defines the Msg/GovUpdateSpecialAssets response type. +message MsgGovUpdateSpecialAssetsResponse {} + +// MsgGovSetParams is used by governance to update module parameters. +message MsgGovSetParams { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgGovSetParamsResponse defines the Msg/SetParams response type. +message MsgGovSetParamsResponse {} diff --git a/proto/umee/metoken/v1/events.proto b/proto/umee/metoken/v1/events.proto new file mode 100644 index 0000000..d965848 --- /dev/null +++ b/proto/umee/metoken/v1/events.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; +package umee.metoken.v1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/metoken"; + +option (gogoproto.goproto_getters_all) = false; + +// EventSwap is emitted on Msg/Swap +message EventSwap { + // meToken recipient bech32 address. + string recipient = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Asset provided for the swap. + cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false]; + // meToken received by the recipient in exchange for the provided asset. + cosmos.base.v1beta1.Coin metoken = 3 [(gogoproto.nullable) = false]; + // Fee provided for the swap. + cosmos.base.v1beta1.Coin fee = 4 [(gogoproto.nullable) = false]; +} + +// EventRedeem is emitted on Msg/Redeem +message EventRedeem { + // Asset recipient bech32 address. + string recipient = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // meToken provided for the redemption. + cosmos.base.v1beta1.Coin metoken = 2 [(gogoproto.nullable) = false]; + // Asset received by the recipient in exchange for the provided meToken. + cosmos.base.v1beta1.Coin asset = 3 [(gogoproto.nullable) = false]; + // Fee provided for the redemption. + cosmos.base.v1beta1.Coin fee = 4 [(gogoproto.nullable) = false]; +} + +// EventRebalancing is emitted when a reserve re-balancing occurs. +message EventRebalancing { + // RebalancingResults of every asset in every Index. + repeated RebalancingResult results = 1 [(gogoproto.nullable) = false]; +} + +// RebalancingResult of a specific Index with initial and result balances of underlying assets. +message RebalancingResult { + string metoken_denom = 1; + //Initial balance of an asset in the Index before re-balancing. + repeated cosmos.base.v1beta1.Coin initial_balance = 2 [(gogoproto.nullable) = false]; + // Result balance of an asset in the Index after re-balancing. + repeated cosmos.base.v1beta1.Coin result_balance = 3 [(gogoproto.nullable) = false]; +} + +// EventInterestClaim is emitted when the accrued interest was claimed from x/leverage +message EventInterestClaim { + // The denom and amount of successfully claimed interest + repeated cosmos.base.v1beta1.Coin claimed_asset = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/umee/metoken/v1/genesis.proto b/proto/umee/metoken/v1/genesis.proto new file mode 100644 index 0000000..0cef8db --- /dev/null +++ b/proto/umee/metoken/v1/genesis.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package umee.metoken.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "umee/metoken/v1/metoken.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/metoken"; + +// GenesisState defines the x/metoken module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + repeated Index registry = 2 [(gogoproto.nullable) = false]; + repeated IndexBalances balances = 3 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp next_rebalancing_time = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + + google.protobuf.Timestamp next_interest_claim_time = 5 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; +} + +// IndexBalances is the state of an Index, containing its meToken supply and all underlying asset balances. +message IndexBalances { + cosmos.base.v1beta1.Coin metoken_supply = 1 [(gogoproto.nullable) = false]; + repeated AssetBalance asset_balances = 2 [(gogoproto.nullable) = false]; +} + +// AssetBalance tracks how much of a single asset is held in leverage, reserves, fees and interest account. +message AssetBalance { + string denom = 1; + string leveraged = 2 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + string reserved = 3 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + string fees = 4 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + string interest = 5 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/umee/metoken/v1/metoken.proto b/proto/umee/metoken/v1/metoken.proto new file mode 100644 index 0000000..0038bea --- /dev/null +++ b/proto/umee/metoken/v1/metoken.proto @@ -0,0 +1,156 @@ +syntax = "proto3"; +package umee.metoken.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/metoken"; + +// Params defines the parameters for the metoken module. +message Params { + option (gogoproto.equal) = true; + + // Reserves Re-balancing Frequency in seconds, determines how often the re-balancing of the module reserves will be + // triggered + int64 rebalancing_frequency = 1; + + // Interest claiming frequency in seconds, determines how often metoken module will claim accrued interest from + // leverage module + int64 claiming_frequency = 2; +} + +// Index defines an index of assets that are allowed to swap and redeem for the Index's meToken, +// along with its metadata and parameters. +message Index { + option (gogoproto.equal) = true; + + // Denom is the denomination of the Index's meToken denom that will be given to user in exchange of accepted + // assets. + string denom = 1; + + // MaxSupply is the maximum amount of Index's meTokens can be minted. + // A swap that requires to mint more Index's meToken than this value will result in an error. + // Must be a non negative value. 0 means that there is no limit. + string max_supply = 2 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; + + // Exponent is the power of ten by which to multiply, in order to convert + // an amount of the meToken for the exchange operations. + // Valid value: must be the same as the oracle.Denom.exponent. + uint32 exponent = 3; + + // Fee contains fee parameters used for swap and redemption fee calculations for all underlying + // assets in this index. + Fee fee = 4 [(gogoproto.nullable) = false]; + + // Accepted Assets is the list of underlying Tokens that can be swapped and redeemed for the Index's meToken, + // along with their token-specific parameters. + repeated AcceptedAsset accepted_assets = 5 [(gogoproto.nullable) = false]; +} + +// Fee are the parameters used for the calculation of the fee to be applied for swaps and redemptions and charged to +// the user. The usage of these parameters is explained here: +// https://github.com/umee-network/umee/tree/main/x/metoken#dynamic-fee +message Fee { + option (gogoproto.equal) = true; + + // Min fee is the minimum fee to be charged to the user. The applied fee will tend to decrease down to this value, + // when the accepted asset is undersupplied in the index. It must be less than Balanced and Max fees. + // Valid values: 0-1. + string min_fee = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Balanced fee is the fee to be charged to the user when the index is balanced. It must be greater than min_fee and + // lower than max_fee + // Valid values: 0-1. + string balanced_fee = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Max fee is the maximum fee to be charged to the user. The applied fee will tend to increase up to this value, + // when the accepted asset is oversupplied in the index. It must be greater than Min and Balanced fee. + // Valid values: 0-1. + string max_fee = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// AcceptedAsset is an asset that is accepted to participate in the Index's swaps and redemptions, along with its +// metadata and parameters +message AcceptedAsset { + option (gogoproto.equal) = true; + + // Denom is the denomination of the underlying asset. Must be the base + // denom as registered in the Bank module (so IBC denom for IBC tokens). + string denom = 1; + + // Reserve portion is the portion of swapped assets that will be kept in the metoken module as reserves, + // instead of supplied to the leverage module. It is also the + // portion that will be taken from metoken module reserves when a redemption occurs. + // Valid values: 0-1. + string reserve_portion = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Target allocation is the portion of an accepted asset the Index is targeting to have. The sum of + // target allocations of every accepted asset in the Index should be equal to 1. + // Valid values: 0-1. + string target_allocation = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// IndexPrices provides meToken price related index information. +message IndexPrices { + option (gogoproto.equal) = true; + + // meToken denom. + string denom = 1; + + // Price in USD of one unit of meToken, expressed in decimals. + string price = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Exponent is the power of ten by which to multiply, in order to convert + // an amount of the meToken for the exchange operations. + uint32 exponent = 3; + + repeated AssetPrice assets = 4 [(gogoproto.nullable) = false]; +} + +// AssetPrice information related to the index operations. +message AssetPrice { + option (gogoproto.equal) = true; + + string base_denom = 1; + + string symbol_denom = 2; + + // Price in USD of one unit of asset, expressed in decimals. + string price = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Exponent is the power of ten by which to multiply, in order to convert + // an amount of the asset for the exchange operations. + uint32 exponent = 4; + + // SwapRate used for exchange calculations asset -> meToken. + string swap_rate = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // RedeemRate used for exchange calculations meToken -> asset. + string redeem_rate = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/umee/metoken/v1/query.proto b/proto/umee/metoken/v1/query.proto new file mode 100644 index 0000000..7cdfeac --- /dev/null +++ b/proto/umee/metoken/v1/query.proto @@ -0,0 +1,117 @@ +syntax = "proto3"; +package umee.metoken.v1; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "umee/metoken/v1/metoken.proto"; +import "umee/metoken/v1/genesis.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/metoken"; + +option (gogoproto.goproto_getters_all) = false; + +// Query defines the gRPC querier service. +service Query { + // Params queries the parameters of the x/metoken module. + rpc Params(QueryParams) returns (QueryParamsResponse) { + option (google.api.http).get = "/umee/metoken/v1/params"; + } + + // Indexes queries for a specific or all the registered indexes. + rpc Indexes(QueryIndexes) + returns (QueryIndexesResponse) { + option (google.api.http).get = "/umee/metoken/v1/indexes"; + } + + // SwapFee computes fee that would be applied when executing MsgSwap. + rpc SwapFee(QuerySwapFee) + returns (QuerySwapFeeResponse) { + option (google.api.http).get = "/umee/metoken/v1/swap_fee"; + } + + // RedeemFee computes a fee that would be applied when executing MsgRedeem. + rpc RedeemFee(QueryRedeemFee) + returns (QueryRedeemFeeResponse) { + option (google.api.http).get = "/umee/metoken/v1/redeem_fee"; + } + + // IndexBalances queries for Index's balances of a specific or all the registered indexes. + rpc IndexBalances(QueryIndexBalances) + returns (QueryIndexBalancesResponse) { + option (google.api.http).get = "/umee/metoken/v1/index_balances"; + } + + // IndexPrices queries for Index's price of a specific or all the registered indexes. It also includes the + // underlying assets prices as well as swap and redeem rates. + rpc IndexPrices(QueryIndexPrices) + returns (QueryIndexPricesResponse) { + option (google.api.http).get = "/umee/metoken/v1/index_prices"; + } +} + +// QueryParams defines the request structure for the Params gRPC service +// handler. +message QueryParams {} + +// QueryParamsResponse defines the response structure for the Params gRPC +// service handler. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QueryIndexes defines the request structure for the Indexes gRPC service handler. +// metoken_denom param is optional, if it is not informed the query will return all the Indexes. +message QueryIndexes { + string metoken_denom = 1; +} + +// QueryIndexesResponse defines the response structure for the Indexes gRPC service handler. +message QueryIndexesResponse { + repeated Index registry = 1 [(gogoproto.nullable) = false]; +} + +// QuerySwapFee defines the request structure for the SwapFee gRPC service handler. +message QuerySwapFee { + string asset = 1; + string metoken_denom = 2; +} + +// QuerySwapFeeResponse defines the response structure for the SwapFee gRPC service handler. +message QuerySwapFeeResponse { + cosmos.base.v1beta1.Coin asset = 1 [(gogoproto.nullable) = false]; +} + +// QueryRedeemFee defines the request structure for the RedeemFee gRPC service handler. +message QueryRedeemFee { + string metoken = 1; + string asset_denom = 2; +} + +// QueryRedeemFeeResponse defines the response structure for the RedeemFee gRPC service handler. +message QueryRedeemFeeResponse { + cosmos.base.v1beta1.Coin asset = 1 [(gogoproto.nullable) = false]; +} + +// QueryIndexBalances defines the request structure for the IndexBalances gRPC service handler. +// metoken_denom param is optional, if it is not informed the query will return all the Indexes. +message QueryIndexBalances { + string metoken_denom = 1; +} + +// QueryIndexBalanceResponse defines the response structure for the IndexBalances gRPC service handler. +message QueryIndexBalancesResponse { + repeated IndexBalances index_balances = 1 [(gogoproto.nullable) = false]; + repeated IndexPrices prices = 2 [(gogoproto.nullable) = false]; +} + +// QueryIndexPrices defines the request structure for the IndexPrice gRPC service handler. +// metoken_denom param is optional, if it is not informed the query will return all the Index's prices. +message QueryIndexPrices { + string metoken_denom = 1; +} + +// QueryIndexPriceResponses defines the response structure for the IndexPrice gRPC service handler. +message QueryIndexPricesResponse { + repeated IndexPrices prices = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/umee/metoken/v1/tx.proto b/proto/umee/metoken/v1/tx.proto new file mode 100644 index 0000000..dab10fc --- /dev/null +++ b/proto/umee/metoken/v1/tx.proto @@ -0,0 +1,88 @@ +syntax = "proto3"; +package umee.metoken.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "umee/metoken/v1/metoken.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/metoken"; +option (gogoproto.goproto_getters_all) = false; + +// Msg defines the x/metoken module's Msg service. +service Msg { + // Swap defines a method for swapping an accepted asset for Index's meToken. + rpc Swap(MsgSwap) returns (MsgSwapResponse); + + // Redeem defines a method for redeeming Index's meToken for an accepted asset. + rpc Redeem(MsgRedeem) returns (MsgRedeemResponse); + + // GovSetParams is used by governance proposals to update parameters. + rpc GovSetParams(MsgGovSetParams) returns (MsgGovSetParamsResponse); + + // GovUpdateRegistry adds new index to the index registry or + // updates existing index with new settings. + rpc GovUpdateRegistry(MsgGovUpdateRegistry) returns (MsgGovUpdateRegistryResponse); +} + +// MsgSwap represents a user's request to swap assets for Index's meToken. +message MsgSwap { + // User is the account address swapping assets and the signer of the message. + string user = 1; + cosmos.base.v1beta1.Coin asset = 2 [(gogoproto.nullable) = false]; + string metoken_denom = 3; +} + +// MsgSwapResponse defines the Msg/Swap response type. +message MsgSwapResponse { + // Fee is the amount of accepted asset charged to the user as the fee for the transaction. + cosmos.base.v1beta1.Coin fee = 1 [(gogoproto.nullable) = false]; + // Returned is the amount of Index's meToken minted and returned to the user. + cosmos.base.v1beta1.Coin returned = 2 [(gogoproto.nullable) = false]; +} + +// MsgRedeem represents a user's request to redeem Index's meTokens for one of the accepted assets. +message MsgRedeem { + // User is the account address redeeming assets and the signer of the message. + string user = 1; + cosmos.base.v1beta1.Coin metoken = 2 [(gogoproto.nullable) = false]; + string asset_denom = 3; +} + +// MsgRedeemResponse defines the Msg/Redeem response type. +message MsgRedeemResponse { + // Returned is the amount of accepted asset returned to the user. + cosmos.base.v1beta1.Coin returned = 1 [(gogoproto.nullable) = false]; + // Fee is the amount of accepted asset charged to the user as the fee for the transaction. + cosmos.base.v1beta1.Coin fee = 2 [(gogoproto.nullable) = false]; +} + +// MsgGovSetParams defines the Msg/GovSetParams request type. +message MsgGovSetParams { + option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgGovSetParamsResponse defines the Msg/GovSetParams response type. +message MsgGovSetParamsResponse {} + +// MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type. +message MsgGovUpdateRegistry { + option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // add_index defines new index settings. + repeated Index add_index = 2 [(gogoproto.nullable) = false]; + // update_index defines the new settings for existing index. + repeated Index update_index = 3 [(gogoproto.nullable) = false]; +} + +// MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type. +message MsgGovUpdateRegistryResponse {} diff --git a/proto/umee/oracle/v1/events.proto b/proto/umee/oracle/v1/events.proto index 6d66709..cdc9ba3 100644 --- a/proto/umee/oracle/v1/events.proto +++ b/proto/umee/oracle/v1/events.proto @@ -4,7 +4,7 @@ package umee.oracle.v1; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/umee-network/umee/v3/x/oracle/types"; +option go_package = "github.com/umee-network/umee/v6/x/oracle/types"; option (gogoproto.goproto_getters_all) = false; diff --git a/proto/umee/oracle/v1/genesis.proto b/proto/umee/oracle/v1/genesis.proto index fa0a6bf..a58861b 100644 --- a/proto/umee/oracle/v1/genesis.proto +++ b/proto/umee/oracle/v1/genesis.proto @@ -2,29 +2,28 @@ syntax = "proto3"; package umee.oracle.v1; import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; import "umee/oracle/v1/oracle.proto"; -option go_package = "github.com/umee-network/umee/v3/x/oracle/types"; +option go_package = "github.com/umee-network/umee/v6/x/oracle/types"; option (gogoproto.goproto_getters_all) = false; // GenesisState defines the oracle module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated FeederDelegation feeder_delegations = 2 - [(gogoproto.nullable) = false]; - repeated ExchangeRateTuple exchange_rates = 3 [ - (gogoproto.castrepeated) = "ExchangeRateTuples", - (gogoproto.nullable) = false - ]; + Params params = 1 [(gogoproto.nullable) = false]; + repeated FeederDelegation feeder_delegations = 2 [(gogoproto.nullable) = false]; + repeated DenomExchangeRate exchange_rates = 3 [(gogoproto.nullable) = false]; repeated MissCounter miss_counters = 4 [(gogoproto.nullable) = false]; - repeated AggregateExchangeRatePrevote aggregate_exchange_rate_prevotes = 5 - [(gogoproto.nullable) = false]; - repeated AggregateExchangeRateVote aggregate_exchange_rate_votes = 6 - [(gogoproto.nullable) = false]; - repeated cosmos.base.v1beta1.DecCoin medians = 7 [(gogoproto.nullable) = false]; - repeated HistoricPrice historic_prices = 8 [(gogoproto.nullable) = false]; + repeated AggregateExchangeRatePrevote aggregate_exchange_rate_prevotes = 5 [(gogoproto.nullable) = false]; + repeated AggregateExchangeRateVote aggregate_exchange_rate_votes = 6 [(gogoproto.nullable) = false]; + repeated Price medians = 7 [(gogoproto.nullable) = false]; + repeated Price historic_prices = 8 [(gogoproto.nullable) = false]; + repeated Price medianDeviations = 9 [(gogoproto.nullable) = false]; + // Historic Avg Counter params + AvgCounterParams avg_counter_params = 10 [ + (gogoproto.moretags) = "yaml:\"avg_counter_params\"", + (gogoproto.nullable) = false + ]; } // FeederDelegation is the address for where oracle feeder authority are @@ -41,3 +40,11 @@ message MissCounter { string validator_address = 1; uint64 miss_counter = 2; } + +// Price is an instance of a price "stamp" +message Price { + ExchangeRateTuple exchange_rate_tuple = 1 [ + (gogoproto.nullable) = false + ]; + uint64 block_num = 2; +} diff --git a/proto/umee/oracle/v1/oracle.proto b/proto/umee/oracle/v1/oracle.proto index baa0d6d..565fa3c 100644 --- a/proto/umee/oracle/v1/oracle.proto +++ b/proto/umee/oracle/v1/oracle.proto @@ -2,8 +2,10 @@ syntax = "proto3"; package umee.oracle.v1; import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; -option go_package = "github.com/umee-network/umee/v3/x/oracle/types"; +option go_package = "github.com/umee-network/umee/v6/x/oracle/types"; option (gogoproto.goproto_getters_all) = false; @@ -41,22 +43,42 @@ message Params { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // Stamp Period represents the amount of blocks the historacle module - // waits before recording a set of prices from the oracle. - uint64 stamp_period = 9; - // Prune Period represents the maximum amount of blocks which we want - // to keep a record of our set of exchange rates. - uint64 prune_period = 10; - // Median Period represents the amount blocks we will wait between - // calculating the median and standard deviation of the median of - // historic prices in the last Prune Period. - uint64 median_period = 11; + // Historic Stamp Period represents the amount of blocks the oracle + // module waits before recording a new historic price. + uint64 historic_stamp_period = 9; + // Median Stamp Period represents the amount blocks the oracle module + // waits between calculating and stamping a new median and standard + // deviation of that median. + uint64 median_stamp_period = 10; + // Maximum Price Stamps represents the maximum amount of historic prices + // the oracle module will store before pruning via FIFO. + uint64 maximum_price_stamps = 11; + // Maximum Median Stamps represents the maximum amount of medians the + // oracle module will store before pruning via FIFO. + uint64 maximum_median_stamps = 12; +} + +// AvgCounterParams - Historic avg counter params +message AvgCounterParams { + // avg_period + google.protobuf.Duration avg_period = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "avg_period,omitempty", + (gogoproto.moretags) = "yaml:\"avg_period\"" + ]; + // avg shift + google.protobuf.Duration avg_shift = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "avg_shift,omitempty", + (gogoproto.moretags) = "yaml:\"avg_shift\"" + ]; } // Denom - the object to hold configurations of each denom message Denom { option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; string base_denom = 1 [(gogoproto.moretags) = "yaml:\"base_denom\""]; @@ -71,7 +93,6 @@ message Denom { // rate}{denom},...,{exchange rate}{denom}:{voter}") message AggregateExchangeRatePrevote { option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""]; @@ -83,7 +104,6 @@ message AggregateExchangeRatePrevote { // the exchange rates of USD denominated in various assets. message AggregateExchangeRateVote { option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; repeated ExchangeRateTuple exchange_rate_tuples = 1 [ @@ -98,7 +118,6 @@ message AggregateExchangeRateVote { // ExchangeRateTuple - struct to store interpreted exchange rates data to store message ExchangeRateTuple { option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; string denom = 1 [(gogoproto.moretags) = "yaml:\"denom\""]; @@ -109,11 +128,31 @@ message ExchangeRateTuple { ]; } -// HistoricPrice is an instance of a price "stamp" -message HistoricPrice { - ExchangeRateTuple exchange_rate = 1 [ +// AvgCounter is holds information about the active avg aggreator windows, used +// to quickly compute average price of an asset. +message AvgCounter { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // sum of prices in the counter + string sum = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // number of aggregated prices in the counter + uint32 num = 2; + // Unix timestamp when the first price was aggregated in the counter + google.protobuf.Timestamp start = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// DenomExchangeRate stores exchange rate with timestamp +message DenomExchangeRate { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + string denom = 1 [(gogoproto.moretags) = "yaml:\"denom\""]; + string rate = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - uint64 block_num = 2; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/umee/oracle/v1/query.proto b/proto/umee/oracle/v1/query.proto index e778ca7..8dd2969 100644 --- a/proto/umee/oracle/v1/query.proto +++ b/proto/umee/oracle/v1/query.proto @@ -4,9 +4,10 @@ package umee.oracle.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "umee/oracle/v1/oracle.proto"; +import "umee/oracle/v1/genesis.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/umee-network/umee/v3/x/oracle/types"; +option go_package = "github.com/umee-network/umee/v6/x/oracle/types"; option (gogoproto.goproto_getters_all) = false; @@ -64,7 +65,7 @@ service Query { rpc AggregateVote(QueryAggregateVote) returns (QueryAggregateVoteResponse) { option (google.api.http).get = - "/umee/oracle/v1/valdiators/{validator_addr}/aggregate_vote"; + "/umee/oracle/v1/validators/{validator_addr}/aggregate_vote"; } // AggregateVotes returns aggregate votes of all validators @@ -78,12 +79,85 @@ service Query { option (google.api.http).get = "/umee/oracle/v1/params"; } - // Medians returns medians of all denoms + // Medians returns medians of all denoms, + // or, if specified, returns a single median rpc Medians(QueryMedians) returns (QueryMediansResponse) { option (google.api.http).get = "/umee/historacle/v1/denoms/medians"; } + + // MedianDeviations returns median deviations of all denoms, + // or, if specified, returns a single median deviation + rpc MedianDeviations(QueryMedianDeviations) + returns (QueryMedianDeviationsResponse) { + option (google.api.http).get = + "/umee/historacle/v1/denoms/median_deviations"; + } + + // QueryAvgPrice returns avg price of a given denom (required). + rpc AvgPrice(QueryAvgPrice) + returns (QueryAvgPriceResponse) { + option (google.api.http).get = + "/umee/historacle/v1/avg_price/{denom}"; + } + + // ExgRatesWithTimestamp returns exchange rates of all denoms with timestamp, + // or, if specified, returns a single denom + rpc ExgRatesWithTimestamp(QueryExgRatesWithTimestamp) + returns (QueryExgRatesWithTimestampResponse) { + option (google.api.http).get = + "/umee/oracle/v1/denoms/exg_rates_timestamp"; + } + + // MissCounters returns oracle missing votes count of validators. + rpc MissCounters(QueryMissCounters) + returns (QueryMissCountersResponse) { + option (google.api.http).get = + "/umee/oracle/v1/miss_counters"; + } +} + +// QueryMissCounters is the request type for the Query/MissCounters RPC +// method. +message QueryMissCounters { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + string validator = 1; +} + +// QueryMissCountersResponse is response type for the Query/MissCounters RPC method. +message QueryMissCountersResponse { + repeated PriceMissCounter miss_counters = 1 [ + (gogoproto.nullable) = false + ]; +} + +// PriceMissCounter is the validator's oracle price votes missing count. +message PriceMissCounter { + string validator = 1; + // miss_counter defines the oracle miss counter of a validator + uint64 miss_counter = 2; +} + +// QueryExgRatesWithTimestamp is the request type for the Query/ExchangeRatesWithTimestamp RPC +// method. +message QueryExgRatesWithTimestamp { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // denom defines the denomination to query for. + string denom = 1; +} + +// QueryExgRatesWithTimestampResponse is response type for the +// Query/ExchangeRatesWithTimestamp RPC method. +message QueryExgRatesWithTimestampResponse { + // exchange_rates defines a list of the exchange rate for all whitelisted + // denoms with timestamp + repeated DenomExchangeRate exg_rates = 1 [ + (gogoproto.nullable) = false + ]; } // QueryExchangeRates is the request type for the Query/ExchangeRate RPC @@ -114,7 +188,7 @@ message QueryActiveExchangeRates {} // QueryActiveExchangeRatesResponse is response type for the // Query/ActiveExchangeRates RPC method. message QueryActiveExchangeRatesResponse { - // activeRates defines a list of the denomination which oracle prices aggreed + // activeRates defines a list of the denomination which oracle prices agreed // upon. repeated string active_rates = 1; } @@ -243,14 +317,48 @@ message QueryMedians { option (gogoproto.goproto_getters) = false; // denom defines the denomination to query for. string denom = 1; + // numStamps defines the number of median stamps to query for. numStamps + // must be greater than 0. + uint32 numStamps = 2; } // QueryMediansResponse is response type for the // Query/Medians RPC method. message QueryMediansResponse { // medians defines a list of the medians for all stamped denoms. - repeated cosmos.base.v1beta1.DecCoin medians = 1 [ - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", - (gogoproto.nullable) = false + repeated Price medians = 1 [(gogoproto.nullable) = false]; +} + +// QueryMedianDeviations is the request type for the Query/MedianDeviations RPC Response. +message QueryMedianDeviations { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // denom defines the denomination to query for. + string denom = 1; +} + +// QueryMedianDeviationsResponse is response type for the +// Query/MedianDeviations RPC method. +message QueryMedianDeviationsResponse { + // medians defines a list of the median deviations for all stamped denoms. + repeated Price medianDeviations = 1 [(gogoproto.nullable) = false]; +} + +// QueryAvgPrice is a request type for AvgPrice method +message QueryAvgPrice { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string denom = 1; +} + +// QueryAvgPriceResponse is a response type for AvgPrice method +message QueryAvgPriceResponse { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string price = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false ]; } diff --git a/proto/umee/oracle/v1/tx.proto b/proto/umee/oracle/v1/tx.proto index ab9c49f..f8bd6ce 100644 --- a/proto/umee/oracle/v1/tx.proto +++ b/proto/umee/oracle/v1/tx.proto @@ -3,7 +3,7 @@ package umee.oracle.v1; import "gogoproto/gogo.proto"; -option go_package = "github.com/umee-network/umee/v3/x/oracle/types"; +option go_package = "github.com/umee-network/umee/v6/x/oracle/types"; option (gogoproto.goproto_getters_all) = false; diff --git a/proto/umee/ugov/v1/events.proto b/proto/umee/ugov/v1/events.proto new file mode 100644 index 0000000..109fdad --- /dev/null +++ b/proto/umee/ugov/v1/events.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package umee.ugov.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "umee/ugov/v1/ugov.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/ugov"; +option (gogoproto.goproto_getters_all) = false; + +// EventMinGasPrice is emitted when MsgGovUpdateMinGasPrice is correctly executed. +message EventMinGasPrice { + repeated cosmos.base.v1beta1.DecCoin min_gas_prices = 1 [(gogoproto.nullable) = false]; +} + +// EventEmergencyGroup is emitted when MsgGovSetEmergencyGroup is correctly executed. +message EventEmergencyGroup { + string emergency_group = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// EventInflationParams is emitted when GovUpdateInflationParams is correctly executed. +message EventInflationParams { + InflationParams params = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto new file mode 100644 index 0000000..bb43f11 --- /dev/null +++ b/proto/umee/ugov/v1/genesis.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package umee.ugov.v1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos_proto/cosmos.proto"; +import "umee/ugov/v1/ugov.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/ugov"; +option (gogoproto.goproto_getters_all) = false; + +// GenesisState of the ugov module. +message GenesisState { + cosmos.base.v1beta1.DecCoin min_gas_price = 1 [(gogoproto.nullable) = false]; + + // Emergency Group address + string emergency_group = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // InflationParams is params for inflation rate changes + InflationParams inflation_params = 3 [(gogoproto.nullable) = false]; + + // Time when the current inflation cycle will end + google.protobuf.Timestamp inflation_cycle_end = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto new file mode 100644 index 0000000..6470524 --- /dev/null +++ b/proto/umee/ugov/v1/query.proto @@ -0,0 +1,69 @@ +syntax = "proto3"; +package umee.ugov.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +import "umee/ugov/v1/ugov.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/ugov"; + +option (gogoproto.goproto_getters_all) = false; + +// Query defines the gRPC querier service. +service Query { + // MinGasPrice returns minimum transaction fees. + rpc MinGasPrice(QueryMinGasPrice) returns (QueryMinGasPriceResponse) { + option (google.api.http).get = "/umee/ugov/v1/min_gas_price"; + } + + // EmergencyGroup returns emergency group address + rpc EmergencyGroup(QueryEmergencyGroup) returns (QueryEmergencyGroupResponse) { + option (google.api.http).get = "/umee/ugov/v1/emergency_group"; + } + + // InflationParams returns params of inflation reduction rates + rpc InflationParams(QueryInflationParams) returns (QueryInflationParamsResponse) { + option (google.api.http).get = "/umee/ugov/v1/inflation_params"; + } + + // InflationCycleEnd returns inflation cycle end time + rpc InflationCycleEnd(QueryInflationCycleEnd) returns (QueryInflationCycleEndResponse) { + option (google.api.http).get = "/umee/ugov/v1/inflation_cycle_end"; + } +} + +// QueryMinGasPrice is a request type. +message QueryMinGasPrice {} + +// QueryMinGasPriceResponse response type. +message QueryMinGasPriceResponse { + cosmos.base.v1beta1.DecCoin min_gas_price = 1 [(gogoproto.nullable) = false]; +} + +// QueryEmergencyGroup request type. +message QueryEmergencyGroup {} + +// QueryEmergencyGroupResponse response type. +message QueryEmergencyGroupResponse { + string emergency_group = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryInflationParams request type. +message QueryInflationParams {} + +// QueryInflationParamsResponse response type. +message QueryInflationParamsResponse { + InflationParams params = 1 [(gogoproto.nullable) = false]; +} + +// QueryInflationCycleEnd request type. +message QueryInflationCycleEnd {} + +// QueryInflationCycleEndResponse response type. +message QueryInflationCycleEndResponse { + google.protobuf.Timestamp end = 1 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; +} diff --git a/proto/umee/ugov/v1/tx.proto b/proto/umee/ugov/v1/tx.proto new file mode 100644 index 0000000..519d1e4 --- /dev/null +++ b/proto/umee/ugov/v1/tx.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package umee.ugov.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "umee/ugov/v1/ugov.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/ugov"; + +option (gogoproto.goproto_getters_all) = false; + +// Msg defines the x/ugov module's Msg service. +service Msg { + // GovUpdateMinGasPrice sets protocol controlled tx min fees. + rpc GovUpdateMinGasPrice(MsgGovUpdateMinGasPrice) returns (MsgGovUpdateMinGasPriceResponse); + + // GovSetEmergencyGroup sets emergency group address. + rpc GovSetEmergencyGroup(MsgGovSetEmergencyGroup) returns (MsgGovSetEmergencyGroupResponse); + + // GovUpdateInflationParams sets new params for inflation rate change. + rpc GovUpdateInflationParams(MsgGovUpdateInflationParams) returns (GovUpdateInflationParamsResponse); +} + +// MsgGovUpdateMinGasPrice request type. +message MsgGovUpdateMinGasPrice { + option (gogoproto.goproto_stringer) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.DecCoin min_gas_price = 2 [(gogoproto.nullable) = false]; +} + +// MsgGovUpdateMinGasPriceResponse response type. +message MsgGovUpdateMinGasPriceResponse {}; + +// MsgGovSetEmergencyGroup request type. +message MsgGovSetEmergencyGroup { + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string emergency_group = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgGovSetEmergencyGroupResponse response type. +message MsgGovSetEmergencyGroupResponse {}; + +// MsgGovUpdateInflationParams request type. +message MsgGovUpdateInflationParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + InflationParams params = 2 [(gogoproto.nullable) = false]; +} + +// GovUpdateInflationParamsResponse response type. +message GovUpdateInflationParamsResponse {} \ No newline at end of file diff --git a/proto/umee/ugov/v1/ugov.proto b/proto/umee/ugov/v1/ugov.proto new file mode 100644 index 0000000..fd9cd46 --- /dev/null +++ b/proto/umee/ugov/v1/ugov.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package umee.ugov.v1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/ugov"; +option (gogoproto.goproto_getters_all) = false; + +// InflationParams params for changing the inflation min rate and max rate of mint module params. +message InflationParams { + // max_supply is the maximum supply. Inflation will not increase the UMEE supply above this value. + cosmos.base.v1beta1.Coin max_supply = 1 [(gogoproto.nullable) = false]; + // inflation_cycle duration after which inflation rates are changed. + google.protobuf.Duration inflation_cycle = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "inflation_cycle,omitempty", + (gogoproto.moretags) = "yaml:\"inflation_cycle\"" + ]; + // inflation_reduction_rate for every inflation cycle in basis points. + uint32 inflation_reduction_rate = 3 [ + (gogoproto.customtype) = "github.com/umee-network/umee/v6/util/bpmath.FixedBP", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/umee/uibc/v1/events.proto b/proto/umee/uibc/v1/events.proto new file mode 100644 index 0000000..d574c17 --- /dev/null +++ b/proto/umee/uibc/v1/events.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +package umee.uibc.v1; + +import "gogoproto/gogo.proto"; +import "umee/uibc/v1/quota.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/uibc"; +option (gogoproto.goproto_getters_all) = false; + +// EventBadRevert is emitted on failure of ibc-transfer quota. +message EventBadRevert { + // failure event type + string failure_type = 1; + // ibc packet data + string packet = 2; +} + +// EventIBCTransferStatus is emitted on quota tracking pause status change. +message EventIBCTransferStatus { + IBCTransferStatus status = 1; +} diff --git a/proto/umee/uibc/v1/genesis.proto b/proto/umee/uibc/v1/genesis.proto new file mode 100644 index 0000000..423e0ab --- /dev/null +++ b/proto/umee/uibc/v1/genesis.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package umee.uibc.v1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "google/protobuf/timestamp.proto"; +import "umee/uibc/v1/quota.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/uibc"; +option (gogoproto.goproto_getters_all) = false; + +// GenesisState defines the uibc module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.DecCoin outflows = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; + // outflow_sum defines the total outflow sum of ibc-transfer in USD. + string outflow_sum = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // quota_expires defines quota expire time (as unix timestamp) for ibc-transfer denom. + google.protobuf.Timestamp quota_expires = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.jsontag) = "quota_duration,omitempty", + (gogoproto.moretags) = "yaml:\"quota_expires\"" + ]; + // inflows tracks IBC inflow transfers (in USD) for each denom during quota period. + repeated cosmos.base.v1beta1.DecCoin inflows = 5 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; + // inflow_sum defines tracks total sum of IBC inflow transfers (in USD) during quota period. + string inflow_sum = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/umee/uibc/v1/query.proto b/proto/umee/uibc/v1/query.proto new file mode 100644 index 0000000..ab58e54 --- /dev/null +++ b/proto/umee/uibc/v1/query.proto @@ -0,0 +1,109 @@ +syntax = "proto3"; +package umee.uibc.v1; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "umee/uibc/v1/quota.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/uibc"; + +option (gogoproto.goproto_getters_all) = false; + +// Query defines the gRPC querier service. +service Query { + // Params queries the parameters of the x/uibc module. + rpc Params(QueryParams) returns (QueryParamsResponse) { + option (google.api.http).get = "/umee/uibc/v1/params"; + } + + // Outflow returns IBC denom outflows in the current quota period. + // If denom is not specified, returns sum of all registered outflows. + rpc Outflows(QueryOutflows) returns (QueryOutflowsResponse) { + option (google.api.http).get = "/umee/uibc/v1/outflows"; + } + + // AllOutflow returns outflows for each denom in the current quota period. + rpc AllOutflows(QueryAllOutflows) returns (QueryAllOutflowsResponse) { + option (google.api.http).get = "/umee/uibc/v1/all_outflows"; + } + + // Inflows returns registered IBC denoms inflows in the current quota period. + // If denom is not specified, returns sum of all registered inflows. + rpc Inflows(QueryInflows) returns (QueryInflowsResponse) { + option (google.api.http).get = "/umee/uibc/v1/inflows"; + } + + // QuotaExpires returns when current ibc quota will end. + rpc QuotaExpires(QueryQuotaExpires) returns (QueryQuotaExpiresResponse) { + option (google.api.http).get = "/umee/uibc/v1/quota_expires"; + } +} + +// QueryAllInflows defines request type for query the inflow quota of registered denoms. +message QueryQuotaExpires {} + +// QueryAllInflowsResponse defines response type of Query/AllInflows +message QueryQuotaExpiresResponse { + google.protobuf.Timestamp end_time = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.jsontag) = "end_time,omitempty", + (gogoproto.moretags) = "yaml:\"end_time\"" + ]; +} + +// QueryInflows defines request type for query the inflow quota of denoms +message QueryInflows { + string denom = 1; +} + +// QueryInflowsResponse defines response type of Query/Inflows +message QueryInflowsResponse { + string sum = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + repeated cosmos.base.v1beta1.DecCoin inflows = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.DecCoin", + (gogoproto.nullable) = false + ]; +} + +// QueryParams defines the request structure for the Params gRPC service +// handler. +message QueryParams {} + +// QueryParamsResponse defines the response structure for the Params gRPC +// service handler. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QueryOutflow defines request type for query the quota of denoms +message QueryOutflows { + string denom = 1; +} + +// QueryOutflowResponse defines response type of Query/Outflow +message QueryOutflowsResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// QueryOutflow defines request type for query the quota of denoms +message QueryAllOutflows {} + +// QueryOutflowResponse defines response type of Query/Outflow +message QueryAllOutflowsResponse { + repeated cosmos.base.v1beta1.DecCoin outflows = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/umee/uibc/v1/quota.proto b/proto/umee/uibc/v1/quota.proto new file mode 100644 index 0000000..4c476da --- /dev/null +++ b/proto/umee/uibc/v1/quota.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; +package umee.uibc.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/uibc"; + +// Params of x/uibc module +message Params { + // ibc_status defines the IBC ICS20 status (transfer quota or transfers disabled). + IBCTransferStatus ibc_status = 1; + // total_quota defines the total outflow limit of ibc-transfer in USD + string total_quota = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // token_quota defines the outflow limit per token in USD + string token_quota = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // quota_duration defines quota expires for each ibc-transfer denom in seconds + google.protobuf.Duration quota_duration = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "quota_duration,omitempty", + (gogoproto.moretags) = "yaml:\"quota_duration\"" + ]; + // inflow_outflow_quota_base defines the inflow outflow quota base of ibc-transfer in USD + string inflow_outflow_quota_base = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // inflow_outflow_quota_rate defines the rate of total inflows + string inflow_outflow_quota_rate = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // inflow_outflow_token_quota_base defines the inflow outflow quota base for token + string inflow_outflow_token_quota_base = 7 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// IBCTransferStatus status of ibc-transfer quota check for inflow and outflow +enum IBCTransferStatus { + // UNSPECIFIED defines a no-op status. + IBC_TRANSFER_STATUS_UNSPECIFIED = 0; + // DISABLED: all inflow and outflow quota checks are disabled. + IBC_TRANSFER_STATUS_QUOTA_DISABLED = 1; + // ENABLED: all inflow and outflow quota checks are enabled. + IBC_TRANSFER_STATUS_QUOTA_ENABLED = 2; + // DISABLED OUT: outflow quota check is disabled, while the inflow quota check is enabled. + IBC_TRANSFER_STATUS_QUOTA_OUT_DISABLED = 3; + // DISABLED IN: inflow quota check is disabled, while the outflow quota check is enabled. + IBC_TRANSFER_STATUS_QUOTA_IN_DISABLED = 4; + // PAUSED: all IBC transfers are paused. + IBC_TRANSFER_STATUS_TRANSFERS_PAUSED = 5; +} diff --git a/proto/umee/uibc/v1/tx.proto b/proto/umee/uibc/v1/tx.proto new file mode 100644 index 0000000..35dbcb1 --- /dev/null +++ b/proto/umee/uibc/v1/tx.proto @@ -0,0 +1,86 @@ +syntax = "proto3"; +package umee.uibc.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "umee/uibc/v1/quota.proto"; + +option go_package = "github.com/umee-network/umee/v6/x/uibc"; + +option (gogoproto.goproto_getters_all) = false; +option (gogoproto.messagename_all) = true; + +// Msg defines the x/uibc module's Msg service. +service Msg { + // GovUpdateQuota adds new quota for ibc denoms or + // updates the quota for existed ibc denoms. + rpc GovUpdateQuota(MsgGovUpdateQuota) returns (MsgGovUpdateQuotaResponse); + + // GovSetIBCStatus sets IBC ICS20 status. Must be called by x/gov. + rpc GovSetIBCStatus(MsgGovSetIBCStatus) returns (MsgGovSetIBCStatusResponse); +} + +// MsgGovUpdateQuota defines the Msg/GovUpdateQuota request type. +message MsgGovUpdateQuota { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // field 2 (title) is removed. Proposal metadata should be used instead. + reserved 2; + + // authority is the address of the governance account or the Emergency Group. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // description motivating the change. Should be used only when executing by the + // Emergency Group. Otherwise the x/gov Proposal metadata should be used. + string description = 3; + + // total quota defines the total outflow of ibc-transfer in USD + string total = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // per_denom quota for outflows per denom. All denoms have the same quota size. + string per_denom = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // quota_duration defines quota expires per denom, All denoms have the same expire time. + google.protobuf.Duration quota_duration = 6 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "quota_duration,omitempty", + (gogoproto.moretags) = "yaml:\"quota_duration\"" + ]; +} + +// MsgGovUpdateQuotaResponse defines response type for the Msg/GovUpdateQuota for with x/gov proposals. +message MsgGovUpdateQuotaResponse {}; + +// MsgGovSetIBCStatus defines the request type for setting the IBC quota status. +message MsgGovSetIBCStatus { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // field 2 (title) is removed. Proposal metadata should be used instead. + reserved 2; + + // authority is the address of the governance account or the Emergency Group. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // description motivating the change. Should be used only when executing by the + // Emergency Group. Otherwise the x/gov Proposal metadata should be used. + string description = 3; + + // ibc_status defines status for ibc transfers + IBCTransferStatus ibc_status = 4; +} + +// MsgGovSetIBCStatusResponse define the response type for Msg/MsgGovSetIBCStatus with x/gov proposals. +message MsgGovSetIBCStatusResponse {} diff --git a/src/codegen/binary.ts b/src/codegen/binary.ts new file mode 100644 index 0000000..25ec4ba --- /dev/null +++ b/src/codegen/binary.ts @@ -0,0 +1,534 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.3.2 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright (c) 2016, Daniel Wirtz All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of its author, nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- + +// Code generated by the command line utilities is owned by the owner +// of the input file used when generating it. This code is not +// standalone and requires a support library to be linked with it. This +// support library is itself covered by the above license. + +import { utf8Length, utf8Read, utf8Write } from "./utf8"; +import { + int64ToString, + readInt32, + readUInt32, + uInt64ToString, + varint32read, + varint64read, + writeVarint32, + writeVarint64, + int64FromString, + int64Length, + writeFixed32, + writeByte, + zzDecode, + zzEncode, +} from "./varint"; + +export enum WireType { + Varint = 0, + + Fixed64 = 1, + + Bytes = 2, + + Fixed32 = 5, +} + +// Reader +export interface IBinaryReader { + buf: Uint8Array; + pos: number; + type: number; + len: number; + tag(): [number, WireType, number]; + skip(length?: number): this; + skipType(wireType: number): this; + uint32(): number; + int32(): number; + sint32(): number; + fixed32(): number; + sfixed32(): number; + int64(): bigint; + uint64(): bigint; + sint64(): bigint; + fixed64(): bigint; + sfixed64(): bigint; + float(): number; + double(): number; + bool(): boolean; + bytes(): Uint8Array; + string(): string; +} + +export class BinaryReader implements IBinaryReader { + buf: Uint8Array; + pos: number; + type: number; + len: number; + + assertBounds(): void { + if (this.pos > this.len) throw new RangeError("premature EOF"); + } + + constructor(buf?: ArrayLike) { + this.buf = buf ? new Uint8Array(buf) : new Uint8Array(0); + this.pos = 0; + this.type = 0; + this.len = this.buf.length; + } + + tag(): [number, WireType, number] { + const tag = this.uint32(), + fieldNo = tag >>> 3, + wireType = tag & 7; + if (fieldNo <= 0 || wireType < 0 || wireType > 5) + throw new Error( + "illegal tag: field no " + fieldNo + " wire type " + wireType + ); + return [fieldNo, wireType, tag]; + } + + skip(length?: number) { + if (typeof length === "number") { + if (this.pos + length > this.len) throw indexOutOfRange(this, length); + this.pos += length; + } else { + do { + if (this.pos >= this.len) throw indexOutOfRange(this); + } while (this.buf[this.pos++] & 128); + } + return this; + } + + skipType(wireType: number) { + switch (wireType) { + case WireType.Varint: + this.skip(); + break; + case WireType.Fixed64: + this.skip(8); + break; + case WireType.Bytes: + this.skip(this.uint32()); + break; + case 3: + while ((wireType = this.uint32() & 7) !== 4) { + this.skipType(wireType); + } + break; + case WireType.Fixed32: + this.skip(4); + break; + + /* istanbul ignore next */ + default: + throw Error("invalid wire type " + wireType + " at offset " + this.pos); + } + return this; + } + + uint32(): number { + return varint32read.bind(this)(); + } + + int32(): number { + return this.uint32() | 0; + } + + sint32(): number { + const num = this.uint32(); + return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding + } + + fixed32(): number { + const val = readUInt32(this.buf, this.pos); + this.pos += 4; + return val; + } + + sfixed32(): number { + const val = readInt32(this.buf, this.pos); + this.pos += 4; + return val; + } + + int64(): bigint { + const [lo, hi] = varint64read.bind(this)(); + return BigInt(int64ToString(lo, hi)); + } + + uint64(): bigint { + const [lo, hi] = varint64read.bind(this)(); + return BigInt(uInt64ToString(lo, hi)); + } + + sint64(): bigint { + let [lo, hi] = varint64read.bind(this)(); + // zig zag + [lo, hi] = zzDecode(lo, hi); + return BigInt(int64ToString(lo, hi)); + } + + fixed64(): bigint { + const lo = this.sfixed32(); + const hi = this.sfixed32(); + return BigInt(uInt64ToString(lo, hi)); + } + sfixed64(): bigint { + const lo = this.sfixed32(); + const hi = this.sfixed32(); + return BigInt(int64ToString(lo, hi)); + } + + float(): number { + throw new Error("float not supported"); + } + + double(): number { + throw new Error("double not supported"); + } + + bool(): boolean { + const [lo, hi] = varint64read.bind(this)(); + return lo !== 0 || hi !== 0; + } + + bytes(): Uint8Array { + const len = this.uint32(), + start = this.pos; + this.pos += len; + this.assertBounds(); + return this.buf.subarray(start, start + len); + } + + string(): string { + const bytes = this.bytes(); + return utf8Read(bytes, 0, bytes.length); + } +} + +// Writer +export interface IBinaryWriter { + len: number; + head: IOp; + tail: IOp; + states: State | null; + finish(): Uint8Array; + fork(): IBinaryWriter; + reset(): IBinaryWriter; + ldelim(): IBinaryWriter; + tag(fieldNo: number, type: WireType): IBinaryWriter; + uint32(value: number): IBinaryWriter; + int32(value: number): IBinaryWriter; + sint32(value: number): IBinaryWriter; + int64(value: string | number | bigint): IBinaryWriter; + uint64: (value: string | number | bigint) => IBinaryWriter; + sint64(value: string | number | bigint): IBinaryWriter; + fixed64(value: string | number | bigint): IBinaryWriter; + sfixed64: (value: string | number | bigint) => IBinaryWriter; + bool(value: boolean): IBinaryWriter; + fixed32(value: number): IBinaryWriter; + sfixed32: (value: number) => IBinaryWriter; + float(value: number): IBinaryWriter; + double(value: number): IBinaryWriter; + bytes(value: Uint8Array): IBinaryWriter; + string(value: string): IBinaryWriter; +} + +interface IOp { + len: number; + next?: IOp; + proceed(buf: Uint8Array | number[], pos: number): void; +} + +class Op implements IOp { + fn?: ((val: T, buf: Uint8Array | number[], pos: number) => void) | null; + len: number; + val: T; + next?: IOp; + + constructor( + fn: + | (( + val: T, + buf: Uint8Array | number[], + pos: number + ) => void | undefined | null) + | null, + len: number, + val: T + ) { + this.fn = fn; + this.len = len; + this.val = val; + } + + proceed(buf: Uint8Array | number[], pos: number) { + if (this.fn) { + this.fn(this.val, buf, pos); + } + } +} + +class State { + head: IOp; + tail: IOp; + len: number; + next: State | null; + + constructor(writer: BinaryWriter) { + this.head = writer.head; + this.tail = writer.tail; + this.len = writer.len; + this.next = writer.states; + } +} + +export class BinaryWriter implements IBinaryWriter { + len = 0; + head: IOp; + tail: IOp; + states: State | null; + + constructor() { + this.head = new Op(null, 0, 0); + this.tail = this.head; + this.states = null; + } + + static create() { + return new BinaryWriter(); + } + + static alloc(size: number): Uint8Array | number[] { + if (typeof Uint8Array !== "undefined") { + return pool( + (size) => new Uint8Array(size), + Uint8Array.prototype.subarray + )(size); + } else { + return new Array(size); + } + } + + private _push( + fn: (val: T, buf: Uint8Array | number[], pos: number) => void, + len: number, + val: T + ) { + this.tail = this.tail.next = new Op(fn, len, val); + this.len += len; + return this; + } + + finish(): Uint8Array { + let head = this.head.next, + pos = 0; + const buf = BinaryWriter.alloc(this.len); + while (head) { + head.proceed(buf, pos); + pos += head.len; + head = head.next; + } + return buf as Uint8Array; + } + + fork(): BinaryWriter { + this.states = new State(this); + this.head = this.tail = new Op(null, 0, 0); + this.len = 0; + return this; + } + + reset(): BinaryWriter { + if (this.states) { + this.head = this.states.head; + this.tail = this.states.tail; + this.len = this.states.len; + this.states = this.states.next; + } else { + this.head = this.tail = new Op(null, 0, 0); + this.len = 0; + } + return this; + } + + ldelim(): BinaryWriter { + const head = this.head, + tail = this.tail, + len = this.len; + this.reset().uint32(len); + if (len) { + this.tail.next = head.next; // skip noop + this.tail = tail; + this.len += len; + } + return this; + } + + tag(fieldNo: number, type: WireType): BinaryWriter { + return this.uint32(((fieldNo << 3) | type) >>> 0); + } + + uint32(value: number): BinaryWriter { + this.len += (this.tail = this.tail.next = + new Op( + writeVarint32, + (value = value >>> 0) < 128 + ? 1 + : value < 16384 + ? 2 + : value < 2097152 + ? 3 + : value < 268435456 + ? 4 + : 5, + value + )).len; + return this; + } + + int32(value: number): BinaryWriter { + return value < 0 + ? this._push(writeVarint64, 10, int64FromString(value.toString())) // 10 bytes per spec + : this.uint32(value); + } + + sint32(value: number): BinaryWriter { + return this.uint32(((value << 1) ^ (value >> 31)) >>> 0); + } + + int64(value: string | number | bigint): BinaryWriter { + const { lo, hi } = int64FromString(value.toString()); + return this._push(writeVarint64, int64Length(lo, hi), { lo, hi }); + } + + // uint64 is the same with int64 + uint64 = BinaryWriter.prototype.int64; + + sint64(value: string | number | bigint): BinaryWriter { + let { lo, hi } = int64FromString(value.toString()); + // zig zag + [lo, hi] = zzEncode(lo, hi); + return this._push(writeVarint64, int64Length(lo, hi), { lo, hi }); + } + + fixed64(value: string | number | bigint): BinaryWriter { + const { lo, hi } = int64FromString(value.toString()); + return this._push(writeFixed32, 4, lo)._push(writeFixed32, 4, hi); + } + + // sfixed64 is the same with fixed64 + sfixed64 = BinaryWriter.prototype.fixed64; + + bool(value: boolean): BinaryWriter { + return this._push(writeByte, 1, value ? 1 : 0); + } + + fixed32(value: number): BinaryWriter { + return this._push(writeFixed32, 4, value >>> 0); + } + + // sfixed32 is the same with fixed32 + sfixed32 = BinaryWriter.prototype.fixed32; + + float(value: number): BinaryWriter { + throw new Error("float not supported" + value); + } + + double(value: number): BinaryWriter { + throw new Error("double not supported" + value); + } + + bytes(value: Uint8Array): BinaryWriter { + const len = value.length >>> 0; + if (!len) return this._push(writeByte, 1, 0); + return this.uint32(len)._push(writeBytes, len, value); + } + + string(value: string): BinaryWriter { + const len = utf8Length(value); + return len + ? this.uint32(len)._push(utf8Write, len, value) + : this._push(writeByte, 1, 0); + } +} + +function writeBytes( + val: Uint8Array | number[], + buf: Uint8Array | number[], + pos: number +) { + if (typeof Uint8Array !== "undefined") { + (buf as Uint8Array).set(val, pos); + } else { + for (let i = 0; i < val.length; ++i) buf[pos + i] = val[i]; + } +} + +function pool( + alloc: (size: number) => Uint8Array, + slice: (begin?: number, end?: number) => Uint8Array, + size?: number +): (size: number) => Uint8Array { + const SIZE = size || 8192; + const MAX = SIZE >>> 1; + let slab: Uint8Array | null = null; + let offset = SIZE; + return function pool_alloc(size): Uint8Array { + if (size < 1 || size > MAX) return alloc(size); + if (offset + size > SIZE) { + slab = alloc(SIZE); + offset = 0; + } + const buf: Uint8Array = slice.call(slab, offset, (offset += size)); + if (offset & 7) + // align to 32 bit + offset = (offset | 7) + 1; + return buf; + }; +} + +function indexOutOfRange(reader: BinaryReader, writeLength?: number) { + return RangeError( + "index out of range: " + + reader.pos + + " + " + + (writeLength || 1) + + " > " + + reader.len + ); +} diff --git a/src/codegen/confio/proofs.ts b/src/codegen/confio/proofs.ts index 16941a9..fcf6f0c 100644 --- a/src/codegen/confio/proofs.ts +++ b/src/codegen/confio/proofs.ts @@ -1,5 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../helpers"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { bytesFromBase64, base64FromBytes } from "../helpers"; export enum HashOp { /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ NO_HASH = 0, @@ -7,49 +7,32 @@ export enum HashOp { SHA512 = 2, KECCAK = 3, RIPEMD160 = 4, - - /** BITCOIN - ripemd160(sha256(x)) */ - BITCOIN = 5, - UNRECOGNIZED = -1, -} -export enum HashOpSDKType { - /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ - NO_HASH = 0, - SHA256 = 1, - SHA512 = 2, - KECCAK = 3, - RIPEMD160 = 4, - /** BITCOIN - ripemd160(sha256(x)) */ BITCOIN = 5, UNRECOGNIZED = -1, } +export const HashOpSDKType = HashOp; +export const HashOpAmino = HashOp; export function hashOpFromJSON(object: any): HashOp { switch (object) { case 0: case "NO_HASH": return HashOp.NO_HASH; - case 1: case "SHA256": return HashOp.SHA256; - case 2: case "SHA512": return HashOp.SHA512; - case 3: case "KECCAK": return HashOp.KECCAK; - case 4: case "RIPEMD160": return HashOp.RIPEMD160; - case 5: case "BITCOIN": return HashOp.BITCOIN; - case -1: case "UNRECOGNIZED": default: @@ -60,22 +43,16 @@ export function hashOpToJSON(object: HashOp): string { switch (object) { case HashOp.NO_HASH: return "NO_HASH"; - case HashOp.SHA256: return "SHA256"; - case HashOp.SHA512: return "SHA512"; - case HashOp.KECCAK: return "KECCAK"; - case HashOp.RIPEMD160: return "RIPEMD160"; - case HashOp.BITCOIN: return "BITCOIN"; - case HashOp.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -87,110 +64,58 @@ export function hashOpToJSON(object: HashOp): string { * algorithm, the length will be prepended to the key and value bytes. * (Each one with it's own encoded length) */ - export enum LengthOp { /** NO_PREFIX - NO_PREFIX don't include any length info */ NO_PREFIX = 0, - - /** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */ - VAR_PROTO = 1, - - /** VAR_RLP - VAR_RLP uses rlp int encoding of the length */ - VAR_RLP = 2, - - /** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */ - FIXED32_BIG = 3, - - /** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */ - FIXED32_LITTLE = 4, - - /** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */ - FIXED64_BIG = 5, - - /** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */ - FIXED64_LITTLE = 6, - - /** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */ - REQUIRE_32_BYTES = 7, - - /** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */ - REQUIRE_64_BYTES = 8, - UNRECOGNIZED = -1, -} -/** - * LengthOp defines how to process the key and value of the LeafOp - * to include length information. After encoding the length with the given - * algorithm, the length will be prepended to the key and value bytes. - * (Each one with it's own encoded length) - */ - -export enum LengthOpSDKType { - /** NO_PREFIX - NO_PREFIX don't include any length info */ - NO_PREFIX = 0, - /** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */ VAR_PROTO = 1, - /** VAR_RLP - VAR_RLP uses rlp int encoding of the length */ VAR_RLP = 2, - /** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */ FIXED32_BIG = 3, - /** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */ FIXED32_LITTLE = 4, - /** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */ FIXED64_BIG = 5, - /** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */ FIXED64_LITTLE = 6, - /** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */ REQUIRE_32_BYTES = 7, - /** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */ REQUIRE_64_BYTES = 8, UNRECOGNIZED = -1, } +export const LengthOpSDKType = LengthOp; +export const LengthOpAmino = LengthOp; export function lengthOpFromJSON(object: any): LengthOp { switch (object) { case 0: case "NO_PREFIX": return LengthOp.NO_PREFIX; - case 1: case "VAR_PROTO": return LengthOp.VAR_PROTO; - case 2: case "VAR_RLP": return LengthOp.VAR_RLP; - case 3: case "FIXED32_BIG": return LengthOp.FIXED32_BIG; - case 4: case "FIXED32_LITTLE": return LengthOp.FIXED32_LITTLE; - case 5: case "FIXED64_BIG": return LengthOp.FIXED64_BIG; - case 6: case "FIXED64_LITTLE": return LengthOp.FIXED64_LITTLE; - case 7: case "REQUIRE_32_BYTES": return LengthOp.REQUIRE_32_BYTES; - case 8: case "REQUIRE_64_BYTES": return LengthOp.REQUIRE_64_BYTES; - case -1: case "UNRECOGNIZED": default: @@ -201,31 +126,22 @@ export function lengthOpToJSON(object: LengthOp): string { switch (object) { case LengthOp.NO_PREFIX: return "NO_PREFIX"; - case LengthOp.VAR_PROTO: return "VAR_PROTO"; - case LengthOp.VAR_RLP: return "VAR_RLP"; - case LengthOp.FIXED32_BIG: return "FIXED32_BIG"; - case LengthOp.FIXED32_LITTLE: return "FIXED32_LITTLE"; - case LengthOp.FIXED64_BIG: return "FIXED64_BIG"; - case LengthOp.FIXED64_LITTLE: return "FIXED64_LITTLE"; - case LengthOp.REQUIRE_32_BYTES: return "REQUIRE_32_BYTES"; - case LengthOp.REQUIRE_64_BYTES: return "REQUIRE_64_BYTES"; - case LengthOp.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -252,13 +168,47 @@ export function lengthOpToJSON(object: LengthOp): string { * in the ProofSpec is valuable to prevent this mutability. And why all trees should * length-prefix the data before hashing it. */ - export interface ExistenceProof { key: Uint8Array; value: Uint8Array; leaf?: LeafOp; path: InnerOp[]; } +export interface ExistenceProofProtoMsg { + typeUrl: "/ics23.ExistenceProof"; + value: Uint8Array; +} +/** + * ExistenceProof takes a key and a value and a set of steps to perform on it. + * The result of peforming all these steps will provide a "root hash", which can + * be compared to the value in a header. + * + * Since it is computationally infeasible to produce a hash collission for any of the used + * cryptographic hash functions, if someone can provide a series of operations to transform + * a given key and value into a root hash that matches some trusted root, these key and values + * must be in the referenced merkle tree. + * + * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, + * which should be controlled by a spec. Eg. with lengthOp as NONE, + * prefix = FOO, key = BAR, value = CHOICE + * and + * prefix = F, key = OOBAR, value = CHOICE + * would produce the same value. + * + * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field + * in the ProofSpec is valuable to prevent this mutability. And why all trees should + * length-prefix the data before hashing it. + */ +export interface ExistenceProofAmino { + key?: string; + value?: string; + leaf?: LeafOpAmino; + path?: InnerOpAmino[]; +} +export interface ExistenceProofAminoMsg { + type: "/ics23.ExistenceProof"; + value: ExistenceProofAmino; +} /** * ExistenceProof takes a key and a value and a set of steps to perform on it. * The result of peforming all these steps will provide a "root hash", which can @@ -280,7 +230,6 @@ export interface ExistenceProof { * in the ProofSpec is valuable to prevent this mutability. And why all trees should * length-prefix the data before hashing it. */ - export interface ExistenceProofSDKType { key: Uint8Array; value: Uint8Array; @@ -292,35 +241,64 @@ export interface ExistenceProofSDKType { * one right of the desired key. If both proofs are valid AND they are neighbors, * then there is no valid proof for the given key. */ - export interface NonExistenceProof { /** TODO: remove this as unnecessary??? we prove a range */ key: Uint8Array; left?: ExistenceProof; right?: ExistenceProof; } +export interface NonExistenceProofProtoMsg { + typeUrl: "/ics23.NonExistenceProof"; + value: Uint8Array; +} /** * NonExistenceProof takes a proof of two neighbors, one left of the desired key, * one right of the desired key. If both proofs are valid AND they are neighbors, * then there is no valid proof for the given key. */ - -export interface NonExistenceProofSDKType { +export interface NonExistenceProofAmino { /** TODO: remove this as unnecessary??? we prove a range */ + key?: string; + left?: ExistenceProofAmino; + right?: ExistenceProofAmino; +} +export interface NonExistenceProofAminoMsg { + type: "/ics23.NonExistenceProof"; + value: NonExistenceProofAmino; +} +/** + * NonExistenceProof takes a proof of two neighbors, one left of the desired key, + * one right of the desired key. If both proofs are valid AND they are neighbors, + * then there is no valid proof for the given key. + */ +export interface NonExistenceProofSDKType { key: Uint8Array; left?: ExistenceProofSDKType; right?: ExistenceProofSDKType; } /** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ - export interface CommitmentProof { exist?: ExistenceProof; nonexist?: NonExistenceProof; batch?: BatchProof; compressed?: CompressedBatchProof; } +export interface CommitmentProofProtoMsg { + typeUrl: "/ics23.CommitmentProof"; + value: Uint8Array; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProofAmino { + exist?: ExistenceProofAmino; + nonexist?: NonExistenceProofAmino; + batch?: BatchProofAmino; + compressed?: CompressedBatchProofAmino; +} +export interface CommitmentProofAminoMsg { + type: "/ics23.CommitmentProof"; + value: CommitmentProofAmino; +} /** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ - export interface CommitmentProofSDKType { exist?: ExistenceProofSDKType; nonexist?: NonExistenceProofSDKType; @@ -343,7 +321,6 @@ export interface CommitmentProofSDKType { * Then combine the bytes, and hash it * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) */ - export interface LeafOp { hash: HashOp; prehashKey: HashOp; @@ -353,9 +330,12 @@ export interface LeafOp { * prefix is a fixed bytes that may optionally be included at the beginning to differentiate * a leaf node from an inner node. */ - prefix: Uint8Array; } +export interface LeafOpProtoMsg { + typeUrl: "/ics23.LeafOp"; + value: Uint8Array; +} /** * LeafOp represents the raw key-value data we wish to prove, and * must be flexible to represent the internal transformation from @@ -372,17 +352,42 @@ export interface LeafOp { * Then combine the bytes, and hash it * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) */ - -export interface LeafOpSDKType { - hash: HashOpSDKType; - prehash_key: HashOpSDKType; - prehash_value: HashOpSDKType; - length: LengthOpSDKType; +export interface LeafOpAmino { + hash?: HashOp; + prehash_key?: HashOp; + prehash_value?: HashOp; + length?: LengthOp; /** * prefix is a fixed bytes that may optionally be included at the beginning to differentiate * a leaf node from an inner node. */ - + prefix?: string; +} +export interface LeafOpAminoMsg { + type: "/ics23.LeafOp"; + value: LeafOpAmino; +} +/** + * LeafOp represents the raw key-value data we wish to prove, and + * must be flexible to represent the internal transformation from + * the original key-value pairs into the basis hash, for many existing + * merkle trees. + * + * key and value are passed in. So that the signature of this operation is: + * leafOp(key, value) -> output + * + * To process this, first prehash the keys and values if needed (ANY means no hash in this case): + * hkey = prehashKey(key) + * hvalue = prehashValue(value) + * + * Then combine the bytes, and hash it + * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) + */ +export interface LeafOpSDKType { + hash: HashOp; + prehash_key: HashOp; + prehash_value: HashOp; + length: LengthOp; prefix: Uint8Array; } /** @@ -402,12 +407,41 @@ export interface LeafOpSDKType { * some value to differentiate from leaf nodes, should be included in prefix and suffix. * If either of prefix or suffix is empty, we just treat it as an empty string */ - export interface InnerOp { hash: HashOp; prefix: Uint8Array; suffix: Uint8Array; } +export interface InnerOpProtoMsg { + typeUrl: "/ics23.InnerOp"; + value: Uint8Array; +} +/** + * InnerOp represents a merkle-proof step that is not a leaf. + * It represents concatenating two children and hashing them to provide the next result. + * + * The result of the previous step is passed in, so the signature of this op is: + * innerOp(child) -> output + * + * The result of applying InnerOp should be: + * output = op.hash(op.prefix || child || op.suffix) + * + * where the || operator is concatenation of binary data, + * and child is the result of hashing all the tree below this step. + * + * Any special data, like prepending child with the length, or prepending the entire operation with + * some value to differentiate from leaf nodes, should be included in prefix and suffix. + * If either of prefix or suffix is empty, we just treat it as an empty string + */ +export interface InnerOpAmino { + hash?: HashOp; + prefix?: string; + suffix?: string; +} +export interface InnerOpAminoMsg { + type: "/ics23.InnerOp"; + value: InnerOpAmino; +} /** * InnerOp represents a merkle-proof step that is not a leaf. * It represents concatenating two children and hashing them to provide the next result. @@ -425,9 +459,8 @@ export interface InnerOp { * some value to differentiate from leaf nodes, should be included in prefix and suffix. * If either of prefix or suffix is empty, we just treat it as an empty string */ - export interface InnerOpSDKType { - hash: HashOpSDKType; + hash: HashOp; prefix: Uint8Array; suffix: Uint8Array; } @@ -443,7 +476,6 @@ export interface InnerOpSDKType { * We need this for proper security, requires client knows a priori what * tree format server uses. But not in code, rather a configuration object. */ - export interface ProofSpec { /** * any field in the ExistenceProof must be the same as in this spec. @@ -452,12 +484,14 @@ export interface ProofSpec { leafSpec?: LeafOp; innerSpec?: InnerSpec; /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ - maxDepth: number; /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ - minDepth: number; } +export interface ProofSpecProtoMsg { + typeUrl: "/ics23.ProofSpec"; + value: Uint8Array; +} /** * ProofSpec defines what the expected parameters are for a given proof type. * This can be stored in the client and used to validate any incoming proofs. @@ -470,19 +504,38 @@ export interface ProofSpec { * We need this for proper security, requires client knows a priori what * tree format server uses. But not in code, rather a configuration object. */ - -export interface ProofSpecSDKType { +export interface ProofSpecAmino { /** * any field in the ExistenceProof must be the same as in this spec. * except Prefix, which is just the first bytes of prefix (spec can be longer) */ + leaf_spec?: LeafOpAmino; + inner_spec?: InnerSpecAmino; + /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ + max_depth?: number; + /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ + min_depth?: number; +} +export interface ProofSpecAminoMsg { + type: "/ics23.ProofSpec"; + value: ProofSpecAmino; +} +/** + * ProofSpec defines what the expected parameters are for a given proof type. + * This can be stored in the client and used to validate any incoming proofs. + * + * verify(ProofSpec, Proof) -> Proof | Error + * + * As demonstrated in tests, if we don't fix the algorithm used to calculate the + * LeafHash for a given tree, there are many possible key-value pairs that can + * generate a given hash (by interpretting the preimage differently). + * We need this for proper security, requires client knows a priori what + * tree format server uses. But not in code, rather a configuration object. + */ +export interface ProofSpecSDKType { leaf_spec?: LeafOpSDKType; inner_spec?: InnerSpecSDKType; - /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ - max_depth: number; - /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ - min_depth: number; } /** @@ -495,7 +548,6 @@ export interface ProofSpecSDKType { * isRightMost(spec: InnerSpec, op: InnerOp) * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) */ - export interface InnerSpec { /** * Child order is the ordering of the children node, must count from 0 @@ -507,12 +559,14 @@ export interface InnerSpec { minPrefixLength: number; maxPrefixLength: number; /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ - emptyChild: Uint8Array; /** hash is the algorithm that must be used for each InnerOp */ - hash: HashOp; } +export interface InnerSpecProtoMsg { + typeUrl: "/ics23.InnerSpec"; + value: Uint8Array; +} /** * InnerSpec contains all store-specific structure info to determine if two proofs from a * given store are neighbors. @@ -523,42 +577,82 @@ export interface InnerSpec { * isRightMost(spec: InnerSpec, op: InnerOp) * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) */ - -export interface InnerSpecSDKType { +export interface InnerSpecAmino { /** * Child order is the ordering of the children node, must count from 0 * iavl tree is [0, 1] (left then right) * merk is [0, 2, 1] (left, right, here) */ + child_order?: number[]; + child_size?: number; + min_prefix_length?: number; + max_prefix_length?: number; + /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ + empty_child?: string; + /** hash is the algorithm that must be used for each InnerOp */ + hash?: HashOp; +} +export interface InnerSpecAminoMsg { + type: "/ics23.InnerSpec"; + value: InnerSpecAmino; +} +/** + * InnerSpec contains all store-specific structure info to determine if two proofs from a + * given store are neighbors. + * + * This enables: + * + * isLeftMost(spec: InnerSpec, op: InnerOp) + * isRightMost(spec: InnerSpec, op: InnerOp) + * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) + */ +export interface InnerSpecSDKType { child_order: number[]; child_size: number; min_prefix_length: number; max_prefix_length: number; - /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ - empty_child: Uint8Array; - /** hash is the algorithm that must be used for each InnerOp */ - - hash: HashOpSDKType; + hash: HashOp; } /** BatchProof is a group of multiple proof types than can be compressed */ - export interface BatchProof { entries: BatchEntry[]; } +export interface BatchProofProtoMsg { + typeUrl: "/ics23.BatchProof"; + value: Uint8Array; +} +/** BatchProof is a group of multiple proof types than can be compressed */ +export interface BatchProofAmino { + entries?: BatchEntryAmino[]; +} +export interface BatchProofAminoMsg { + type: "/ics23.BatchProof"; + value: BatchProofAmino; +} /** BatchProof is a group of multiple proof types than can be compressed */ - export interface BatchProofSDKType { entries: BatchEntrySDKType[]; } /** Use BatchEntry not CommitmentProof, to avoid recursion */ - export interface BatchEntry { exist?: ExistenceProof; nonexist?: NonExistenceProof; } +export interface BatchEntryProtoMsg { + typeUrl: "/ics23.BatchEntry"; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface BatchEntryAmino { + exist?: ExistenceProofAmino; + nonexist?: NonExistenceProofAmino; +} +export interface BatchEntryAminoMsg { + type: "/ics23.BatchEntry"; + value: BatchEntryAmino; +} /** Use BatchEntry not CommitmentProof, to avoid recursion */ - export interface BatchEntrySDKType { exist?: ExistenceProofSDKType; nonexist?: NonExistenceProofSDKType; @@ -567,18 +661,41 @@ export interface CompressedBatchProof { entries: CompressedBatchEntry[]; lookupInners: InnerOp[]; } +export interface CompressedBatchProofProtoMsg { + typeUrl: "/ics23.CompressedBatchProof"; + value: Uint8Array; +} +export interface CompressedBatchProofAmino { + entries?: CompressedBatchEntryAmino[]; + lookup_inners?: InnerOpAmino[]; +} +export interface CompressedBatchProofAminoMsg { + type: "/ics23.CompressedBatchProof"; + value: CompressedBatchProofAmino; +} export interface CompressedBatchProofSDKType { entries: CompressedBatchEntrySDKType[]; lookup_inners: InnerOpSDKType[]; } /** Use BatchEntry not CommitmentProof, to avoid recursion */ - export interface CompressedBatchEntry { exist?: CompressedExistenceProof; nonexist?: CompressedNonExistenceProof; } +export interface CompressedBatchEntryProtoMsg { + typeUrl: "/ics23.CompressedBatchEntry"; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntryAmino { + exist?: CompressedExistenceProofAmino; + nonexist?: CompressedNonExistenceProofAmino; +} +export interface CompressedBatchEntryAminoMsg { + type: "/ics23.CompressedBatchEntry"; + value: CompressedBatchEntryAmino; +} /** Use BatchEntry not CommitmentProof, to avoid recursion */ - export interface CompressedBatchEntrySDKType { exist?: CompressedExistenceProofSDKType; nonexist?: CompressedNonExistenceProofSDKType; @@ -588,15 +705,27 @@ export interface CompressedExistenceProof { value: Uint8Array; leaf?: LeafOp; /** these are indexes into the lookup_inners table in CompressedBatchProof */ - path: number[]; } +export interface CompressedExistenceProofProtoMsg { + typeUrl: "/ics23.CompressedExistenceProof"; + value: Uint8Array; +} +export interface CompressedExistenceProofAmino { + key?: string; + value?: string; + leaf?: LeafOpAmino; + /** these are indexes into the lookup_inners table in CompressedBatchProof */ + path?: number[]; +} +export interface CompressedExistenceProofAminoMsg { + type: "/ics23.CompressedExistenceProof"; + value: CompressedExistenceProofAmino; +} export interface CompressedExistenceProofSDKType { key: Uint8Array; value: Uint8Array; leaf?: LeafOpSDKType; - /** these are indexes into the lookup_inners table in CompressedBatchProof */ - path: number[]; } export interface CompressedNonExistenceProof { @@ -605,13 +734,25 @@ export interface CompressedNonExistenceProof { left?: CompressedExistenceProof; right?: CompressedExistenceProof; } -export interface CompressedNonExistenceProofSDKType { +export interface CompressedNonExistenceProofProtoMsg { + typeUrl: "/ics23.CompressedNonExistenceProof"; + value: Uint8Array; +} +export interface CompressedNonExistenceProofAmino { /** TODO: remove this as unnecessary??? we prove a range */ + key?: string; + left?: CompressedExistenceProofAmino; + right?: CompressedExistenceProofAmino; +} +export interface CompressedNonExistenceProofAminoMsg { + type: "/ics23.CompressedNonExistenceProof"; + value: CompressedNonExistenceProofAmino; +} +export interface CompressedNonExistenceProofSDKType { key: Uint8Array; left?: CompressedExistenceProofSDKType; right?: CompressedExistenceProofSDKType; } - function createBaseExistenceProof(): ExistenceProof { return { key: new Uint8Array(), @@ -620,73 +761,99 @@ function createBaseExistenceProof(): ExistenceProof { path: [] }; } - export const ExistenceProof = { - encode(message: ExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.ExistenceProof", + encode(message: ExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - if (message.leaf !== undefined) { LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); } - for (const v of message.path) { InnerOp.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ExistenceProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExistenceProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: message.value = reader.bytes(); break; - case 3: message.leaf = LeafOp.decode(reader, reader.uint32()); break; - case 4: message.path.push(InnerOp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ExistenceProof { + fromPartial(object: Partial): ExistenceProof { const message = createBaseExistenceProof(); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined; message.path = object.path?.map(e => InnerOp.fromPartial(e)) || []; return message; + }, + fromAmino(object: ExistenceProofAmino): ExistenceProof { + const message = createBaseExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.leaf !== undefined && object.leaf !== null) { + message.leaf = LeafOp.fromAmino(object.leaf); + } + message.path = object.path?.map(e => InnerOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExistenceProof): ExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; + if (message.path) { + obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); + } else { + obj.path = []; + } + return obj; + }, + fromAminoMsg(object: ExistenceProofAminoMsg): ExistenceProof { + return ExistenceProof.fromAmino(object.value); + }, + fromProtoMsg(message: ExistenceProofProtoMsg): ExistenceProof { + return ExistenceProof.decode(message.value); + }, + toProto(message: ExistenceProof): Uint8Array { + return ExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: ExistenceProof): ExistenceProofProtoMsg { + return { + typeUrl: "/ics23.ExistenceProof", + value: ExistenceProof.encode(message).finish() + }; } - }; - function createBaseNonExistenceProof(): NonExistenceProof { return { key: new Uint8Array(), @@ -694,64 +861,86 @@ function createBaseNonExistenceProof(): NonExistenceProof { right: undefined }; } - export const NonExistenceProof = { - encode(message: NonExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.NonExistenceProof", + encode(message: NonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.left !== undefined) { ExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); } - if (message.right !== undefined) { ExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): NonExistenceProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): NonExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNonExistenceProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: message.left = ExistenceProof.decode(reader, reader.uint32()); break; - case 3: message.right = ExistenceProof.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): NonExistenceProof { + fromPartial(object: Partial): NonExistenceProof { const message = createBaseNonExistenceProof(); message.key = object.key ?? new Uint8Array(); message.left = object.left !== undefined && object.left !== null ? ExistenceProof.fromPartial(object.left) : undefined; message.right = object.right !== undefined && object.right !== null ? ExistenceProof.fromPartial(object.right) : undefined; return message; + }, + fromAmino(object: NonExistenceProofAmino): NonExistenceProof { + const message = createBaseNonExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.left !== undefined && object.left !== null) { + message.left = ExistenceProof.fromAmino(object.left); + } + if (object.right !== undefined && object.right !== null) { + message.right = ExistenceProof.fromAmino(object.right); + } + return message; + }, + toAmino(message: NonExistenceProof): NonExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.left = message.left ? ExistenceProof.toAmino(message.left) : undefined; + obj.right = message.right ? ExistenceProof.toAmino(message.right) : undefined; + return obj; + }, + fromAminoMsg(object: NonExistenceProofAminoMsg): NonExistenceProof { + return NonExistenceProof.fromAmino(object.value); + }, + fromProtoMsg(message: NonExistenceProofProtoMsg): NonExistenceProof { + return NonExistenceProof.decode(message.value); + }, + toProto(message: NonExistenceProof): Uint8Array { + return NonExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: NonExistenceProof): NonExistenceProofProtoMsg { + return { + typeUrl: "/ics23.NonExistenceProof", + value: NonExistenceProof.encode(message).finish() + }; } - }; - function createBaseCommitmentProof(): CommitmentProof { return { exist: undefined, @@ -760,73 +949,97 @@ function createBaseCommitmentProof(): CommitmentProof { compressed: undefined }; } - export const CommitmentProof = { - encode(message: CommitmentProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.CommitmentProof", + encode(message: CommitmentProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); } - if (message.nonexist !== undefined) { NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); } - if (message.batch !== undefined) { BatchProof.encode(message.batch, writer.uint32(26).fork()).ldelim(); } - if (message.compressed !== undefined) { CompressedBatchProof.encode(message.compressed, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CommitmentProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CommitmentProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommitmentProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.exist = ExistenceProof.decode(reader, reader.uint32()); break; - case 2: message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); break; - case 3: message.batch = BatchProof.decode(reader, reader.uint32()); break; - case 4: message.compressed = CompressedBatchProof.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CommitmentProof { + fromPartial(object: Partial): CommitmentProof { const message = createBaseCommitmentProof(); message.exist = object.exist !== undefined && object.exist !== null ? ExistenceProof.fromPartial(object.exist) : undefined; message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? NonExistenceProof.fromPartial(object.nonexist) : undefined; message.batch = object.batch !== undefined && object.batch !== null ? BatchProof.fromPartial(object.batch) : undefined; message.compressed = object.compressed !== undefined && object.compressed !== null ? CompressedBatchProof.fromPartial(object.compressed) : undefined; return message; + }, + fromAmino(object: CommitmentProofAmino): CommitmentProof { + const message = createBaseCommitmentProof(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = ExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = NonExistenceProof.fromAmino(object.nonexist); + } + if (object.batch !== undefined && object.batch !== null) { + message.batch = BatchProof.fromAmino(object.batch); + } + if (object.compressed !== undefined && object.compressed !== null) { + message.compressed = CompressedBatchProof.fromAmino(object.compressed); + } + return message; + }, + toAmino(message: CommitmentProof): CommitmentProofAmino { + const obj: any = {}; + obj.exist = message.exist ? ExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? NonExistenceProof.toAmino(message.nonexist) : undefined; + obj.batch = message.batch ? BatchProof.toAmino(message.batch) : undefined; + obj.compressed = message.compressed ? CompressedBatchProof.toAmino(message.compressed) : undefined; + return obj; + }, + fromAminoMsg(object: CommitmentProofAminoMsg): CommitmentProof { + return CommitmentProof.fromAmino(object.value); + }, + fromProtoMsg(message: CommitmentProofProtoMsg): CommitmentProof { + return CommitmentProof.decode(message.value); + }, + toProto(message: CommitmentProof): Uint8Array { + return CommitmentProof.encode(message).finish(); + }, + toProtoMsg(message: CommitmentProof): CommitmentProofProtoMsg { + return { + typeUrl: "/ics23.CommitmentProof", + value: CommitmentProof.encode(message).finish() + }; } - }; - function createBaseLeafOp(): LeafOp { return { hash: 0, @@ -836,71 +1049,56 @@ function createBaseLeafOp(): LeafOp { prefix: new Uint8Array() }; } - export const LeafOp = { - encode(message: LeafOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.LeafOp", + encode(message: LeafOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== 0) { writer.uint32(8).int32(message.hash); } - if (message.prehashKey !== 0) { writer.uint32(16).int32(message.prehashKey); } - if (message.prehashValue !== 0) { writer.uint32(24).int32(message.prehashValue); } - if (message.length !== 0) { writer.uint32(32).int32(message.length); } - if (message.prefix.length !== 0) { writer.uint32(42).bytes(message.prefix); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): LeafOp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): LeafOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseLeafOp(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = (reader.int32() as any); break; - case 2: message.prehashKey = (reader.int32() as any); break; - case 3: message.prehashValue = (reader.int32() as any); break; - case 4: message.length = (reader.int32() as any); break; - case 5: message.prefix = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): LeafOp { + fromPartial(object: Partial): LeafOp { const message = createBaseLeafOp(); message.hash = object.hash ?? 0; message.prehashKey = object.prehashKey ?? 0; @@ -908,10 +1106,51 @@ export const LeafOp = { message.length = object.length ?? 0; message.prefix = object.prefix ?? new Uint8Array(); return message; + }, + fromAmino(object: LeafOpAmino): LeafOp { + const message = createBaseLeafOp(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = hashOpFromJSON(object.hash); + } + if (object.prehash_key !== undefined && object.prehash_key !== null) { + message.prehashKey = hashOpFromJSON(object.prehash_key); + } + if (object.prehash_value !== undefined && object.prehash_value !== null) { + message.prehashValue = hashOpFromJSON(object.prehash_value); + } + if (object.length !== undefined && object.length !== null) { + message.length = lengthOpFromJSON(object.length); + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = bytesFromBase64(object.prefix); + } + return message; + }, + toAmino(message: LeafOp): LeafOpAmino { + const obj: any = {}; + obj.hash = hashOpToJSON(message.hash); + obj.prehash_key = hashOpToJSON(message.prehashKey); + obj.prehash_value = hashOpToJSON(message.prehashValue); + obj.length = lengthOpToJSON(message.length); + obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; + return obj; + }, + fromAminoMsg(object: LeafOpAminoMsg): LeafOp { + return LeafOp.fromAmino(object.value); + }, + fromProtoMsg(message: LeafOpProtoMsg): LeafOp { + return LeafOp.decode(message.value); + }, + toProto(message: LeafOp): Uint8Array { + return LeafOp.encode(message).finish(); + }, + toProtoMsg(message: LeafOp): LeafOpProtoMsg { + return { + typeUrl: "/ics23.LeafOp", + value: LeafOp.encode(message).finish() + }; } - }; - function createBaseInnerOp(): InnerOp { return { hash: 0, @@ -919,64 +1158,86 @@ function createBaseInnerOp(): InnerOp { suffix: new Uint8Array() }; } - export const InnerOp = { - encode(message: InnerOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.InnerOp", + encode(message: InnerOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== 0) { writer.uint32(8).int32(message.hash); } - if (message.prefix.length !== 0) { writer.uint32(18).bytes(message.prefix); } - if (message.suffix.length !== 0) { writer.uint32(26).bytes(message.suffix); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InnerOp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): InnerOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInnerOp(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = (reader.int32() as any); break; - case 2: message.prefix = reader.bytes(); break; - case 3: message.suffix = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): InnerOp { + fromPartial(object: Partial): InnerOp { const message = createBaseInnerOp(); message.hash = object.hash ?? 0; message.prefix = object.prefix ?? new Uint8Array(); message.suffix = object.suffix ?? new Uint8Array(); return message; + }, + fromAmino(object: InnerOpAmino): InnerOp { + const message = createBaseInnerOp(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = hashOpFromJSON(object.hash); + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = bytesFromBase64(object.prefix); + } + if (object.suffix !== undefined && object.suffix !== null) { + message.suffix = bytesFromBase64(object.suffix); + } + return message; + }, + toAmino(message: InnerOp): InnerOpAmino { + const obj: any = {}; + obj.hash = hashOpToJSON(message.hash); + obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; + obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; + return obj; + }, + fromAminoMsg(object: InnerOpAminoMsg): InnerOp { + return InnerOp.fromAmino(object.value); + }, + fromProtoMsg(message: InnerOpProtoMsg): InnerOp { + return InnerOp.decode(message.value); + }, + toProto(message: InnerOp): Uint8Array { + return InnerOp.encode(message).finish(); + }, + toProtoMsg(message: InnerOp): InnerOpProtoMsg { + return { + typeUrl: "/ics23.InnerOp", + value: InnerOp.encode(message).finish() + }; } - }; - function createBaseProofSpec(): ProofSpec { return { leafSpec: undefined, @@ -985,73 +1246,97 @@ function createBaseProofSpec(): ProofSpec { minDepth: 0 }; } - export const ProofSpec = { - encode(message: ProofSpec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.ProofSpec", + encode(message: ProofSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leafSpec !== undefined) { LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).ldelim(); } - if (message.innerSpec !== undefined) { InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).ldelim(); } - if (message.maxDepth !== 0) { writer.uint32(24).int32(message.maxDepth); } - if (message.minDepth !== 0) { writer.uint32(32).int32(message.minDepth); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ProofSpec { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ProofSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProofSpec(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.leafSpec = LeafOp.decode(reader, reader.uint32()); break; - case 2: message.innerSpec = InnerSpec.decode(reader, reader.uint32()); break; - case 3: message.maxDepth = reader.int32(); break; - case 4: message.minDepth = reader.int32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ProofSpec { + fromPartial(object: Partial): ProofSpec { const message = createBaseProofSpec(); message.leafSpec = object.leafSpec !== undefined && object.leafSpec !== null ? LeafOp.fromPartial(object.leafSpec) : undefined; message.innerSpec = object.innerSpec !== undefined && object.innerSpec !== null ? InnerSpec.fromPartial(object.innerSpec) : undefined; message.maxDepth = object.maxDepth ?? 0; message.minDepth = object.minDepth ?? 0; return message; + }, + fromAmino(object: ProofSpecAmino): ProofSpec { + const message = createBaseProofSpec(); + if (object.leaf_spec !== undefined && object.leaf_spec !== null) { + message.leafSpec = LeafOp.fromAmino(object.leaf_spec); + } + if (object.inner_spec !== undefined && object.inner_spec !== null) { + message.innerSpec = InnerSpec.fromAmino(object.inner_spec); + } + if (object.max_depth !== undefined && object.max_depth !== null) { + message.maxDepth = object.max_depth; + } + if (object.min_depth !== undefined && object.min_depth !== null) { + message.minDepth = object.min_depth; + } + return message; + }, + toAmino(message: ProofSpec): ProofSpecAmino { + const obj: any = {}; + obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; + obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; + obj.max_depth = message.maxDepth; + obj.min_depth = message.minDepth; + return obj; + }, + fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { + return ProofSpec.fromAmino(object.value); + }, + fromProtoMsg(message: ProofSpecProtoMsg): ProofSpec { + return ProofSpec.decode(message.value); + }, + toProto(message: ProofSpec): Uint8Array { + return ProofSpec.encode(message).finish(); + }, + toProtoMsg(message: ProofSpec): ProofSpecProtoMsg { + return { + typeUrl: "/ics23.ProofSpec", + value: ProofSpec.encode(message).finish() + }; } - }; - function createBaseInnerSpec(): InnerSpec { return { childOrder: [], @@ -1062,92 +1347,71 @@ function createBaseInnerSpec(): InnerSpec { hash: 0 }; } - export const InnerSpec = { - encode(message: InnerSpec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.InnerSpec", + encode(message: InnerSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); - for (const v of message.childOrder) { writer.int32(v); } - writer.ldelim(); - if (message.childSize !== 0) { writer.uint32(16).int32(message.childSize); } - if (message.minPrefixLength !== 0) { writer.uint32(24).int32(message.minPrefixLength); } - if (message.maxPrefixLength !== 0) { writer.uint32(32).int32(message.maxPrefixLength); } - if (message.emptyChild.length !== 0) { writer.uint32(42).bytes(message.emptyChild); } - if (message.hash !== 0) { writer.uint32(48).int32(message.hash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InnerSpec { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): InnerSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInnerSpec(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.childOrder.push(reader.int32()); } } else { message.childOrder.push(reader.int32()); } - break; - case 2: message.childSize = reader.int32(); break; - case 3: message.minPrefixLength = reader.int32(); break; - case 4: message.maxPrefixLength = reader.int32(); break; - case 5: message.emptyChild = reader.bytes(); break; - case 6: message.hash = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): InnerSpec { + fromPartial(object: Partial): InnerSpec { const message = createBaseInnerSpec(); message.childOrder = object.childOrder?.map(e => e) || []; message.childSize = object.childSize ?? 0; @@ -1156,220 +1420,351 @@ export const InnerSpec = { message.emptyChild = object.emptyChild ?? new Uint8Array(); message.hash = object.hash ?? 0; return message; + }, + fromAmino(object: InnerSpecAmino): InnerSpec { + const message = createBaseInnerSpec(); + message.childOrder = object.child_order?.map(e => e) || []; + if (object.child_size !== undefined && object.child_size !== null) { + message.childSize = object.child_size; + } + if (object.min_prefix_length !== undefined && object.min_prefix_length !== null) { + message.minPrefixLength = object.min_prefix_length; + } + if (object.max_prefix_length !== undefined && object.max_prefix_length !== null) { + message.maxPrefixLength = object.max_prefix_length; + } + if (object.empty_child !== undefined && object.empty_child !== null) { + message.emptyChild = bytesFromBase64(object.empty_child); + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = hashOpFromJSON(object.hash); + } + return message; + }, + toAmino(message: InnerSpec): InnerSpecAmino { + const obj: any = {}; + if (message.childOrder) { + obj.child_order = message.childOrder.map(e => e); + } else { + obj.child_order = []; + } + obj.child_size = message.childSize; + obj.min_prefix_length = message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength; + obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; + obj.hash = hashOpToJSON(message.hash); + return obj; + }, + fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { + return InnerSpec.fromAmino(object.value); + }, + fromProtoMsg(message: InnerSpecProtoMsg): InnerSpec { + return InnerSpec.decode(message.value); + }, + toProto(message: InnerSpec): Uint8Array { + return InnerSpec.encode(message).finish(); + }, + toProtoMsg(message: InnerSpec): InnerSpecProtoMsg { + return { + typeUrl: "/ics23.InnerSpec", + value: InnerSpec.encode(message).finish() + }; } - }; - function createBaseBatchProof(): BatchProof { return { entries: [] }; } - export const BatchProof = { - encode(message: BatchProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.BatchProof", + encode(message: BatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { BatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BatchProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BatchProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBatchProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.entries.push(BatchEntry.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BatchProof { + fromPartial(object: Partial): BatchProof { const message = createBaseBatchProof(); message.entries = object.entries?.map(e => BatchEntry.fromPartial(e)) || []; return message; + }, + fromAmino(object: BatchProofAmino): BatchProof { + const message = createBaseBatchProof(); + message.entries = object.entries?.map(e => BatchEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: BatchProof): BatchProofAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + fromAminoMsg(object: BatchProofAminoMsg): BatchProof { + return BatchProof.fromAmino(object.value); + }, + fromProtoMsg(message: BatchProofProtoMsg): BatchProof { + return BatchProof.decode(message.value); + }, + toProto(message: BatchProof): Uint8Array { + return BatchProof.encode(message).finish(); + }, + toProtoMsg(message: BatchProof): BatchProofProtoMsg { + return { + typeUrl: "/ics23.BatchProof", + value: BatchProof.encode(message).finish() + }; } - }; - function createBaseBatchEntry(): BatchEntry { return { exist: undefined, nonexist: undefined }; } - export const BatchEntry = { - encode(message: BatchEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.BatchEntry", + encode(message: BatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); } - if (message.nonexist !== undefined) { NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BatchEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BatchEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBatchEntry(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.exist = ExistenceProof.decode(reader, reader.uint32()); break; - case 2: message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BatchEntry { + fromPartial(object: Partial): BatchEntry { const message = createBaseBatchEntry(); message.exist = object.exist !== undefined && object.exist !== null ? ExistenceProof.fromPartial(object.exist) : undefined; message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? NonExistenceProof.fromPartial(object.nonexist) : undefined; return message; + }, + fromAmino(object: BatchEntryAmino): BatchEntry { + const message = createBaseBatchEntry(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = ExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = NonExistenceProof.fromAmino(object.nonexist); + } + return message; + }, + toAmino(message: BatchEntry): BatchEntryAmino { + const obj: any = {}; + obj.exist = message.exist ? ExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? NonExistenceProof.toAmino(message.nonexist) : undefined; + return obj; + }, + fromAminoMsg(object: BatchEntryAminoMsg): BatchEntry { + return BatchEntry.fromAmino(object.value); + }, + fromProtoMsg(message: BatchEntryProtoMsg): BatchEntry { + return BatchEntry.decode(message.value); + }, + toProto(message: BatchEntry): Uint8Array { + return BatchEntry.encode(message).finish(); + }, + toProtoMsg(message: BatchEntry): BatchEntryProtoMsg { + return { + typeUrl: "/ics23.BatchEntry", + value: BatchEntry.encode(message).finish() + }; } - }; - function createBaseCompressedBatchProof(): CompressedBatchProof { return { entries: [], lookupInners: [] }; } - export const CompressedBatchProof = { - encode(message: CompressedBatchProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.CompressedBatchProof", + encode(message: CompressedBatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.lookupInners) { InnerOp.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CompressedBatchProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCompressedBatchProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.entries.push(CompressedBatchEntry.decode(reader, reader.uint32())); break; - case 2: message.lookupInners.push(InnerOp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CompressedBatchProof { + fromPartial(object: Partial): CompressedBatchProof { const message = createBaseCompressedBatchProof(); message.entries = object.entries?.map(e => CompressedBatchEntry.fromPartial(e)) || []; message.lookupInners = object.lookupInners?.map(e => InnerOp.fromPartial(e)) || []; return message; + }, + fromAmino(object: CompressedBatchProofAmino): CompressedBatchProof { + const message = createBaseCompressedBatchProof(); + message.entries = object.entries?.map(e => CompressedBatchEntry.fromAmino(e)) || []; + message.lookupInners = object.lookup_inners?.map(e => InnerOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: CompressedBatchProof): CompressedBatchProofAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); + } else { + obj.entries = []; + } + if (message.lookupInners) { + obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); + } else { + obj.lookup_inners = []; + } + return obj; + }, + fromAminoMsg(object: CompressedBatchProofAminoMsg): CompressedBatchProof { + return CompressedBatchProof.fromAmino(object.value); + }, + fromProtoMsg(message: CompressedBatchProofProtoMsg): CompressedBatchProof { + return CompressedBatchProof.decode(message.value); + }, + toProto(message: CompressedBatchProof): Uint8Array { + return CompressedBatchProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchProof): CompressedBatchProofProtoMsg { + return { + typeUrl: "/ics23.CompressedBatchProof", + value: CompressedBatchProof.encode(message).finish() + }; } - }; - function createBaseCompressedBatchEntry(): CompressedBatchEntry { return { exist: undefined, nonexist: undefined }; } - export const CompressedBatchEntry = { - encode(message: CompressedBatchEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.CompressedBatchEntry", + encode(message: CompressedBatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); } - if (message.nonexist !== undefined) { CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CompressedBatchEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCompressedBatchEntry(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.exist = CompressedExistenceProof.decode(reader, reader.uint32()); break; - case 2: message.nonexist = CompressedNonExistenceProof.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CompressedBatchEntry { + fromPartial(object: Partial): CompressedBatchEntry { const message = createBaseCompressedBatchEntry(); message.exist = object.exist !== undefined && object.exist !== null ? CompressedExistenceProof.fromPartial(object.exist) : undefined; message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? CompressedNonExistenceProof.fromPartial(object.nonexist) : undefined; return message; + }, + fromAmino(object: CompressedBatchEntryAmino): CompressedBatchEntry { + const message = createBaseCompressedBatchEntry(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = CompressedExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = CompressedNonExistenceProof.fromAmino(object.nonexist); + } + return message; + }, + toAmino(message: CompressedBatchEntry): CompressedBatchEntryAmino { + const obj: any = {}; + obj.exist = message.exist ? CompressedExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toAmino(message.nonexist) : undefined; + return obj; + }, + fromAminoMsg(object: CompressedBatchEntryAminoMsg): CompressedBatchEntry { + return CompressedBatchEntry.fromAmino(object.value); + }, + fromProtoMsg(message: CompressedBatchEntryProtoMsg): CompressedBatchEntry { + return CompressedBatchEntry.decode(message.value); + }, + toProto(message: CompressedBatchEntry): Uint8Array { + return CompressedBatchEntry.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchEntry): CompressedBatchEntryProtoMsg { + return { + typeUrl: "/ics23.CompressedBatchEntry", + value: CompressedBatchEntry.encode(message).finish() + }; } - }; - function createBaseCompressedExistenceProof(): CompressedExistenceProof { return { key: new Uint8Array(), @@ -1378,85 +1773,108 @@ function createBaseCompressedExistenceProof(): CompressedExistenceProof { path: [] }; } - export const CompressedExistenceProof = { - encode(message: CompressedExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.CompressedExistenceProof", + encode(message: CompressedExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - if (message.leaf !== undefined) { LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); } - writer.uint32(34).fork(); - for (const v of message.path) { writer.int32(v); } - writer.ldelim(); return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CompressedExistenceProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CompressedExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCompressedExistenceProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: message.value = reader.bytes(); break; - case 3: message.leaf = LeafOp.decode(reader, reader.uint32()); break; - case 4: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.path.push(reader.int32()); } } else { message.path.push(reader.int32()); } - break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CompressedExistenceProof { + fromPartial(object: Partial): CompressedExistenceProof { const message = createBaseCompressedExistenceProof(); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined; message.path = object.path?.map(e => e) || []; return message; + }, + fromAmino(object: CompressedExistenceProofAmino): CompressedExistenceProof { + const message = createBaseCompressedExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.leaf !== undefined && object.leaf !== null) { + message.leaf = LeafOp.fromAmino(object.leaf); + } + message.path = object.path?.map(e => e) || []; + return message; + }, + toAmino(message: CompressedExistenceProof): CompressedExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = []; + } + return obj; + }, + fromAminoMsg(object: CompressedExistenceProofAminoMsg): CompressedExistenceProof { + return CompressedExistenceProof.fromAmino(object.value); + }, + fromProtoMsg(message: CompressedExistenceProofProtoMsg): CompressedExistenceProof { + return CompressedExistenceProof.decode(message.value); + }, + toProto(message: CompressedExistenceProof): Uint8Array { + return CompressedExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedExistenceProof): CompressedExistenceProofProtoMsg { + return { + typeUrl: "/ics23.CompressedExistenceProof", + value: CompressedExistenceProof.encode(message).finish() + }; } - }; - function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { return { key: new Uint8Array(), @@ -1464,60 +1882,83 @@ function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { right: undefined }; } - export const CompressedNonExistenceProof = { - encode(message: CompressedNonExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ics23.CompressedNonExistenceProof", + encode(message: CompressedNonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.left !== undefined) { CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); } - if (message.right !== undefined) { CompressedExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CompressedNonExistenceProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CompressedNonExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCompressedNonExistenceProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: message.left = CompressedExistenceProof.decode(reader, reader.uint32()); break; - case 3: message.right = CompressedExistenceProof.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CompressedNonExistenceProof { + fromPartial(object: Partial): CompressedNonExistenceProof { const message = createBaseCompressedNonExistenceProof(); message.key = object.key ?? new Uint8Array(); message.left = object.left !== undefined && object.left !== null ? CompressedExistenceProof.fromPartial(object.left) : undefined; message.right = object.right !== undefined && object.right !== null ? CompressedExistenceProof.fromPartial(object.right) : undefined; return message; + }, + fromAmino(object: CompressedNonExistenceProofAmino): CompressedNonExistenceProof { + const message = createBaseCompressedNonExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.left !== undefined && object.left !== null) { + message.left = CompressedExistenceProof.fromAmino(object.left); + } + if (object.right !== undefined && object.right !== null) { + message.right = CompressedExistenceProof.fromAmino(object.right); + } + return message; + }, + toAmino(message: CompressedNonExistenceProof): CompressedNonExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.left = message.left ? CompressedExistenceProof.toAmino(message.left) : undefined; + obj.right = message.right ? CompressedExistenceProof.toAmino(message.right) : undefined; + return obj; + }, + fromAminoMsg(object: CompressedNonExistenceProofAminoMsg): CompressedNonExistenceProof { + return CompressedNonExistenceProof.fromAmino(object.value); + }, + fromProtoMsg(message: CompressedNonExistenceProofProtoMsg): CompressedNonExistenceProof { + return CompressedNonExistenceProof.decode(message.value); + }, + toProto(message: CompressedNonExistenceProof): Uint8Array { + return CompressedNonExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedNonExistenceProof): CompressedNonExistenceProofProtoMsg { + return { + typeUrl: "/ics23.CompressedNonExistenceProof", + value: CompressedNonExistenceProof.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/app/v1alpha1/config.ts b/src/codegen/cosmos/app/v1alpha1/config.ts index 75f465c..0c897a0 100644 --- a/src/codegen/cosmos/app/v1alpha1/config.ts +++ b/src/codegen/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,5 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * Config represents the configuration for a Cosmos SDK ABCI app. * It is intended that all state machine logic including the version of @@ -10,11 +9,14 @@ import { DeepPartial } from "../../../helpers"; * 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[]; } +export interface ConfigProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.Config"; + value: Uint8Array; +} /** * Config represents the configuration for a Cosmos SDK ABCI app. * It is intended that all state machine logic including the version of @@ -24,13 +26,27 @@ export interface Config { * that strive for the maximum ease of maintainability should be able to describe * their state machine with a config object alone. */ - -export interface ConfigSDKType { +export interface ConfigAmino { /** modules are the module configurations for the app. */ + modules?: ModuleConfigAmino[]; +} +export interface ConfigAminoMsg { + type: "cosmos-sdk/Config"; + value: ConfigAmino; +} +/** + * 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 ConfigSDKType { modules: ModuleConfigSDKType[]; } /** 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 @@ -49,12 +65,14 @@ export interface ModuleConfig { * 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; } +export interface ModuleConfigProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.ModuleConfig"; + value: Uint8Array; +} /** ModuleConfig is a module configuration for an app. */ - -export interface ModuleConfigSDKType { +export interface ModuleConfigAmino { /** * 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 @@ -67,111 +85,171 @@ export interface ModuleConfigSDKType { * 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; + 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?: AnyAmino; +} +export interface ModuleConfigAminoMsg { + type: "cosmos-sdk/ModuleConfig"; + value: ModuleConfigAmino; +} +/** ModuleConfig is a module configuration for an app. */ +export interface ModuleConfigSDKType { + name: string; config?: AnySDKType; } - function createBaseConfig(): Config { return { modules: [] }; } - export const Config = { - encode(message: Config, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.app.v1alpha1.Config", + encode(message: Config, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.modules) { ModuleConfig.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.modules.push(ModuleConfig.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Config { + fromPartial(object: Partial): Config { const message = createBaseConfig(); message.modules = object.modules?.map(e => ModuleConfig.fromPartial(e)) || []; return message; + }, + fromAmino(object: ConfigAmino): Config { + const message = createBaseConfig(); + message.modules = object.modules?.map(e => ModuleConfig.fromAmino(e)) || []; + return message; + }, + toAmino(message: Config): ConfigAmino { + const obj: any = {}; + if (message.modules) { + obj.modules = message.modules.map(e => e ? ModuleConfig.toAmino(e) : undefined); + } else { + obj.modules = []; + } + return obj; + }, + fromAminoMsg(object: ConfigAminoMsg): Config { + return Config.fromAmino(object.value); + }, + toAminoMsg(message: Config): ConfigAminoMsg { + return { + type: "cosmos-sdk/Config", + value: Config.toAmino(message) + }; + }, + fromProtoMsg(message: ConfigProtoMsg): Config { + return Config.decode(message.value); + }, + toProto(message: Config): Uint8Array { + return Config.encode(message).finish(); + }, + toProtoMsg(message: Config): ConfigProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.Config", + value: Config.encode(message).finish() + }; } - }; - function createBaseModuleConfig(): ModuleConfig { return { name: "", config: undefined }; } - export const ModuleConfig = { - encode(message: ModuleConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.app.v1alpha1.ModuleConfig", + encode(message: ModuleConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.config !== undefined) { Any.encode(message.config, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ModuleConfig { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - case 2: message.config = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModuleConfig { + fromPartial(object: Partial): ModuleConfig { const message = createBaseModuleConfig(); message.name = object.name ?? ""; message.config = object.config !== undefined && object.config !== null ? Any.fromPartial(object.config) : undefined; return message; + }, + fromAmino(object: ModuleConfigAmino): ModuleConfig { + const message = createBaseModuleConfig(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.config !== undefined && object.config !== null) { + message.config = Any.fromAmino(object.config); + } + return message; + }, + toAmino(message: ModuleConfig): ModuleConfigAmino { + const obj: any = {}; + obj.name = message.name; + obj.config = message.config ? Any.toAmino(message.config) : undefined; + return obj; + }, + fromAminoMsg(object: ModuleConfigAminoMsg): ModuleConfig { + return ModuleConfig.fromAmino(object.value); + }, + toAminoMsg(message: ModuleConfig): ModuleConfigAminoMsg { + return { + type: "cosmos-sdk/ModuleConfig", + value: ModuleConfig.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleConfigProtoMsg): ModuleConfig { + return ModuleConfig.decode(message.value); + }, + toProto(message: ModuleConfig): Uint8Array { + return ModuleConfig.encode(message).finish(); + }, + toProtoMsg(message: ModuleConfig): ModuleConfigProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.ModuleConfig", + value: ModuleConfig.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/app/v1alpha1/module.ts b/src/codegen/cosmos/app/v1alpha1/module.ts index 1a3ba2e..59de40e 100644 --- a/src/codegen/cosmos/app/v1alpha1/module.ts +++ b/src/codegen/cosmos/app/v1alpha1/module.ts @@ -1,7 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** ModuleDescriptor describes an app module. */ - export interface ModuleDescriptor { /** * go_import names the package that should be imported by an app to load the @@ -17,7 +15,6 @@ export interface ModuleDescriptor { * 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 @@ -28,12 +25,14 @@ export interface ModuleDescriptor { * 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[]; } +export interface ModuleDescriptorProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor"; + value: Uint8Array; +} /** ModuleDescriptor describes an app module. */ - -export interface ModuleDescriptorSDKType { +export interface ModuleDescriptorAmino { /** * go_import names the package that should be imported by an app to load the * module in the runtime module registry. Either go_import must be defined here @@ -41,15 +40,14 @@ export interface ModuleDescriptorSDKType { * to users where to location the module implementation. go_import takes * precedence over go_package when both are defined. */ - go_import: string; + go_import?: string; /** * use_package refers to a protobuf package that this module * uses and exposes to the world. In an app, only one module should "use" * or own a single protobuf package. It is assumed that the module uses * all of the .proto files in a single package. */ - - use_package: PackageReferenceSDKType[]; + use_package?: PackageReferenceAmino[]; /** * can_migrate_from defines which module versions this module can migrate * state from. The framework will check that one module version is able to @@ -59,11 +57,19 @@ export interface ModuleDescriptorSDKType { * declares it can migrate from v1, the framework knows how to migrate * from v1 to v3, assuming all 3 module versions are registered at runtime. */ - + can_migrate_from?: MigrateFromInfoAmino[]; +} +export interface ModuleDescriptorAminoMsg { + type: "cosmos-sdk/ModuleDescriptor"; + value: ModuleDescriptorAmino; +} +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptorSDKType { + go_import: string; + use_package: PackageReferenceSDKType[]; can_migrate_from: MigrateFromInfoSDKType[]; } /** 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; @@ -104,14 +110,16 @@ export interface PackageReference { * are important good client UX * * protobuf files are changed in backwards and forwards compatible ways */ - revision: number; } +export interface PackageReferenceProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.PackageReference"; + value: Uint8Array; +} /** PackageReference is a reference to a protobuf package used by a module. */ - -export interface PackageReferenceSDKType { +export interface PackageReferenceAmino { /** name is the fully-qualified name of the package. */ - name: string; + 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 @@ -149,14 +157,21 @@ export interface PackageReferenceSDKType { * are important good client UX * * protobuf files are changed in backwards and forwards compatible ways */ - + revision?: number; +} +export interface PackageReferenceAminoMsg { + type: "cosmos-sdk/PackageReference"; + value: PackageReferenceAmino; +} +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReferenceSDKType { + name: string; 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 @@ -164,19 +179,32 @@ export interface MigrateFromInfo { */ module: string; } +export interface MigrateFromInfoProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo"; + value: Uint8Array; +} /** * MigrateFromInfo is information on a module version that a newer module * can migrate from. */ - -export interface MigrateFromInfoSDKType { +export interface MigrateFromInfoAmino { /** * 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; +} +export interface MigrateFromInfoAminoMsg { + type: "cosmos-sdk/MigrateFromInfo"; + value: MigrateFromInfoAmino; +} +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfoSDKType { module: string; } - function createBaseModuleDescriptor(): ModuleDescriptor { return { goImport: "", @@ -184,160 +212,243 @@ function createBaseModuleDescriptor(): ModuleDescriptor { canMigrateFrom: [] }; } - export const ModuleDescriptor = { - encode(message: ModuleDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor", + encode(message: ModuleDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.goImport !== "") { writer.uint32(10).string(message.goImport); } - for (const v of message.usePackage) { PackageReference.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.canMigrateFrom) { MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.goImport = reader.string(); break; - case 2: message.usePackage.push(PackageReference.decode(reader, reader.uint32())); break; - case 3: message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModuleDescriptor { + fromPartial(object: Partial): 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; + }, + fromAmino(object: ModuleDescriptorAmino): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + if (object.go_import !== undefined && object.go_import !== null) { + message.goImport = object.go_import; + } + message.usePackage = object.use_package?.map(e => PackageReference.fromAmino(e)) || []; + message.canMigrateFrom = object.can_migrate_from?.map(e => MigrateFromInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { + const obj: any = {}; + obj.go_import = message.goImport; + if (message.usePackage) { + obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); + } else { + obj.use_package = []; + } + if (message.canMigrateFrom) { + obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e) : undefined); + } else { + obj.can_migrate_from = []; + } + return obj; + }, + fromAminoMsg(object: ModuleDescriptorAminoMsg): ModuleDescriptor { + return ModuleDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: ModuleDescriptor): ModuleDescriptorAminoMsg { + return { + type: "cosmos-sdk/ModuleDescriptor", + value: ModuleDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleDescriptorProtoMsg): ModuleDescriptor { + return ModuleDescriptor.decode(message.value); + }, + toProto(message: ModuleDescriptor): Uint8Array { + return ModuleDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ModuleDescriptor): ModuleDescriptorProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor", + value: ModuleDescriptor.encode(message).finish() + }; } - }; - function createBasePackageReference(): PackageReference { return { name: "", revision: 0 }; } - export const PackageReference = { - encode(message: PackageReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.app.v1alpha1.PackageReference", + encode(message: PackageReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.revision !== 0) { writer.uint32(16).uint32(message.revision); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - case 2: message.revision = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PackageReference { + fromPartial(object: Partial): PackageReference { const message = createBasePackageReference(); message.name = object.name ?? ""; message.revision = object.revision ?? 0; return message; + }, + fromAmino(object: PackageReferenceAmino): PackageReference { + const message = createBasePackageReference(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.revision !== undefined && object.revision !== null) { + message.revision = object.revision; + } + return message; + }, + toAmino(message: PackageReference): PackageReferenceAmino { + const obj: any = {}; + obj.name = message.name; + obj.revision = message.revision; + return obj; + }, + fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { + return PackageReference.fromAmino(object.value); + }, + toAminoMsg(message: PackageReference): PackageReferenceAminoMsg { + return { + type: "cosmos-sdk/PackageReference", + value: PackageReference.toAmino(message) + }; + }, + fromProtoMsg(message: PackageReferenceProtoMsg): PackageReference { + return PackageReference.decode(message.value); + }, + toProto(message: PackageReference): Uint8Array { + return PackageReference.encode(message).finish(); + }, + toProtoMsg(message: PackageReference): PackageReferenceProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.PackageReference", + value: PackageReference.encode(message).finish() + }; } - }; - function createBaseMigrateFromInfo(): MigrateFromInfo { return { module: "" }; } - export const MigrateFromInfo = { - encode(message: MigrateFromInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo", + encode(message: MigrateFromInfo, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.module = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MigrateFromInfo { + fromPartial(object: Partial): MigrateFromInfo { const message = createBaseMigrateFromInfo(); message.module = object.module ?? ""; return message; + }, + fromAmino(object: MigrateFromInfoAmino): MigrateFromInfo { + const message = createBaseMigrateFromInfo(); + if (object.module !== undefined && object.module !== null) { + message.module = object.module; + } + return message; + }, + toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { + const obj: any = {}; + obj.module = message.module; + return obj; + }, + fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { + return MigrateFromInfo.fromAmino(object.value); + }, + toAminoMsg(message: MigrateFromInfo): MigrateFromInfoAminoMsg { + return { + type: "cosmos-sdk/MigrateFromInfo", + value: MigrateFromInfo.toAmino(message) + }; + }, + fromProtoMsg(message: MigrateFromInfoProtoMsg): MigrateFromInfo { + return MigrateFromInfo.decode(message.value); + }, + toProto(message: MigrateFromInfo): Uint8Array { + return MigrateFromInfo.encode(message).finish(); + }, + toProtoMsg(message: MigrateFromInfo): MigrateFromInfoProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo", + value: MigrateFromInfo.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/app/v1alpha1/query.rpc.Query.ts b/src/codegen/cosmos/app/v1alpha1/query.rpc.Query.ts index 9ae7ca7..7aaf409 100644 --- a/src/codegen/cosmos/app/v1alpha1/query.rpc.Query.ts +++ b/src/codegen/cosmos/app/v1alpha1/query.rpc.Query.ts @@ -1,27 +1,23 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryConfigRequest, QueryConfigResponse } from "./query"; /** Query is the app module query service. */ - export interface Query { /** Config returns the current app config. */ config(request?: QueryConfigRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.config = this.config.bind(this); } - config(request: QueryConfigRequest = {}): Promise { const data = QueryConfigRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.app.v1alpha1.Query", "Config", data); - return promise.then(data => QueryConfigResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryConfigResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -30,6 +26,5 @@ export const createRpcQueryExtension = (base: QueryClient) => { config(request?: QueryConfigRequest): Promise { return queryService.config(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/app/v1alpha1/query.ts b/src/codegen/cosmos/app/v1alpha1/query.ts index 837b4ab..5c8c04f 100644 --- a/src/codegen/cosmos/app/v1alpha1/query.ts +++ b/src/codegen/cosmos/app/v1alpha1/query.ts @@ -1,100 +1,163 @@ -import { Config, ConfigSDKType } from "./config"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Config, ConfigAmino, ConfigSDKType } from "./config"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryConfigRequest is the Query/Config request type. */ - export interface QueryConfigRequest {} +export interface QueryConfigRequestProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.QueryConfigRequest"; + value: Uint8Array; +} +/** QueryConfigRequest is the Query/Config request type. */ +export interface QueryConfigRequestAmino {} +export interface QueryConfigRequestAminoMsg { + type: "cosmos-sdk/QueryConfigRequest"; + value: QueryConfigRequestAmino; +} /** QueryConfigRequest is the Query/Config request type. */ - export interface QueryConfigRequestSDKType {} /** QueryConfigRequest is the Query/Config response type. */ - export interface QueryConfigResponse { /** config is the current app config. */ config?: Config; } +export interface QueryConfigResponseProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.QueryConfigResponse"; + value: Uint8Array; +} /** QueryConfigRequest is the Query/Config response type. */ - -export interface QueryConfigResponseSDKType { +export interface QueryConfigResponseAmino { /** config is the current app config. */ + config?: ConfigAmino; +} +export interface QueryConfigResponseAminoMsg { + type: "cosmos-sdk/QueryConfigResponse"; + value: QueryConfigResponseAmino; +} +/** QueryConfigRequest is the Query/Config response type. */ +export interface QueryConfigResponseSDKType { config?: ConfigSDKType; } - function createBaseQueryConfigRequest(): QueryConfigRequest { return {}; } - export const QueryConfigRequest = { - encode(_: QueryConfigRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.app.v1alpha1.QueryConfigRequest", + encode(_: QueryConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConfigRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryConfigRequest { + fromPartial(_: Partial): QueryConfigRequest { const message = createBaseQueryConfigRequest(); return message; + }, + fromAmino(_: QueryConfigRequestAmino): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + return message; + }, + toAmino(_: QueryConfigRequest): QueryConfigRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryConfigRequestAminoMsg): QueryConfigRequest { + return QueryConfigRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConfigRequest): QueryConfigRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConfigRequest", + value: QueryConfigRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConfigRequestProtoMsg): QueryConfigRequest { + return QueryConfigRequest.decode(message.value); + }, + toProto(message: QueryConfigRequest): Uint8Array { + return QueryConfigRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConfigRequest): QueryConfigRequestProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.QueryConfigRequest", + value: QueryConfigRequest.encode(message).finish() + }; } - }; - function createBaseQueryConfigResponse(): QueryConfigResponse { return { config: undefined }; } - export const QueryConfigResponse = { - encode(message: QueryConfigResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.app.v1alpha1.QueryConfigResponse", + encode(message: QueryConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.config !== undefined) { Config.encode(message.config, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConfigResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.config = Config.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConfigResponse { + fromPartial(object: Partial): QueryConfigResponse { const message = createBaseQueryConfigResponse(); message.config = object.config !== undefined && object.config !== null ? Config.fromPartial(object.config) : undefined; return message; + }, + fromAmino(object: QueryConfigResponseAmino): QueryConfigResponse { + const message = createBaseQueryConfigResponse(); + if (object.config !== undefined && object.config !== null) { + message.config = Config.fromAmino(object.config); + } + return message; + }, + toAmino(message: QueryConfigResponse): QueryConfigResponseAmino { + const obj: any = {}; + obj.config = message.config ? Config.toAmino(message.config) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConfigResponseAminoMsg): QueryConfigResponse { + return QueryConfigResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConfigResponse): QueryConfigResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConfigResponse", + value: QueryConfigResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConfigResponseProtoMsg): QueryConfigResponse { + return QueryConfigResponse.decode(message.value); + }, + toProto(message: QueryConfigResponse): Uint8Array { + return QueryConfigResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConfigResponse): QueryConfigResponseProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.QueryConfigResponse", + value: QueryConfigResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/auth/v1beta1/auth.ts b/src/codegen/cosmos/auth/v1beta1/auth.ts index 31bd19a..f79aee1 100644 --- a/src/codegen/cosmos/auth/v1beta1/auth.ts +++ b/src/codegen/cosmos/auth/v1beta1/auth.ts @@ -1,138 +1,209 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * BaseAccount defines a base account type. It contains all the necessary fields * for basic account functionality. Any custom account type should extend this * type for additional functionality (e.g. vesting). */ - export interface BaseAccount { address: string; pubKey?: Any; - accountNumber: Long; - sequence: Long; + accountNumber: bigint; + sequence: bigint; +} +export interface BaseAccountProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount"; + value: Uint8Array; +} +/** + * BaseAccount defines a base account type. It contains all the necessary fields + * for basic account functionality. Any custom account type should extend this + * type for additional functionality (e.g. vesting). + */ +export interface BaseAccountAmino { + address?: string; + pub_key?: AnyAmino; + account_number?: string; + sequence?: string; +} +export interface BaseAccountAminoMsg { + type: "cosmos-sdk/BaseAccount"; + value: BaseAccountAmino; } /** * 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 BaseAccountSDKType { address: string; pub_key?: AnySDKType; - account_number: Long; - sequence: Long; + account_number: bigint; + sequence: bigint; } /** ModuleAccount defines an account for modules that holds coins on a pool. */ - export interface ModuleAccount { baseAccount?: BaseAccount; name: string; permissions: string[]; } +export interface ModuleAccountProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount"; + value: Uint8Array; +} +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccountAmino { + base_account?: BaseAccountAmino; + name?: string; + permissions?: string[]; +} +export interface ModuleAccountAminoMsg { + type: "cosmos-sdk/ModuleAccount"; + value: ModuleAccountAmino; +} /** ModuleAccount defines an account for modules that holds coins on a pool. */ - export interface ModuleAccountSDKType { base_account?: BaseAccountSDKType; name: string; permissions: string[]; } /** Params defines the parameters for the auth module. */ - export interface Params { - maxMemoCharacters: Long; - txSigLimit: Long; - txSizeCostPerByte: Long; - sigVerifyCostEd25519: Long; - sigVerifyCostSecp256k1: Long; + maxMemoCharacters: bigint; + txSigLimit: bigint; + txSizeCostPerByte: bigint; + sigVerifyCostEd25519: bigint; + sigVerifyCostSecp256k1: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the auth module. */ +export interface ParamsAmino { + max_memo_characters?: string; + tx_sig_limit?: string; + tx_size_cost_per_byte?: string; + sig_verify_cost_ed25519?: string; + sig_verify_cost_secp256k1?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; } /** Params defines the parameters for the auth module. */ - export interface ParamsSDKType { - max_memo_characters: Long; - tx_sig_limit: Long; - tx_size_cost_per_byte: Long; - sig_verify_cost_ed25519: Long; - sig_verify_cost_secp256k1: Long; + max_memo_characters: bigint; + tx_sig_limit: bigint; + tx_size_cost_per_byte: bigint; + sig_verify_cost_ed25519: bigint; + sig_verify_cost_secp256k1: bigint; } - function createBaseBaseAccount(): BaseAccount { return { address: "", pubKey: undefined, - accountNumber: Long.UZERO, - sequence: Long.UZERO + accountNumber: BigInt(0), + sequence: BigInt(0) }; } - export const BaseAccount = { - encode(message: BaseAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount", + encode(message: BaseAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.pubKey !== undefined) { Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); } - - if (!message.accountNumber.isZero()) { + if (message.accountNumber !== BigInt(0)) { writer.uint32(24).uint64(message.accountNumber); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(32).uint64(message.sequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BaseAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBaseAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.pubKey = Any.decode(reader, reader.uint32()); break; - case 3: - message.accountNumber = (reader.uint64() as Long); + message.accountNumber = reader.uint64(); break; - case 4: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BaseAccount { + fromPartial(object: Partial): BaseAccount { const message = createBaseBaseAccount(); message.address = object.address ?? ""; message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? Any.fromPartial(object.pubKey) : undefined; - message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? Long.fromValue(object.accountNumber) : Long.UZERO; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BaseAccountAmino): BaseAccount { + const message = createBaseBaseAccount(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = Any.fromAmino(object.pub_key); + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } return message; + }, + toAmino(message: BaseAccount): BaseAccountAmino { + const obj: any = {}; + obj.address = message.address; + obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; + obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { + return BaseAccount.fromAmino(object.value); + }, + toAminoMsg(message: BaseAccount): BaseAccountAminoMsg { + return { + type: "cosmos-sdk/BaseAccount", + value: BaseAccount.toAmino(message) + }; + }, + fromProtoMsg(message: BaseAccountProtoMsg): BaseAccount { + return BaseAccount.decode(message.value); + }, + toProto(message: BaseAccount): Uint8Array { + return BaseAccount.encode(message).finish(); + }, + toProtoMsg(message: BaseAccount): BaseAccountProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount", + value: BaseAccount.encode(message).finish() + }; } - }; - function createBaseModuleAccount(): ModuleAccount { return { baseAccount: undefined, @@ -140,145 +211,208 @@ function createBaseModuleAccount(): ModuleAccount { permissions: [] }; } - export const ModuleAccount = { - encode(message: ModuleAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", + encode(message: ModuleAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseAccount !== undefined) { BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); } - if (message.name !== "") { writer.uint32(18).string(message.name); } - for (const v of message.permissions) { writer.uint32(26).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ModuleAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModuleAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.baseAccount = BaseAccount.decode(reader, reader.uint32()); break; - case 2: message.name = reader.string(); break; - case 3: message.permissions.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModuleAccount { + fromPartial(object: Partial): ModuleAccount { const message = createBaseModuleAccount(); message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; message.name = object.name ?? ""; message.permissions = object.permissions?.map(e => e) || []; return message; + }, + fromAmino(object: ModuleAccountAmino): ModuleAccount { + const message = createBaseModuleAccount(); + if (object.base_account !== undefined && object.base_account !== null) { + message.baseAccount = BaseAccount.fromAmino(object.base_account); + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.permissions = object.permissions?.map(e => e) || []; + return message; + }, + toAmino(message: ModuleAccount): ModuleAccountAmino { + const obj: any = {}; + obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; + obj.name = message.name; + if (message.permissions) { + obj.permissions = message.permissions.map(e => e); + } else { + obj.permissions = []; + } + return obj; + }, + fromAminoMsg(object: ModuleAccountAminoMsg): ModuleAccount { + return ModuleAccount.fromAmino(object.value); + }, + toAminoMsg(message: ModuleAccount): ModuleAccountAminoMsg { + return { + type: "cosmos-sdk/ModuleAccount", + value: ModuleAccount.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleAccountProtoMsg): ModuleAccount { + return ModuleAccount.decode(message.value); + }, + toProto(message: ModuleAccount): Uint8Array { + return ModuleAccount.encode(message).finish(); + }, + toProtoMsg(message: ModuleAccount): ModuleAccountProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", + value: ModuleAccount.encode(message).finish() + }; } - }; - function createBaseParams(): Params { return { - maxMemoCharacters: Long.UZERO, - txSigLimit: Long.UZERO, - txSizeCostPerByte: Long.UZERO, - sigVerifyCostEd25519: Long.UZERO, - sigVerifyCostSecp256k1: Long.UZERO + maxMemoCharacters: BigInt(0), + txSigLimit: BigInt(0), + txSizeCostPerByte: BigInt(0), + sigVerifyCostEd25519: BigInt(0), + sigVerifyCostSecp256k1: BigInt(0) }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.maxMemoCharacters.isZero()) { + typeUrl: "/cosmos.auth.v1beta1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxMemoCharacters !== BigInt(0)) { writer.uint32(8).uint64(message.maxMemoCharacters); } - - if (!message.txSigLimit.isZero()) { + if (message.txSigLimit !== BigInt(0)) { writer.uint32(16).uint64(message.txSigLimit); } - - if (!message.txSizeCostPerByte.isZero()) { + if (message.txSizeCostPerByte !== BigInt(0)) { writer.uint32(24).uint64(message.txSizeCostPerByte); } - - if (!message.sigVerifyCostEd25519.isZero()) { + if (message.sigVerifyCostEd25519 !== BigInt(0)) { writer.uint32(32).uint64(message.sigVerifyCostEd25519); } - - if (!message.sigVerifyCostSecp256k1.isZero()) { + if (message.sigVerifyCostSecp256k1 !== BigInt(0)) { writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.maxMemoCharacters = (reader.uint64() as Long); + message.maxMemoCharacters = reader.uint64(); break; - case 2: - message.txSigLimit = (reader.uint64() as Long); + message.txSigLimit = reader.uint64(); break; - case 3: - message.txSizeCostPerByte = (reader.uint64() as Long); + message.txSizeCostPerByte = reader.uint64(); break; - case 4: - message.sigVerifyCostEd25519 = (reader.uint64() as Long); + message.sigVerifyCostEd25519 = reader.uint64(); break; - case 5: - message.sigVerifyCostSecp256k1 = (reader.uint64() as Long); + message.sigVerifyCostSecp256k1 = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); - message.maxMemoCharacters = object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null ? Long.fromValue(object.maxMemoCharacters) : Long.UZERO; - message.txSigLimit = object.txSigLimit !== undefined && object.txSigLimit !== null ? Long.fromValue(object.txSigLimit) : Long.UZERO; - message.txSizeCostPerByte = object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null ? Long.fromValue(object.txSizeCostPerByte) : Long.UZERO; - message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null ? Long.fromValue(object.sigVerifyCostEd25519) : Long.UZERO; - message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null ? Long.fromValue(object.sigVerifyCostSecp256k1) : Long.UZERO; + message.maxMemoCharacters = object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null ? BigInt(object.maxMemoCharacters.toString()) : BigInt(0); + message.txSigLimit = object.txSigLimit !== undefined && object.txSigLimit !== null ? BigInt(object.txSigLimit.toString()) : BigInt(0); + message.txSizeCostPerByte = object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null ? BigInt(object.txSizeCostPerByte.toString()) : BigInt(0); + message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null ? BigInt(object.sigVerifyCostEd25519.toString()) : BigInt(0); + message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null ? BigInt(object.sigVerifyCostSecp256k1.toString()) : BigInt(0); return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.max_memo_characters !== undefined && object.max_memo_characters !== null) { + message.maxMemoCharacters = BigInt(object.max_memo_characters); + } + if (object.tx_sig_limit !== undefined && object.tx_sig_limit !== null) { + message.txSigLimit = BigInt(object.tx_sig_limit); + } + if (object.tx_size_cost_per_byte !== undefined && object.tx_size_cost_per_byte !== null) { + message.txSizeCostPerByte = BigInt(object.tx_size_cost_per_byte); + } + if (object.sig_verify_cost_ed25519 !== undefined && object.sig_verify_cost_ed25519 !== null) { + message.sigVerifyCostEd25519 = BigInt(object.sig_verify_cost_ed25519); + } + if (object.sig_verify_cost_secp256k1 !== undefined && object.sig_verify_cost_secp256k1 !== null) { + message.sigVerifyCostSecp256k1 = BigInt(object.sig_verify_cost_secp256k1); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Params", + value: Params.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/auth/v1beta1/genesis.ts b/src/codegen/cosmos/auth/v1beta1/genesis.ts index 666632a..bac278f 100644 --- a/src/codegen/cosmos/auth/v1beta1/genesis.ts +++ b/src/codegen/cosmos/auth/v1beta1/genesis.ts @@ -1,77 +1,113 @@ -import { Params, ParamsSDKType } from "./auth"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Params, ParamsAmino, ParamsSDKType } from "./auth"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the auth module's genesis state. */ - export interface GenesisState { /** params defines all the paramaters of the module. */ - params?: Params; + params: Params; /** accounts are the accounts present at genesis. */ - accounts: Any[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the auth module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** params defines all the paramaters of the module. */ - params?: ParamsSDKType; + params?: ParamsAmino; /** accounts are the accounts present at genesis. */ - + accounts?: AnyAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the auth module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; accounts: AnySDKType[]; } - function createBaseGenesisState(): GenesisState { return { - params: undefined, + params: Params.fromPartial({}), accounts: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - for (const v of message.accounts) { Any.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.params = Params.decode(reader, reader.uint32()); break; - case 2: message.accounts.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): 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; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.accounts = object.accounts?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.accounts = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/auth/v1beta1/query.lcd.ts b/src/codegen/cosmos/auth/v1beta1/query.lcd.ts index 83fdf31..ba13b88 100644 --- a/src/codegen/cosmos/auth/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/auth/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryAccountsRequest, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -21,63 +20,46 @@ export class LCDQueryClient { /* Accounts returns all the existing accounts Since: cosmos-sdk 0.43 */ - - async accounts(params: QueryAccountsRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/auth/v1beta1/accounts`; return await this.req.get(endpoint, options); } /* Account returns account details based on address. */ - - async account(params: QueryAccountRequest): Promise { const endpoint = `cosmos/auth/v1beta1/accounts/${params.address}`; return await this.req.get(endpoint); } /* Params queries all parameters. */ - - async params(_params: QueryParamsRequest = {}): Promise { const endpoint = `cosmos/auth/v1beta1/params`; return await this.req.get(endpoint); } /* ModuleAccounts returns all the existing module accounts. */ - - async moduleAccounts(_params: QueryModuleAccountsRequest = {}): Promise { const endpoint = `cosmos/auth/v1beta1/module_accounts`; return await this.req.get(endpoint); } /* Bech32 queries bech32Prefix */ - - async bech32Prefix(_params: Bech32PrefixRequest = {}): Promise { const endpoint = `cosmos/auth/v1beta1/bech32`; return await this.req.get(endpoint); } /* AddressBytesToString converts Account Address bytes to string */ - - async addressBytesToString(params: AddressBytesToStringRequest): Promise { const endpoint = `cosmos/auth/v1beta1/bech32/${params.addressBytes}`; return await this.req.get(endpoint); } /* AddressStringToBytes converts Address string to bytes */ - - async addressStringToBytes(params: AddressStringToBytesRequest): Promise { const endpoint = `cosmos/auth/v1beta1/bech32/${params.addressString}`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/auth/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/auth/v1beta1/query.rpc.Query.ts index bd0c78f..8b086c9 100644 --- a/src/codegen/cosmos/auth/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/auth/v1beta1/query.rpc.Query.ts @@ -1,9 +1,8 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** * Accounts returns all the existing accounts @@ -12,27 +11,20 @@ export interface Query { */ accounts(request?: QueryAccountsRequest): Promise; /** Account returns account details based on address. */ - account(request: QueryAccountRequest): Promise; /** Params queries all parameters. */ - params(request?: QueryParamsRequest): Promise; /** ModuleAccounts returns all the existing module accounts. */ - moduleAccounts(request?: QueryModuleAccountsRequest): Promise; /** Bech32 queries bech32Prefix */ - bech32Prefix(request?: Bech32PrefixRequest): Promise; /** AddressBytesToString converts Account Address bytes to string */ - addressBytesToString(request: AddressBytesToStringRequest): Promise; /** AddressStringToBytes converts Address string to bytes */ - addressStringToBytes(request: AddressStringToBytesRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.accounts = this.accounts.bind(this); @@ -43,51 +35,43 @@ export class QueryClientImpl implements Query { this.addressBytesToString = this.addressBytesToString.bind(this); this.addressStringToBytes = this.addressStringToBytes.bind(this); } - accounts(request: QueryAccountsRequest = { pagination: undefined }): Promise { const data = QueryAccountsRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Accounts", data); - return promise.then(data => QueryAccountsResponse.decode(new _m0.Reader(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("cosmos.auth.v1beta1.Query", "Account", data); - return promise.then(data => QueryAccountResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAccountResponse.decode(new BinaryReader(data))); } - params(request: QueryParamsRequest = {}): Promise { const data = QueryParamsRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(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("cosmos.auth.v1beta1.Query", "ModuleAccounts", data); - return promise.then(data => QueryModuleAccountsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryModuleAccountsResponse.decode(new BinaryReader(data))); } - bech32Prefix(request: Bech32PrefixRequest = {}): Promise { const data = Bech32PrefixRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Bech32Prefix", data); - return promise.then(data => Bech32PrefixResponse.decode(new _m0.Reader(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("cosmos.auth.v1beta1.Query", "AddressBytesToString", data); - return promise.then(data => AddressBytesToStringResponse.decode(new _m0.Reader(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("cosmos.auth.v1beta1.Query", "AddressStringToBytes", data); - return promise.then(data => AddressStringToBytesResponse.decode(new _m0.Reader(data))); + return promise.then(data => AddressStringToBytesResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -96,30 +80,23 @@ export const createRpcQueryExtension = (base: QueryClient) => { accounts(request?: QueryAccountsRequest): Promise { return queryService.accounts(request); }, - account(request: QueryAccountRequest): Promise { return queryService.account(request); }, - params(request?: QueryParamsRequest): Promise { return queryService.params(request); }, - moduleAccounts(request?: QueryModuleAccountsRequest): Promise { return queryService.moduleAccounts(request); }, - bech32Prefix(request?: Bech32PrefixRequest): Promise { return queryService.bech32Prefix(request); }, - addressBytesToString(request: AddressBytesToStringRequest): Promise { return queryService.addressBytesToString(request); }, - addressStringToBytes(request: AddressStringToBytesRequest): Promise { return queryService.addressStringToBytes(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/auth/v1beta1/query.ts b/src/codegen/cosmos/auth/v1beta1/query.ts index f06069e..400e4c8 100644 --- a/src/codegen/cosmos/auth/v1beta1/query.ts +++ b/src/codegen/cosmos/auth/v1beta1/query.ts @@ -1,26 +1,40 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Params, ParamsSDKType } from "./auth"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Params, ParamsAmino, ParamsSDKType } from "./auth"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. * * Since: cosmos-sdk 0.43 */ - export interface QueryAccountsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryAccountsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest"; + value: Uint8Array; +} /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. * * Since: cosmos-sdk 0.43 */ - -export interface QueryAccountsRequestSDKType { +export interface QueryAccountsRequestAmino { /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAccountsRequestAminoMsg { + type: "cosmos-sdk/QueryAccountsRequest"; + value: QueryAccountsRequestAmino; +} +/** + * QueryAccountsRequest is the request type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsRequestSDKType { pagination?: PageRequestSDKType; } /** @@ -28,745 +42,1208 @@ export interface QueryAccountsRequestSDKType { * * Since: cosmos-sdk 0.43 */ - export interface QueryAccountsResponse { /** accounts are the existing accounts */ accounts: Any[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryAccountsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse"; + value: Uint8Array; +} /** * QueryAccountsResponse is the response type for the Query/Accounts RPC method. * * Since: cosmos-sdk 0.43 */ - -export interface QueryAccountsResponseSDKType { +export interface QueryAccountsResponseAmino { /** accounts are the existing accounts */ - accounts: AnySDKType[]; + accounts?: AnyAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryAccountsResponseAminoMsg { + type: "cosmos-sdk/QueryAccountsResponse"; + value: QueryAccountsResponseAmino; +} +/** + * QueryAccountsResponse is the response type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsResponseSDKType { + accounts: AnySDKType[]; pagination?: PageResponseSDKType; } /** QueryAccountRequest is the request type for the Query/Account RPC method. */ - export interface QueryAccountRequest { /** address defines the address to query for. */ address: string; } +export interface QueryAccountRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest"; + value: Uint8Array; +} /** QueryAccountRequest is the request type for the Query/Account RPC method. */ - -export interface QueryAccountRequestSDKType { +export interface QueryAccountRequestAmino { /** address defines the address to query for. */ + address?: string; +} +export interface QueryAccountRequestAminoMsg { + type: "cosmos-sdk/QueryAccountRequest"; + value: QueryAccountRequestAmino; +} +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequestSDKType { address: string; } /** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */ - export interface QueryModuleAccountsRequest {} +export interface QueryModuleAccountsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest"; + value: Uint8Array; +} +/** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */ +export interface QueryModuleAccountsRequestAmino {} +export interface QueryModuleAccountsRequestAminoMsg { + type: "cosmos-sdk/QueryModuleAccountsRequest"; + value: QueryModuleAccountsRequestAmino; +} /** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */ - export interface QueryModuleAccountsRequestSDKType {} /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** params defines the parameters of the module. */ - params?: Params; + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse"; + value: Uint8Array; } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** params defines the parameters of the module. */ - params?: ParamsSDKType; + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; } /** QueryAccountResponse is the response type for the Query/Account RPC method. */ - export interface QueryAccountResponse { /** account defines the account of the corresponding address. */ account?: Any; } +export interface QueryAccountResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse"; + value: Uint8Array; +} /** QueryAccountResponse is the response type for the Query/Account RPC method. */ - -export interface QueryAccountResponseSDKType { +export interface QueryAccountResponseAmino { /** account defines the account of the corresponding address. */ + account?: AnyAmino; +} +export interface QueryAccountResponseAminoMsg { + type: "cosmos-sdk/QueryAccountResponse"; + value: QueryAccountResponseAmino; +} +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponseSDKType { account?: AnySDKType; } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - export interface QueryParamsRequestSDKType {} /** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */ - export interface QueryModuleAccountsResponse { accounts: Any[]; } +export interface QueryModuleAccountsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse"; + value: Uint8Array; +} +/** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */ +export interface QueryModuleAccountsResponseAmino { + accounts?: AnyAmino[]; +} +export interface QueryModuleAccountsResponseAminoMsg { + type: "cosmos-sdk/QueryModuleAccountsResponse"; + value: QueryModuleAccountsResponseAmino; +} /** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */ - export interface QueryModuleAccountsResponseSDKType { accounts: AnySDKType[]; } /** Bech32PrefixRequest is the request type for Bech32Prefix rpc method */ - export interface Bech32PrefixRequest {} +export interface Bech32PrefixRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest"; + value: Uint8Array; +} +/** Bech32PrefixRequest is the request type for Bech32Prefix rpc method */ +export interface Bech32PrefixRequestAmino {} +export interface Bech32PrefixRequestAminoMsg { + type: "cosmos-sdk/Bech32PrefixRequest"; + value: Bech32PrefixRequestAmino; +} /** Bech32PrefixRequest is the request type for Bech32Prefix rpc method */ - export interface Bech32PrefixRequestSDKType {} /** Bech32PrefixResponse is the response type for Bech32Prefix rpc method */ - export interface Bech32PrefixResponse { bech32Prefix: string; } +export interface Bech32PrefixResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse"; + value: Uint8Array; +} +/** Bech32PrefixResponse is the response type for Bech32Prefix rpc method */ +export interface Bech32PrefixResponseAmino { + bech32_prefix?: string; +} +export interface Bech32PrefixResponseAminoMsg { + type: "cosmos-sdk/Bech32PrefixResponse"; + value: Bech32PrefixResponseAmino; +} /** Bech32PrefixResponse is the response type for Bech32Prefix rpc method */ - export interface Bech32PrefixResponseSDKType { bech32_prefix: string; } /** AddressBytesToStringRequest is the request type for AddressString rpc method */ - export interface AddressBytesToStringRequest { addressBytes: Uint8Array; } +export interface AddressBytesToStringRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest"; + value: Uint8Array; +} +/** AddressBytesToStringRequest is the request type for AddressString rpc method */ +export interface AddressBytesToStringRequestAmino { + address_bytes?: string; +} +export interface AddressBytesToStringRequestAminoMsg { + type: "cosmos-sdk/AddressBytesToStringRequest"; + value: AddressBytesToStringRequestAmino; +} /** AddressBytesToStringRequest is the request type for AddressString rpc method */ - export interface AddressBytesToStringRequestSDKType { address_bytes: Uint8Array; } /** AddressBytesToStringResponse is the response type for AddressString rpc method */ - export interface AddressBytesToStringResponse { addressString: string; } +export interface AddressBytesToStringResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse"; + value: Uint8Array; +} +/** AddressBytesToStringResponse is the response type for AddressString rpc method */ +export interface AddressBytesToStringResponseAmino { + address_string?: string; +} +export interface AddressBytesToStringResponseAminoMsg { + type: "cosmos-sdk/AddressBytesToStringResponse"; + value: AddressBytesToStringResponseAmino; +} /** AddressBytesToStringResponse is the response type for AddressString rpc method */ - export interface AddressBytesToStringResponseSDKType { address_string: string; } /** AddressStringToBytesRequest is the request type for AccountBytes rpc method */ - export interface AddressStringToBytesRequest { addressString: string; } +export interface AddressStringToBytesRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest"; + value: Uint8Array; +} +/** AddressStringToBytesRequest is the request type for AccountBytes rpc method */ +export interface AddressStringToBytesRequestAmino { + address_string?: string; +} +export interface AddressStringToBytesRequestAminoMsg { + type: "cosmos-sdk/AddressStringToBytesRequest"; + value: AddressStringToBytesRequestAmino; +} /** AddressStringToBytesRequest is the request type for AccountBytes rpc method */ - export interface AddressStringToBytesRequestSDKType { address_string: string; } /** AddressStringToBytesResponse is the response type for AddressBytes rpc method */ - export interface AddressStringToBytesResponse { addressBytes: Uint8Array; } +export interface AddressStringToBytesResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse"; + value: Uint8Array; +} +/** AddressStringToBytesResponse is the response type for AddressBytes rpc method */ +export interface AddressStringToBytesResponseAmino { + address_bytes?: string; +} +export interface AddressStringToBytesResponseAminoMsg { + type: "cosmos-sdk/AddressStringToBytesResponse"; + value: AddressStringToBytesResponseAmino; +} /** AddressStringToBytesResponse is the response type for AddressBytes rpc method */ - export interface AddressStringToBytesResponseSDKType { address_bytes: Uint8Array; } - function createBaseQueryAccountsRequest(): QueryAccountsRequest { return { pagination: undefined }; } - export const QueryAccountsRequest = { - encode(message: QueryAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", + encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAccountsRequest { + fromPartial(object: Partial): QueryAccountsRequest { const message = createBaseQueryAccountsRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryAccountsRequestAmino): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountsRequestAminoMsg): QueryAccountsRequest { + return QueryAccountsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountsRequest): QueryAccountsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountsRequest", + value: QueryAccountsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountsRequestProtoMsg): QueryAccountsRequest { + return QueryAccountsRequest.decode(message.value); + }, + toProto(message: QueryAccountsRequest): Uint8Array { + return QueryAccountsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountsRequest): QueryAccountsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", + value: QueryAccountsRequest.encode(message).finish() + }; } - }; - function createBaseQueryAccountsResponse(): QueryAccountsResponse { return { accounts: [], pagination: undefined }; } - export const QueryAccountsResponse = { - encode(message: QueryAccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", + encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAccountsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.accounts.push(Any.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAccountsResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryAccountsResponseAmino): QueryAccountsResponse { + const message = createBaseQueryAccountsResponse(); + message.accounts = object.accounts?.map(e => Any.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAccountsResponse): QueryAccountsResponseAmino { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.accounts = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountsResponseAminoMsg): QueryAccountsResponse { + return QueryAccountsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountsResponse): QueryAccountsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountsResponse", + value: QueryAccountsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountsResponseProtoMsg): QueryAccountsResponse { + return QueryAccountsResponse.decode(message.value); + }, + toProto(message: QueryAccountsResponse): Uint8Array { + return QueryAccountsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountsResponse): QueryAccountsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", + value: QueryAccountsResponse.encode(message).finish() + }; } - }; - function createBaseQueryAccountRequest(): QueryAccountRequest { return { address: "" }; } - export const QueryAccountRequest = { - encode(message: QueryAccountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", + encode(message: QueryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAccountRequest { + fromPartial(object: Partial): QueryAccountRequest { const message = createBaseQueryAccountRequest(); message.address = object.address ?? ""; return message; + }, + fromAmino(object: QueryAccountRequestAmino): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { + return QueryAccountRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountRequest): QueryAccountRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountRequest", + value: QueryAccountRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountRequestProtoMsg): QueryAccountRequest { + return QueryAccountRequest.decode(message.value); + }, + toProto(message: QueryAccountRequest): Uint8Array { + return QueryAccountRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountRequest): QueryAccountRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", + value: QueryAccountRequest.encode(message).finish() + }; } - }; - function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { return {}; } - export const QueryModuleAccountsRequest = { - encode(_: QueryModuleAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", + encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleAccountsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryModuleAccountsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryModuleAccountsRequest { + fromPartial(_: Partial): QueryModuleAccountsRequest { const message = createBaseQueryModuleAccountsRequest(); return message; + }, + fromAmino(_: QueryModuleAccountsRequestAmino): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, + toAmino(_: QueryModuleAccountsRequest): QueryModuleAccountsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryModuleAccountsRequestAminoMsg): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountsRequest): QueryModuleAccountsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountsRequest", + value: QueryModuleAccountsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountsRequestProtoMsg): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.decode(message.value); + }, + toProto(message: QueryModuleAccountsRequest): Uint8Array { + return QueryModuleAccountsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountsRequest): QueryModuleAccountsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", + value: QueryModuleAccountsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + params: Params.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryAccountResponse(): QueryAccountResponse { return { account: undefined }; } - export const QueryAccountResponse = { - encode(message: QueryAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", + encode(message: QueryAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.account !== undefined) { Any.encode(message.account, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAccountResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.account = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAccountResponse { + fromPartial(object: Partial): QueryAccountResponse { const message = createBaseQueryAccountResponse(); message.account = object.account !== undefined && object.account !== null ? Any.fromPartial(object.account) : undefined; return message; + }, + fromAmino(object: QueryAccountResponseAmino): QueryAccountResponse { + const message = createBaseQueryAccountResponse(); + if (object.account !== undefined && object.account !== null) { + message.account = Any.fromAmino(object.account); + } + return message; + }, + toAmino(message: QueryAccountResponse): QueryAccountResponseAmino { + const obj: any = {}; + obj.account = message.account ? Any.toAmino(message.account) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountResponseAminoMsg): QueryAccountResponse { + return QueryAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountResponse): QueryAccountResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountResponse", + value: QueryAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountResponseProtoMsg): QueryAccountResponse { + return QueryAccountResponse.decode(message.value); + }, + toProto(message: QueryAccountResponse): Uint8Array { + return QueryAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountResponse): QueryAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", + value: QueryAccountResponse.encode(message).finish() + }; } - }; - function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } - export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParamsRequest { + fromPartial(_: Partial): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { return { accounts: [] }; } - export const QueryModuleAccountsResponse = { - encode(message: QueryModuleAccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", + encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleAccountsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryModuleAccountsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.accounts.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryModuleAccountsResponse { + fromPartial(object: Partial): QueryModuleAccountsResponse { const message = createBaseQueryModuleAccountsResponse(); message.accounts = object.accounts?.map(e => Any.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryModuleAccountsResponseAmino): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseAmino { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.accounts = []; + } + return obj; + }, + fromAminoMsg(object: QueryModuleAccountsResponseAminoMsg): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountsResponse", + value: QueryModuleAccountsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountsResponseProtoMsg): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.decode(message.value); + }, + toProto(message: QueryModuleAccountsResponse): Uint8Array { + return QueryModuleAccountsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", + value: QueryModuleAccountsResponse.encode(message).finish() + }; } - }; - function createBaseBech32PrefixRequest(): Bech32PrefixRequest { return {}; } - export const Bech32PrefixRequest = { - encode(_: Bech32PrefixRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", + encode(_: Bech32PrefixRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Bech32PrefixRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBech32PrefixRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): Bech32PrefixRequest { + fromPartial(_: Partial): Bech32PrefixRequest { const message = createBaseBech32PrefixRequest(); return message; + }, + fromAmino(_: Bech32PrefixRequestAmino): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, + toAmino(_: Bech32PrefixRequest): Bech32PrefixRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: Bech32PrefixRequestAminoMsg): Bech32PrefixRequest { + return Bech32PrefixRequest.fromAmino(object.value); + }, + toAminoMsg(message: Bech32PrefixRequest): Bech32PrefixRequestAminoMsg { + return { + type: "cosmos-sdk/Bech32PrefixRequest", + value: Bech32PrefixRequest.toAmino(message) + }; + }, + fromProtoMsg(message: Bech32PrefixRequestProtoMsg): Bech32PrefixRequest { + return Bech32PrefixRequest.decode(message.value); + }, + toProto(message: Bech32PrefixRequest): Uint8Array { + return Bech32PrefixRequest.encode(message).finish(); + }, + toProtoMsg(message: Bech32PrefixRequest): Bech32PrefixRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", + value: Bech32PrefixRequest.encode(message).finish() + }; } - }; - function createBaseBech32PrefixResponse(): Bech32PrefixResponse { return { bech32Prefix: "" }; } - export const Bech32PrefixResponse = { - encode(message: Bech32PrefixResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", + encode(message: Bech32PrefixResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bech32Prefix !== "") { writer.uint32(10).string(message.bech32Prefix); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Bech32PrefixResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBech32PrefixResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.bech32Prefix = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Bech32PrefixResponse { + fromPartial(object: Partial): Bech32PrefixResponse { const message = createBaseBech32PrefixResponse(); message.bech32Prefix = object.bech32Prefix ?? ""; return message; + }, + fromAmino(object: Bech32PrefixResponseAmino): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + if (object.bech32_prefix !== undefined && object.bech32_prefix !== null) { + message.bech32Prefix = object.bech32_prefix; + } + return message; + }, + toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { + const obj: any = {}; + obj.bech32_prefix = message.bech32Prefix; + return obj; + }, + fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { + return Bech32PrefixResponse.fromAmino(object.value); + }, + toAminoMsg(message: Bech32PrefixResponse): Bech32PrefixResponseAminoMsg { + return { + type: "cosmos-sdk/Bech32PrefixResponse", + value: Bech32PrefixResponse.toAmino(message) + }; + }, + fromProtoMsg(message: Bech32PrefixResponseProtoMsg): Bech32PrefixResponse { + return Bech32PrefixResponse.decode(message.value); + }, + toProto(message: Bech32PrefixResponse): Uint8Array { + return Bech32PrefixResponse.encode(message).finish(); + }, + toProtoMsg(message: Bech32PrefixResponse): Bech32PrefixResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", + value: Bech32PrefixResponse.encode(message).finish() + }; } - }; - function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { return { addressBytes: new Uint8Array() }; } - export const AddressBytesToStringRequest = { - encode(message: AddressBytesToStringRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", + encode(message: AddressBytesToStringRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressBytes.length !== 0) { writer.uint32(10).bytes(message.addressBytes); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AddressBytesToStringRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAddressBytesToStringRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.addressBytes = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AddressBytesToStringRequest { + fromPartial(object: Partial): AddressBytesToStringRequest { const message = createBaseAddressBytesToStringRequest(); message.addressBytes = object.addressBytes ?? new Uint8Array(); return message; + }, + fromAmino(object: AddressBytesToStringRequestAmino): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + if (object.address_bytes !== undefined && object.address_bytes !== null) { + message.addressBytes = bytesFromBase64(object.address_bytes); + } + return message; + }, + toAmino(message: AddressBytesToStringRequest): AddressBytesToStringRequestAmino { + const obj: any = {}; + obj.address_bytes = message.addressBytes ? base64FromBytes(message.addressBytes) : undefined; + return obj; + }, + fromAminoMsg(object: AddressBytesToStringRequestAminoMsg): AddressBytesToStringRequest { + return AddressBytesToStringRequest.fromAmino(object.value); + }, + toAminoMsg(message: AddressBytesToStringRequest): AddressBytesToStringRequestAminoMsg { + return { + type: "cosmos-sdk/AddressBytesToStringRequest", + value: AddressBytesToStringRequest.toAmino(message) + }; + }, + fromProtoMsg(message: AddressBytesToStringRequestProtoMsg): AddressBytesToStringRequest { + return AddressBytesToStringRequest.decode(message.value); + }, + toProto(message: AddressBytesToStringRequest): Uint8Array { + return AddressBytesToStringRequest.encode(message).finish(); + }, + toProtoMsg(message: AddressBytesToStringRequest): AddressBytesToStringRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", + value: AddressBytesToStringRequest.encode(message).finish() + }; } - }; - function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { return { addressString: "" }; } - export const AddressBytesToStringResponse = { - encode(message: AddressBytesToStringResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", + encode(message: AddressBytesToStringResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressString !== "") { writer.uint32(10).string(message.addressString); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AddressBytesToStringResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAddressBytesToStringResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.addressString = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AddressBytesToStringResponse { + fromPartial(object: Partial): AddressBytesToStringResponse { const message = createBaseAddressBytesToStringResponse(); message.addressString = object.addressString ?? ""; return message; + }, + fromAmino(object: AddressBytesToStringResponseAmino): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + if (object.address_string !== undefined && object.address_string !== null) { + message.addressString = object.address_string; + } + return message; + }, + toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { + const obj: any = {}; + obj.address_string = message.addressString; + return obj; + }, + fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { + return AddressBytesToStringResponse.fromAmino(object.value); + }, + toAminoMsg(message: AddressBytesToStringResponse): AddressBytesToStringResponseAminoMsg { + return { + type: "cosmos-sdk/AddressBytesToStringResponse", + value: AddressBytesToStringResponse.toAmino(message) + }; + }, + fromProtoMsg(message: AddressBytesToStringResponseProtoMsg): AddressBytesToStringResponse { + return AddressBytesToStringResponse.decode(message.value); + }, + toProto(message: AddressBytesToStringResponse): Uint8Array { + return AddressBytesToStringResponse.encode(message).finish(); + }, + toProtoMsg(message: AddressBytesToStringResponse): AddressBytesToStringResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", + value: AddressBytesToStringResponse.encode(message).finish() + }; } - }; - function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { return { addressString: "" }; } - export const AddressStringToBytesRequest = { - encode(message: AddressStringToBytesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", + encode(message: AddressStringToBytesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressString !== "") { writer.uint32(10).string(message.addressString); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AddressStringToBytesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAddressStringToBytesRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.addressString = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AddressStringToBytesRequest { + fromPartial(object: Partial): AddressStringToBytesRequest { const message = createBaseAddressStringToBytesRequest(); message.addressString = object.addressString ?? ""; return message; + }, + fromAmino(object: AddressStringToBytesRequestAmino): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + if (object.address_string !== undefined && object.address_string !== null) { + message.addressString = object.address_string; + } + return message; + }, + toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { + const obj: any = {}; + obj.address_string = message.addressString; + return obj; + }, + fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { + return AddressStringToBytesRequest.fromAmino(object.value); + }, + toAminoMsg(message: AddressStringToBytesRequest): AddressStringToBytesRequestAminoMsg { + return { + type: "cosmos-sdk/AddressStringToBytesRequest", + value: AddressStringToBytesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: AddressStringToBytesRequestProtoMsg): AddressStringToBytesRequest { + return AddressStringToBytesRequest.decode(message.value); + }, + toProto(message: AddressStringToBytesRequest): Uint8Array { + return AddressStringToBytesRequest.encode(message).finish(); + }, + toProtoMsg(message: AddressStringToBytesRequest): AddressStringToBytesRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", + value: AddressStringToBytesRequest.encode(message).finish() + }; } - }; - function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { return { addressBytes: new Uint8Array() }; } - export const AddressStringToBytesResponse = { - encode(message: AddressStringToBytesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", + encode(message: AddressStringToBytesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressBytes.length !== 0) { writer.uint32(10).bytes(message.addressBytes); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AddressStringToBytesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAddressStringToBytesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.addressBytes = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AddressStringToBytesResponse { + fromPartial(object: Partial): AddressStringToBytesResponse { const message = createBaseAddressStringToBytesResponse(); message.addressBytes = object.addressBytes ?? new Uint8Array(); return message; + }, + fromAmino(object: AddressStringToBytesResponseAmino): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + if (object.address_bytes !== undefined && object.address_bytes !== null) { + message.addressBytes = bytesFromBase64(object.address_bytes); + } + return message; + }, + toAmino(message: AddressStringToBytesResponse): AddressStringToBytesResponseAmino { + const obj: any = {}; + obj.address_bytes = message.addressBytes ? base64FromBytes(message.addressBytes) : undefined; + return obj; + }, + fromAminoMsg(object: AddressStringToBytesResponseAminoMsg): AddressStringToBytesResponse { + return AddressStringToBytesResponse.fromAmino(object.value); + }, + toAminoMsg(message: AddressStringToBytesResponse): AddressStringToBytesResponseAminoMsg { + return { + type: "cosmos-sdk/AddressStringToBytesResponse", + value: AddressStringToBytesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: AddressStringToBytesResponseProtoMsg): AddressStringToBytesResponse { + return AddressStringToBytesResponse.decode(message.value); + }, + toProto(message: AddressStringToBytesResponse): Uint8Array { + return AddressStringToBytesResponse.encode(message).finish(); + }, + toProtoMsg(message: AddressStringToBytesResponse): AddressStringToBytesResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", + value: AddressStringToBytesResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/authz.ts b/src/codegen/cosmos/authz/v1beta1/authz.ts index 36787bd..9f7a151 100644 --- a/src/codegen/cosmos/authz/v1beta1/authz.ts +++ b/src/codegen/cosmos/authz/v1beta1/authz.ts @@ -1,30 +1,42 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp } from "../../../google/protobuf/timestamp"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** * GenericAuthorization gives the grantee unrestricted permissions to execute * the provided method on behalf of the granter's account. */ - export interface GenericAuthorization { /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ msg: string; } +export interface GenericAuthorizationProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization"; + value: Uint8Array; +} /** * GenericAuthorization gives the grantee unrestricted permissions to execute * the provided method on behalf of the granter's account. */ - -export interface GenericAuthorizationSDKType { +export interface GenericAuthorizationAmino { /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ + msg?: string; +} +export interface GenericAuthorizationAminoMsg { + type: "cosmos-sdk/GenericAuthorization"; + value: GenericAuthorizationAmino; +} +/** + * GenericAuthorization gives the grantee unrestricted permissions to execute + * the provided method on behalf of the granter's account. + */ +export interface GenericAuthorizationSDKType { msg: string; } /** * Grant gives permissions to execute * the provide method with expiration time. */ - export interface Grant { authorization?: Any; /** @@ -32,40 +44,69 @@ export interface Grant { * doesn't have a time expiration (other conditions in `authorization` * may apply to invalidate the grant) */ - expiration?: Date; } +export interface GrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.Grant"; + value: Uint8Array; +} /** * Grant gives permissions to execute * the provide method with expiration time. */ - -export interface GrantSDKType { - authorization?: AnySDKType; +export interface GrantAmino { + authorization?: AnyAmino; /** * time when the grant will expire and will be pruned. If null, then the grant * doesn't have a time expiration (other conditions in `authorization` * may apply to invalidate the grant) */ - + expiration?: string; +} +export interface GrantAminoMsg { + type: "cosmos-sdk/Grant"; + value: GrantAmino; +} +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface GrantSDKType { + authorization?: AnySDKType; expiration?: Date; } /** * GrantAuthorization extends a grant with both the addresses of the grantee and granter. * It is used in genesis.proto and query.proto */ - export interface GrantAuthorization { granter: string; grantee: string; authorization?: Any; expiration?: Date; } +export interface GrantAuthorizationProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization"; + value: Uint8Array; +} +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorizationAmino { + granter?: string; + grantee?: string; + authorization?: AnyAmino; + expiration?: string; +} +export interface GrantAuthorizationAminoMsg { + type: "cosmos-sdk/GrantAuthorization"; + value: GrantAuthorizationAmino; +} /** * GrantAuthorization extends a grant with both the addresses of the grantee and granter. * It is used in genesis.proto and query.proto */ - export interface GrantAuthorizationSDKType { granter: string; grantee: string; @@ -73,118 +114,177 @@ export interface GrantAuthorizationSDKType { expiration?: Date; } /** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ - export interface GrantQueueItem { /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ msgTypeUrls: string[]; } +export interface GrantQueueItemProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem"; + value: Uint8Array; +} /** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ - -export interface GrantQueueItemSDKType { +export interface GrantQueueItemAmino { /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msg_type_urls?: string[]; +} +export interface GrantQueueItemAminoMsg { + type: "cosmos-sdk/GrantQueueItem"; + value: GrantQueueItemAmino; +} +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItemSDKType { msg_type_urls: string[]; } - function createBaseGenericAuthorization(): GenericAuthorization { return { msg: "" }; } - export const GenericAuthorization = { - encode(message: GenericAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + encode(message: GenericAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msg !== "") { writer.uint32(10).string(message.msg); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenericAuthorization { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenericAuthorization(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.msg = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenericAuthorization { + fromPartial(object: Partial): GenericAuthorization { const message = createBaseGenericAuthorization(); message.msg = object.msg ?? ""; return message; + }, + fromAmino(object: GenericAuthorizationAmino): GenericAuthorization { + const message = createBaseGenericAuthorization(); + if (object.msg !== undefined && object.msg !== null) { + message.msg = object.msg; + } + return message; + }, + toAmino(message: GenericAuthorization): GenericAuthorizationAmino { + const obj: any = {}; + obj.msg = message.msg; + return obj; + }, + fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { + return GenericAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: GenericAuthorization): GenericAuthorizationAminoMsg { + return { + type: "cosmos-sdk/GenericAuthorization", + value: GenericAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: GenericAuthorizationProtoMsg): GenericAuthorization { + return GenericAuthorization.decode(message.value); + }, + toProto(message: GenericAuthorization): Uint8Array { + return GenericAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GenericAuthorization): GenericAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + value: GenericAuthorization.encode(message).finish() + }; } - }; - function createBaseGrant(): Grant { return { authorization: undefined, expiration: undefined }; } - export const Grant = { - encode(message: Grant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.Grant", + encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authorization !== undefined) { Any.encode(message.authorization, writer.uint32(10).fork()).ldelim(); } - if (message.expiration !== undefined) { Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Grant { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGrant(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.authorization = Any.decode(reader, reader.uint32()); break; - case 2: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Grant { + fromPartial(object: Partial): Grant { const message = createBaseGrant(); message.authorization = object.authorization !== undefined && object.authorization !== null ? Any.fromPartial(object.authorization) : undefined; message.expiration = object.expiration ?? undefined; return message; + }, + fromAmino(object: GrantAmino): Grant { + const message = createBaseGrant(); + if (object.authorization !== undefined && object.authorization !== null) { + message.authorization = Any.fromAmino(object.authorization); + } + if (object.expiration !== undefined && object.expiration !== null) { + message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); + } + return message; + }, + toAmino(message: Grant): GrantAmino { + const obj: any = {}; + obj.authorization = message.authorization ? Any.toAmino(message.authorization) : undefined; + obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; + return obj; + }, + fromAminoMsg(object: GrantAminoMsg): Grant { + return Grant.fromAmino(object.value); + }, + toAminoMsg(message: Grant): GrantAminoMsg { + return { + type: "cosmos-sdk/Grant", + value: Grant.toAmino(message) + }; + }, + fromProtoMsg(message: GrantProtoMsg): Grant { + return Grant.decode(message.value); + }, + toProto(message: Grant): Uint8Array { + return Grant.encode(message).finish(); + }, + toProtoMsg(message: Grant): GrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.Grant", + value: Grant.encode(message).finish() + }; } - }; - function createBaseGrantAuthorization(): GrantAuthorization { return { granter: "", @@ -193,114 +293,171 @@ function createBaseGrantAuthorization(): GrantAuthorization { expiration: undefined }; } - export const GrantAuthorization = { - encode(message: GrantAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", + encode(message: GrantAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.grantee !== "") { writer.uint32(18).string(message.grantee); } - if (message.authorization !== undefined) { Any.encode(message.authorization, writer.uint32(26).fork()).ldelim(); } - if (message.expiration !== undefined) { Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GrantAuthorization { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGrantAuthorization(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.granter = reader.string(); break; - case 2: message.grantee = reader.string(); break; - case 3: message.authorization = Any.decode(reader, reader.uint32()); break; - case 4: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GrantAuthorization { + fromPartial(object: Partial): 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; + }, + fromAmino(object: GrantAuthorizationAmino): GrantAuthorization { + const message = createBaseGrantAuthorization(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.authorization !== undefined && object.authorization !== null) { + message.authorization = Any.fromAmino(object.authorization); + } + if (object.expiration !== undefined && object.expiration !== null) { + message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); + } + return message; + }, + toAmino(message: GrantAuthorization): GrantAuthorizationAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.authorization = message.authorization ? Any.toAmino(message.authorization) : undefined; + obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; + return obj; + }, + fromAminoMsg(object: GrantAuthorizationAminoMsg): GrantAuthorization { + return GrantAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: GrantAuthorization): GrantAuthorizationAminoMsg { + return { + type: "cosmos-sdk/GrantAuthorization", + value: GrantAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: GrantAuthorizationProtoMsg): GrantAuthorization { + return GrantAuthorization.decode(message.value); + }, + toProto(message: GrantAuthorization): Uint8Array { + return GrantAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GrantAuthorization): GrantAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", + value: GrantAuthorization.encode(message).finish() + }; } - }; - function createBaseGrantQueueItem(): GrantQueueItem { return { msgTypeUrls: [] }; } - export const GrantQueueItem = { - encode(message: GrantQueueItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", + encode(message: GrantQueueItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.msgTypeUrls) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GrantQueueItem { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGrantQueueItem(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.msgTypeUrls.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GrantQueueItem { + fromPartial(object: Partial): GrantQueueItem { const message = createBaseGrantQueueItem(); message.msgTypeUrls = object.msgTypeUrls?.map(e => e) || []; return message; + }, + fromAmino(object: GrantQueueItemAmino): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msg_type_urls?.map(e => e) || []; + return message; + }, + toAmino(message: GrantQueueItem): GrantQueueItemAmino { + const obj: any = {}; + if (message.msgTypeUrls) { + obj.msg_type_urls = message.msgTypeUrls.map(e => e); + } else { + obj.msg_type_urls = []; + } + return obj; + }, + fromAminoMsg(object: GrantQueueItemAminoMsg): GrantQueueItem { + return GrantQueueItem.fromAmino(object.value); + }, + toAminoMsg(message: GrantQueueItem): GrantQueueItemAminoMsg { + return { + type: "cosmos-sdk/GrantQueueItem", + value: GrantQueueItem.toAmino(message) + }; + }, + fromProtoMsg(message: GrantQueueItemProtoMsg): GrantQueueItem { + return GrantQueueItem.decode(message.value); + }, + toProto(message: GrantQueueItem): Uint8Array { + return GrantQueueItem.encode(message).finish(); + }, + toProtoMsg(message: GrantQueueItem): GrantQueueItemProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", + value: GrantQueueItem.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/event.ts b/src/codegen/cosmos/authz/v1beta1/event.ts index f8ad9bb..4b82cc0 100644 --- a/src/codegen/cosmos/authz/v1beta1/event.ts +++ b/src/codegen/cosmos/authz/v1beta1/event.ts @@ -1,54 +1,68 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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; } +export interface EventGrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.EventGrant"; + value: Uint8Array; +} /** EventGrant is emitted on Msg/Grant */ - -export interface EventGrantSDKType { +export interface EventGrantAmino { /** Msg type URL for which an autorization is granted */ - msg_type_url: string; + msg_type_url?: string; /** Granter account address */ - - granter: string; + granter?: string; /** Grantee account address */ - + grantee?: string; +} +export interface EventGrantAminoMsg { + type: "cosmos-sdk/EventGrant"; + value: EventGrantAmino; +} +/** EventGrant is emitted on Msg/Grant */ +export interface EventGrantSDKType { + msg_type_url: string; + granter: string; 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; } +export interface EventRevokeProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.EventRevoke"; + value: Uint8Array; +} /** EventRevoke is emitted on Msg/Revoke */ - -export interface EventRevokeSDKType { +export interface EventRevokeAmino { /** Msg type URL for which an autorization is revoked */ - msg_type_url: string; + msg_type_url?: string; /** Granter account address */ - - granter: string; + granter?: string; /** Grantee account address */ - + grantee?: string; +} +export interface EventRevokeAminoMsg { + type: "cosmos-sdk/EventRevoke"; + value: EventRevokeAmino; +} +/** EventRevoke is emitted on Msg/Revoke */ +export interface EventRevokeSDKType { + msg_type_url: string; + granter: string; grantee: string; } - function createBaseEventGrant(): EventGrant { return { msgTypeUrl: "", @@ -56,64 +70,92 @@ function createBaseEventGrant(): EventGrant { grantee: "" }; } - export const EventGrant = { - encode(message: EventGrant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.EventGrant", + encode(message: EventGrant, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): EventGrant { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.msgTypeUrl = reader.string(); break; - case 3: message.granter = reader.string(); break; - case 4: message.grantee = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventGrant { + fromPartial(object: Partial): EventGrant { const message = createBaseEventGrant(); message.msgTypeUrl = object.msgTypeUrl ?? ""; message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; return message; + }, + fromAmino(object: EventGrantAmino): EventGrant { + const message = createBaseEventGrant(); + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: EventGrant): EventGrantAmino { + const obj: any = {}; + obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter; + obj.grantee = message.grantee; + return obj; + }, + fromAminoMsg(object: EventGrantAminoMsg): EventGrant { + return EventGrant.fromAmino(object.value); + }, + toAminoMsg(message: EventGrant): EventGrantAminoMsg { + return { + type: "cosmos-sdk/EventGrant", + value: EventGrant.toAmino(message) + }; + }, + fromProtoMsg(message: EventGrantProtoMsg): EventGrant { + return EventGrant.decode(message.value); + }, + toProto(message: EventGrant): Uint8Array { + return EventGrant.encode(message).finish(); + }, + toProtoMsg(message: EventGrant): EventGrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.EventGrant", + value: EventGrant.encode(message).finish() + }; } - }; - function createBaseEventRevoke(): EventRevoke { return { msgTypeUrl: "", @@ -121,60 +163,89 @@ function createBaseEventRevoke(): EventRevoke { grantee: "" }; } - export const EventRevoke = { - encode(message: EventRevoke, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.EventRevoke", + encode(message: EventRevoke, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): EventRevoke { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.msgTypeUrl = reader.string(); break; - case 3: message.granter = reader.string(); break; - case 4: message.grantee = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventRevoke { + fromPartial(object: Partial): EventRevoke { const message = createBaseEventRevoke(); message.msgTypeUrl = object.msgTypeUrl ?? ""; message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; return message; + }, + fromAmino(object: EventRevokeAmino): EventRevoke { + const message = createBaseEventRevoke(); + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: EventRevoke): EventRevokeAmino { + const obj: any = {}; + obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter; + obj.grantee = message.grantee; + return obj; + }, + fromAminoMsg(object: EventRevokeAminoMsg): EventRevoke { + return EventRevoke.fromAmino(object.value); + }, + toAminoMsg(message: EventRevoke): EventRevokeAminoMsg { + return { + type: "cosmos-sdk/EventRevoke", + value: EventRevoke.toAmino(message) + }; + }, + fromProtoMsg(message: EventRevokeProtoMsg): EventRevoke { + return EventRevoke.decode(message.value); + }, + toProto(message: EventRevoke): Uint8Array { + return EventRevoke.encode(message).finish(); + }, + toProtoMsg(message: EventRevoke): EventRevokeProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.EventRevoke", + value: EventRevoke.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/genesis.ts b/src/codegen/cosmos/authz/v1beta1/genesis.ts index 037ff23..a66ebb0 100644 --- a/src/codegen/cosmos/authz/v1beta1/genesis.ts +++ b/src/codegen/cosmos/authz/v1beta1/genesis.ts @@ -1,58 +1,93 @@ -import { GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the authz module's genesis state. */ - export interface GenesisState { authorization: GrantAuthorization[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the authz module's genesis state. */ +export interface GenesisStateAmino { + authorization?: GrantAuthorizationAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} /** GenesisState defines the authz module's genesis state. */ - export interface GenesisStateSDKType { authorization: GrantAuthorizationSDKType[]; } - function createBaseGenesisState(): GenesisState { return { authorization: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.authorization) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.authorization = object.authorization?.map(e => GrantAuthorization.fromPartial(e)) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.authorization = object.authorization?.map(e => GrantAuthorization.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.authorization) { + obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e) : undefined); + } else { + obj.authorization = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/query.lcd.ts b/src/codegen/cosmos/authz/v1beta1/query.lcd.ts index 0a8df35..e5699e3 100644 --- a/src/codegen/cosmos/authz/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/authz/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryGrantsRequest, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -15,65 +14,49 @@ export class LCDQueryClient { this.granteeGrants = this.granteeGrants.bind(this); } /* Returns list of `Authorization`, granted to the grantee by the granter. */ - - async grants(params: QueryGrantsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.granter !== "undefined") { options.params.granter = params.granter; } - if (typeof params?.grantee !== "undefined") { options.params.grantee = params.grantee; } - if (typeof params?.msgTypeUrl !== "undefined") { options.params.msg_type_url = params.msgTypeUrl; } - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/authz/v1beta1/grants`; return await this.req.get(endpoint, options); } /* GranterGrants returns list of `GrantAuthorization`, granted by granter. Since: cosmos-sdk 0.46 */ - - async granterGrants(params: QueryGranterGrantsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/authz/v1beta1/grants/granter/${params.granter}`; return await this.req.get(endpoint, options); } /* GranteeGrants returns a list of `GrantAuthorization` by grantee. Since: cosmos-sdk 0.46 */ - - async granteeGrants(params: QueryGranteeGrantsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/authz/v1beta1/grants/grantee/${params.grantee}`; return await this.req.get(endpoint, options); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/authz/v1beta1/query.rpc.Query.ts index c2fda46..f42a05d 100644 --- a/src/codegen/cosmos/authz/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/authz/v1beta1/query.rpc.Query.ts @@ -1,9 +1,8 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryGrantsRequest, QueryGrantsResponse, QueryGranterGrantsRequest, QueryGranterGrantsResponse, QueryGranteeGrantsRequest, QueryGranteeGrantsResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** Returns list of `Authorization`, granted to the grantee by the granter. */ grants(request: QueryGrantsRequest): Promise; @@ -12,44 +11,37 @@ export interface Query { * * Since: cosmos-sdk 0.46 */ - granterGrants(request: QueryGranterGrantsRequest): Promise; /** * GranteeGrants returns a list of `GrantAuthorization` by grantee. * * Since: cosmos-sdk 0.46 */ - granteeGrants(request: QueryGranteeGrantsRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.authz.v1beta1.Query", "Grants", data); - return promise.then(data => QueryGrantsResponse.decode(new _m0.Reader(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("cosmos.authz.v1beta1.Query", "GranterGrants", data); - return promise.then(data => QueryGranterGrantsResponse.decode(new _m0.Reader(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("cosmos.authz.v1beta1.Query", "GranteeGrants", data); - return promise.then(data => QueryGranteeGrantsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryGranteeGrantsResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -58,14 +50,11 @@ export const createRpcQueryExtension = (base: QueryClient) => { grants(request: QueryGrantsRequest): Promise { return queryService.grants(request); }, - granterGrants(request: QueryGranterGrantsRequest): Promise { return queryService.granterGrants(request); }, - granteeGrants(request: QueryGranteeGrantsRequest): Promise { return queryService.granteeGrants(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/query.ts b/src/codegen/cosmos/authz/v1beta1/query.ts index f6177d4..fd51693 100644 --- a/src/codegen/cosmos/authz/v1beta1/query.ts +++ b/src/codegen/cosmos/authz/v1beta1/query.ts @@ -1,118 +1,170 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantAmino, GrantSDKType, GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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; } +export interface QueryGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest"; + value: Uint8Array; +} +/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ +export interface QueryGrantsRequestAmino { + granter?: string; + grantee?: string; + /** Optional, msg_type_url, when set, will query only grants matching given msg type. */ + msg_type_url?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGrantsRequest"; + value: QueryGrantsRequestAmino; +} /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ - export interface QueryGrantsRequestSDKType { granter: string; grantee: string; - /** Optional, msg_type_url, when set, will query only grants matching given msg type. */ - msg_type_url: string; - /** pagination defines an pagination for the request. */ - pagination?: PageRequestSDKType; } /** 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; } +export interface QueryGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse"; + value: Uint8Array; +} /** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */ - -export interface QueryGrantsResponseSDKType { +export interface QueryGrantsResponseAmino { /** authorizations is a list of grants granted for grantee by granter. */ - grants: GrantSDKType[]; + grants?: GrantAmino[]; /** pagination defines an pagination for the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGrantsResponse"; + value: QueryGrantsResponseAmino; +} +/** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */ +export interface QueryGrantsResponseSDKType { + grants: GrantSDKType[]; pagination?: PageResponseSDKType; } /** 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; } +export interface QueryGranterGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest"; + value: Uint8Array; +} +/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsRequestAmino { + granter?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGranterGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGranterGrantsRequest"; + value: QueryGranterGrantsRequestAmino; +} /** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ - export interface QueryGranterGrantsRequestSDKType { granter: string; - /** pagination defines an pagination for the request. */ - pagination?: PageRequestSDKType; } /** 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; } +export interface QueryGranterGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse"; + value: Uint8Array; +} /** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */ - -export interface QueryGranterGrantsResponseSDKType { +export interface QueryGranterGrantsResponseAmino { /** grants is a list of grants granted by the granter. */ - grants: GrantAuthorizationSDKType[]; + grants?: GrantAuthorizationAmino[]; /** pagination defines an pagination for the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryGranterGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGranterGrantsResponse"; + value: QueryGranterGrantsResponseAmino; +} +/** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsResponseSDKType { + grants: GrantAuthorizationSDKType[]; pagination?: PageResponseSDKType; } /** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ - export interface QueryGranteeGrantsRequest { grantee: string; /** pagination defines an pagination for the request. */ - pagination?: PageRequest; } +export interface QueryGranteeGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest"; + value: Uint8Array; +} +/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +export interface QueryGranteeGrantsRequestAmino { + grantee?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGranteeGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGranteeGrantsRequest"; + value: QueryGranteeGrantsRequestAmino; +} /** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ - export interface QueryGranteeGrantsRequestSDKType { grantee: string; - /** pagination defines an pagination for the request. */ - pagination?: PageRequestSDKType; } /** 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; } +export interface QueryGranteeGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse"; + value: Uint8Array; +} /** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */ - -export interface QueryGranteeGrantsResponseSDKType { +export interface QueryGranteeGrantsResponseAmino { /** grants is a list of grants granted to the grantee. */ - grants: GrantAuthorizationSDKType[]; + grants?: GrantAuthorizationAmino[]; /** pagination defines an pagination for the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryGranteeGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGranteeGrantsResponse"; + value: QueryGranteeGrantsResponseAmino; +} +/** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsResponseSDKType { + grants: GrantAuthorizationSDKType[]; pagination?: PageResponseSDKType; } - function createBaseQueryGrantsRequest(): QueryGrantsRequest { return { granter: "", @@ -121,344 +173,511 @@ function createBaseQueryGrantsRequest(): QueryGrantsRequest { pagination: undefined }; } - export const QueryGrantsRequest = { - encode(message: QueryGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", + encode(message: QueryGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.grantee !== "") { writer.uint32(18).string(message.grantee); } - if (message.msgTypeUrl !== "") { writer.uint32(26).string(message.msgTypeUrl); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGrantsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.granter = reader.string(); break; - case 2: message.grantee = reader.string(); break; - case 3: message.msgTypeUrl = reader.string(); break; - case 4: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGrantsRequest { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGrantsRequestAmino): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.msg_type_url = message.msgTypeUrl; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGrantsRequestAminoMsg): QueryGrantsRequest { + return QueryGrantsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGrantsRequest): QueryGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGrantsRequest", + value: QueryGrantsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGrantsRequestProtoMsg): QueryGrantsRequest { + return QueryGrantsRequest.decode(message.value); + }, + toProto(message: QueryGrantsRequest): Uint8Array { + return QueryGrantsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGrantsRequest): QueryGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", + value: QueryGrantsRequest.encode(message).finish() + }; } - }; - function createBaseQueryGrantsResponse(): QueryGrantsResponse { return { grants: [], pagination: undefined }; } - export const QueryGrantsResponse = { - encode(message: QueryGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", + encode(message: QueryGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGrantsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.grants.push(Grant.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGrantsResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGrantsResponseAmino): QueryGrantsResponse { + const message = createBaseQueryGrantsResponse(); + message.grants = object.grants?.map(e => Grant.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGrantsResponse): QueryGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? Grant.toAmino(e) : undefined); + } else { + obj.grants = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGrantsResponseAminoMsg): QueryGrantsResponse { + return QueryGrantsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGrantsResponse): QueryGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGrantsResponse", + value: QueryGrantsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGrantsResponseProtoMsg): QueryGrantsResponse { + return QueryGrantsResponse.decode(message.value); + }, + toProto(message: QueryGrantsResponse): Uint8Array { + return QueryGrantsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGrantsResponse): QueryGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", + value: QueryGrantsResponse.encode(message).finish() + }; } - }; - function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { return { granter: "", pagination: undefined }; } - export const QueryGranterGrantsRequest = { - encode(message: QueryGranterGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", + encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranterGrantsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.granter = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGranterGrantsRequest { + fromPartial(object: Partial): QueryGranterGrantsRequest { const message = createBaseQueryGranterGrantsRequest(); message.granter = object.granter ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryGranterGrantsRequestAmino): QueryGranterGrantsRequest { + const message = createBaseQueryGranterGrantsRequest(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGranterGrantsRequestAminoMsg): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGranterGrantsRequest", + value: QueryGranterGrantsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGranterGrantsRequestProtoMsg): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.decode(message.value); + }, + toProto(message: QueryGranterGrantsRequest): Uint8Array { + return QueryGranterGrantsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", + value: QueryGranterGrantsRequest.encode(message).finish() + }; } - }; - function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { return { grants: [], pagination: undefined }; } - export const QueryGranterGrantsResponse = { - encode(message: QueryGranterGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", + encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranterGrantsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGranterGrantsResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGranterGrantsResponseAmino): QueryGranterGrantsResponse { + const message = createBaseQueryGranterGrantsResponse(); + message.grants = object.grants?.map(e => GrantAuthorization.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGranterGrantsResponse): QueryGranterGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); + } else { + obj.grants = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGranterGrantsResponseAminoMsg): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGranterGrantsResponse): QueryGranterGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGranterGrantsResponse", + value: QueryGranterGrantsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGranterGrantsResponseProtoMsg): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.decode(message.value); + }, + toProto(message: QueryGranterGrantsResponse): Uint8Array { + return QueryGranterGrantsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGranterGrantsResponse): QueryGranterGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", + value: QueryGranterGrantsResponse.encode(message).finish() + }; } - }; - function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { return { grantee: "", pagination: undefined }; } - export const QueryGranteeGrantsRequest = { - encode(message: QueryGranteeGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", + encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranteeGrantsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.grantee = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGranteeGrantsRequest { + fromPartial(object: Partial): QueryGranteeGrantsRequest { const message = createBaseQueryGranteeGrantsRequest(); message.grantee = object.grantee ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryGranteeGrantsRequestAmino): QueryGranteeGrantsRequest { + const message = createBaseQueryGranteeGrantsRequest(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { + const obj: any = {}; + obj.grantee = message.grantee; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGranteeGrantsRequestAminoMsg): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGranteeGrantsRequest", + value: QueryGranteeGrantsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGranteeGrantsRequestProtoMsg): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.decode(message.value); + }, + toProto(message: QueryGranteeGrantsRequest): Uint8Array { + return QueryGranteeGrantsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", + value: QueryGranteeGrantsRequest.encode(message).finish() + }; } - }; - function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { return { grants: [], pagination: undefined }; } - export const QueryGranteeGrantsResponse = { - encode(message: QueryGranteeGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", + encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranteeGrantsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGranteeGrantsResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGranteeGrantsResponseAmino): QueryGranteeGrantsResponse { + const message = createBaseQueryGranteeGrantsResponse(); + message.grants = object.grants?.map(e => GrantAuthorization.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGranteeGrantsResponse): QueryGranteeGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); + } else { + obj.grants = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGranteeGrantsResponseAminoMsg): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGranteeGrantsResponse): QueryGranteeGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGranteeGrantsResponse", + value: QueryGranteeGrantsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGranteeGrantsResponseProtoMsg): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.decode(message.value); + }, + toProto(message: QueryGranteeGrantsResponse): Uint8Array { + return QueryGranteeGrantsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGranteeGrantsResponse): QueryGranteeGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", + value: QueryGranteeGrantsResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/tx.amino.ts b/src/codegen/cosmos/authz/v1beta1/tx.amino.ts index da254ba..6fcf9fd 100644 --- a/src/codegen/cosmos/authz/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/authz/v1beta1/tx.amino.ts @@ -1,128 +1,18 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgGrant, MsgExec, MsgRevoke } from "./tx"; -export interface AminoMsgGrant extends AminoMsg { - type: "cosmos-sdk/MsgGrant"; - value: { - granter: string; - grantee: string; - grant: { - authorization: { - type_url: string; - value: Uint8Array; - }; - expiration: { - seconds: string; - nanos: number; - }; - }; - }; -} -export interface AminoMsgExec extends AminoMsg { - type: "cosmos-sdk/MsgExec"; - value: { - grantee: string; - msgs: { - type_url: string; - value: Uint8Array; - }[]; - }; -} -export interface AminoMsgRevoke extends AminoMsg { - type: "cosmos-sdk/MsgRevoke"; - value: { - granter: string; - grantee: string; - msg_type_url: string; - }; -} export const AminoConverter = { "/cosmos.authz.v1beta1.MsgGrant": { aminoType: "cosmos-sdk/MsgGrant", - toAmino: ({ - granter, - grantee, - grant - }: MsgGrant): AminoMsgGrant["value"] => { - return { - granter, - grantee, - grant: { - authorization: { - type_url: grant.authorization.typeUrl, - value: grant.authorization.value - }, - expiration: grant.expiration - } - }; - }, - fromAmino: ({ - granter, - grantee, - grant - }: AminoMsgGrant["value"]): MsgGrant => { - return { - granter, - grantee, - grant: { - authorization: { - typeUrl: grant.authorization.type_url, - value: grant.authorization.value - }, - expiration: grant.expiration - } - }; - } + toAmino: MsgGrant.toAmino, + fromAmino: MsgGrant.fromAmino }, "/cosmos.authz.v1beta1.MsgExec": { aminoType: "cosmos-sdk/MsgExec", - toAmino: ({ - grantee, - msgs - }: MsgExec): AminoMsgExec["value"] => { - return { - grantee, - msgs: msgs.map(el0 => ({ - type_url: el0.typeUrl, - value: el0.value - })) - }; - }, - fromAmino: ({ - grantee, - msgs - }: AminoMsgExec["value"]): MsgExec => { - return { - grantee, - msgs: msgs.map(el0 => ({ - typeUrl: el0.type_url, - value: el0.value - })) - }; - } + toAmino: MsgExec.toAmino, + fromAmino: MsgExec.fromAmino }, "/cosmos.authz.v1beta1.MsgRevoke": { aminoType: "cosmos-sdk/MsgRevoke", - toAmino: ({ - granter, - grantee, - msgTypeUrl - }: MsgRevoke): AminoMsgRevoke["value"] => { - return { - granter, - grantee, - msg_type_url: msgTypeUrl - }; - }, - fromAmino: ({ - granter, - grantee, - msg_type_url - }: AminoMsgRevoke["value"]): MsgRevoke => { - return { - granter, - grantee, - msgTypeUrl: msg_type_url - }; - } + toAmino: MsgRevoke.toAmino, + fromAmino: MsgRevoke.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/tx.registry.ts b/src/codegen/cosmos/authz/v1beta1/tx.registry.ts index c4c1a53..618e668 100644 --- a/src/codegen/cosmos/authz/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/authz/v1beta1/tx.registry.ts @@ -14,21 +14,18 @@ export const MessageComposer = { value: MsgGrant.encode(value).finish() }; }, - exec(value: MsgExec) { return { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value: MsgExec.encode(value).finish() }; }, - revoke(value: MsgRevoke) { return { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.encode(value).finish() }; } - }, withTypeUrl: { grant(value: MsgGrant) { @@ -37,21 +34,18 @@ export const MessageComposer = { value }; }, - exec(value: MsgExec) { return { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value }; }, - revoke(value: MsgRevoke) { return { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value }; } - }, fromPartial: { grant(value: MsgGrant) { @@ -60,20 +54,17 @@ export const MessageComposer = { value: MsgGrant.fromPartial(value) }; }, - exec(value: MsgExec) { return { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value: MsgExec.fromPartial(value) }; }, - revoke(value: MsgRevoke) { return { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/authz/v1beta1/tx.rpc.msg.ts index 63499c4..4f5bb4e 100644 --- a/src/codegen/cosmos/authz/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgGrant, MsgGrantResponse, MsgExec, MsgExecResponse, MsgRevoke, MsgRevokeResponse } from "./tx"; /** Msg defines the authz Msg service. */ - export interface Msg { /** * Grant grants the provided authorization to the grantee on the granter's @@ -16,41 +15,34 @@ export interface Msg { * authorizations granted to the grantee. Each message should have only * one signer corresponding to the granter of the authorization. */ - exec(request: MsgExec): Promise; /** * Revoke revokes any authorization corresponding to the provided method name on the * granter's account that has been granted to the grantee. */ - revoke(request: MsgRevoke): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.authz.v1beta1.Msg", "Grant", data); - return promise.then(data => MsgGrantResponse.decode(new _m0.Reader(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("cosmos.authz.v1beta1.Msg", "Exec", data); - return promise.then(data => MsgExecResponse.decode(new _m0.Reader(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("cosmos.authz.v1beta1.Msg", "Revoke", data); - return promise.then(data => MsgRevokeResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgRevokeResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/authz/v1beta1/tx.ts b/src/codegen/cosmos/authz/v1beta1/tx.ts index 7a4f574..8147055 100644 --- a/src/codegen/cosmos/authz/v1beta1/tx.ts +++ b/src/codegen/cosmos/authz/v1beta1/tx.ts @@ -1,34 +1,59 @@ -import { Grant, GrantSDKType } from "./authz"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Grant, GrantAmino, GrantSDKType } from "./authz"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** * 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; + grant: Grant; +} +export interface MsgGrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface MsgGrantAmino { + granter?: string; + grantee?: string; + grant?: GrantAmino; +} +export interface MsgGrantAminoMsg { + type: "cosmos-sdk/MsgGrant"; + value: MsgGrantAmino; } /** * 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 MsgGrantSDKType { granter: string; grantee: string; - grant?: GrantSDKType; + grant: GrantSDKType; } /** MsgExecResponse defines the Msg/MsgExecResponse response type. */ - export interface MsgExecResponse { results: Uint8Array[]; } +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse"; + value: Uint8Array; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponseAmino { + results?: string[]; +} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} /** MsgExecResponse defines the Msg/MsgExecResponse response type. */ - export interface MsgExecResponseSDKType { results: Uint8Array[]; } @@ -37,7 +62,6 @@ export interface MsgExecResponseSDKType { * authorizations granted to the grantee. Each message should have only * one signer corresponding to the granter of the authorization. */ - export interface MsgExec { grantee: string; /** @@ -45,257 +69,405 @@ export interface MsgExec { * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) * triple and validate it. */ - msgs: Any[]; } +export interface MsgExecProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExec"; + value: Uint8Array; +} /** * MsgExec attempts to execute the provided messages using * authorizations granted to the grantee. Each message should have only * one signer corresponding to the granter of the authorization. */ - -export interface MsgExecSDKType { - grantee: string; +export interface MsgExecAmino { + grantee?: string; /** * Authorization Msg requests to execute. Each msg must implement Authorization interface * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) * triple and validate it. */ - + msgs?: AnyAmino[]; +} +export interface MsgExecAminoMsg { + type: "cosmos-sdk/MsgExec"; + value: MsgExecAmino; +} +/** + * 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 MsgExecSDKType { + grantee: string; msgs: AnySDKType[]; } /** MsgGrantResponse defines the Msg/MsgGrant response type. */ - export interface MsgGrantResponse {} +export interface MsgGrantResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponseAmino {} +export interface MsgGrantResponseAminoMsg { + type: "cosmos-sdk/MsgGrantResponse"; + value: MsgGrantResponseAmino; +} /** MsgGrantResponse defines the Msg/MsgGrant response type. */ - export interface MsgGrantResponseSDKType {} /** * MsgRevoke revokes any authorization with the provided sdk.Msg type on the * granter's account with that has been granted to the grantee. */ - export interface MsgRevoke { granter: string; grantee: string; msgTypeUrl: string; } +export interface MsgRevokeProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke"; + value: Uint8Array; +} +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevokeAmino { + granter?: string; + grantee?: string; + msg_type_url?: string; +} +export interface MsgRevokeAminoMsg { + type: "cosmos-sdk/MsgRevoke"; + value: MsgRevokeAmino; +} /** * 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 MsgRevokeSDKType { granter: string; grantee: string; msg_type_url: string; } /** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ - export interface MsgRevokeResponse {} +export interface MsgRevokeResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse"; + value: Uint8Array; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponseAmino {} +export interface MsgRevokeResponseAminoMsg { + type: "cosmos-sdk/MsgRevokeResponse"; + value: MsgRevokeResponseAmino; +} /** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ - export interface MsgRevokeResponseSDKType {} - function createBaseMsgGrant(): MsgGrant { return { granter: "", grantee: "", - grant: undefined + grant: Grant.fromPartial({}) }; } - export const MsgGrant = { - encode(message: MsgGrant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + encode(message: MsgGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.grantee !== "") { writer.uint32(18).string(message.grantee); } - if (message.grant !== undefined) { Grant.encode(message.grant, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrant { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgGrant(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.granter = reader.string(); break; - case 2: message.grantee = reader.string(); break; - case 3: message.grant = Grant.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgGrant { + fromPartial(object: Partial): MsgGrant { const message = createBaseMsgGrant(); message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; message.grant = object.grant !== undefined && object.grant !== null ? Grant.fromPartial(object.grant) : undefined; return message; + }, + fromAmino(object: MsgGrantAmino): MsgGrant { + const message = createBaseMsgGrant(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = Grant.fromAmino(object.grant); + } + return message; + }, + toAmino(message: MsgGrant): MsgGrantAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGrantAminoMsg): MsgGrant { + return MsgGrant.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrant): MsgGrantAminoMsg { + return { + type: "cosmos-sdk/MsgGrant", + value: MsgGrant.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantProtoMsg): MsgGrant { + return MsgGrant.decode(message.value); + }, + toProto(message: MsgGrant): Uint8Array { + return MsgGrant.encode(message).finish(); + }, + toProtoMsg(message: MsgGrant): MsgGrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.encode(message).finish() + }; } - }; - function createBaseMsgExecResponse(): MsgExecResponse { return { results: [] }; } - export const MsgExecResponse = { - encode(message: MsgExecResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.results) { writer.uint32(10).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgExecResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.results.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgExecResponse { + fromPartial(object: Partial): MsgExecResponse { const message = createBaseMsgExecResponse(); message.results = object.results?.map(e => e) || []; return message; + }, + fromAmino(object: MsgExecResponseAmino): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MsgExecResponse): MsgExecResponseAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => base64FromBytes(e)); + } else { + obj.results = []; + } + return obj; + }, + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); + }, + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish() + }; } - }; - function createBaseMsgExec(): MsgExec { return { grantee: "", msgs: [] }; } - export const MsgExec = { - encode(message: MsgExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); } - for (const v of message.msgs) { Any.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgExec { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgExec(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.grantee = reader.string(); break; - case 2: message.msgs.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgExec { + fromPartial(object: Partial): MsgExec { const message = createBaseMsgExec(); message.grantee = object.grantee ?? ""; message.msgs = object.msgs?.map(e => Any.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgExecAmino): MsgExec { + const message = createBaseMsgExec(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + message.msgs = object.msgs?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgExec): MsgExecAmino { + const obj: any = {}; + obj.grantee = message.grantee; + if (message.msgs) { + obj.msgs = message.msgs.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.msgs = []; + } + return obj; + }, + fromAminoMsg(object: MsgExecAminoMsg): MsgExec { + return MsgExec.fromAmino(object.value); + }, + toAminoMsg(message: MsgExec): MsgExecAminoMsg { + return { + type: "cosmos-sdk/MsgExec", + value: MsgExec.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecProtoMsg): MsgExec { + return MsgExec.decode(message.value); + }, + toProto(message: MsgExec): Uint8Array { + return MsgExec.encode(message).finish(); + }, + toProtoMsg(message: MsgExec): MsgExecProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.encode(message).finish() + }; } - }; - function createBaseMsgGrantResponse(): MsgGrantResponse { return {}; } - export const MsgGrantResponse = { - encode(_: MsgGrantResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + encode(_: MsgGrantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgGrantResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgGrantResponse { + fromPartial(_: Partial): MsgGrantResponse { const message = createBaseMsgGrantResponse(); return message; + }, + fromAmino(_: MsgGrantResponseAmino): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, + toAmino(_: MsgGrantResponse): MsgGrantResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGrantResponseAminoMsg): MsgGrantResponse { + return MsgGrantResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantResponse): MsgGrantResponseAminoMsg { + return { + type: "cosmos-sdk/MsgGrantResponse", + value: MsgGrantResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantResponseProtoMsg): MsgGrantResponse { + return MsgGrantResponse.decode(message.value); + }, + toProto(message: MsgGrantResponse): Uint8Array { + return MsgGrantResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantResponse): MsgGrantResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + value: MsgGrantResponse.encode(message).finish() + }; } - }; - function createBaseMsgRevoke(): MsgRevoke { return { granter: "", @@ -303,94 +475,145 @@ function createBaseMsgRevoke(): MsgRevoke { msgTypeUrl: "" }; } - export const MsgRevoke = { - encode(message: MsgRevoke, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + encode(message: MsgRevoke, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.grantee !== "") { writer.uint32(18).string(message.grantee); } - if (message.msgTypeUrl !== "") { writer.uint32(26).string(message.msgTypeUrl); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevoke { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRevoke(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.granter = reader.string(); break; - case 2: message.grantee = reader.string(); break; - case 3: message.msgTypeUrl = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgRevoke { + fromPartial(object: Partial): MsgRevoke { const message = createBaseMsgRevoke(); message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; message.msgTypeUrl = object.msgTypeUrl ?? ""; return message; + }, + fromAmino(object: MsgRevokeAmino): MsgRevoke { + const message = createBaseMsgRevoke(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + return message; + }, + toAmino(message: MsgRevoke): MsgRevokeAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.msg_type_url = message.msgTypeUrl; + return obj; + }, + fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { + return MsgRevoke.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevoke): MsgRevokeAminoMsg { + return { + type: "cosmos-sdk/MsgRevoke", + value: MsgRevoke.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeProtoMsg): MsgRevoke { + return MsgRevoke.decode(message.value); + }, + toProto(message: MsgRevoke): Uint8Array { + return MsgRevoke.encode(message).finish(); + }, + toProtoMsg(message: MsgRevoke): MsgRevokeProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.encode(message).finish() + }; } - }; - function createBaseMsgRevokeResponse(): MsgRevokeResponse { return {}; } - export const MsgRevokeResponse = { - encode(_: MsgRevokeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + encode(_: MsgRevokeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRevokeResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgRevokeResponse { + fromPartial(_: Partial): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, + fromAmino(_: MsgRevokeResponseAmino): MsgRevokeResponse { const message = createBaseMsgRevokeResponse(); return message; + }, + toAmino(_: MsgRevokeResponse): MsgRevokeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRevokeResponseAminoMsg): MsgRevokeResponse { + return MsgRevokeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeResponse): MsgRevokeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeResponse", + value: MsgRevokeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeResponseProtoMsg): MsgRevokeResponse { + return MsgRevokeResponse.decode(message.value); + }, + toProto(message: MsgRevokeResponse): Uint8Array { + return MsgRevokeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeResponse): MsgRevokeResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + value: MsgRevokeResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/authz.ts b/src/codegen/cosmos/bank/v1beta1/authz.ts index b9c2c8c..06b3752 100644 --- a/src/codegen/cosmos/bank/v1beta1/authz.ts +++ b/src/codegen/cosmos/bank/v1beta1/authz.ts @@ -1,68 +1,108 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * 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[]; } +export interface SendAuthorizationProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.SendAuthorization"; + value: Uint8Array; +} +/** + * SendAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account. + * + * Since: cosmos-sdk 0.43 + */ +export interface SendAuthorizationAmino { + spend_limit?: CoinAmino[]; +} +export interface SendAuthorizationAminoMsg { + type: "cosmos-sdk/SendAuthorization"; + value: SendAuthorizationAmino; +} /** * SendAuthorization allows the grantee to spend up to spend_limit coins from * the granter's account. * * Since: cosmos-sdk 0.43 */ - export interface SendAuthorizationSDKType { spend_limit: CoinSDKType[]; } - function createBaseSendAuthorization(): SendAuthorization { return { spendLimit: [] }; } - export const SendAuthorization = { - encode(message: SendAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", + encode(message: SendAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.spendLimit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SendAuthorization { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.spendLimit.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SendAuthorization { + fromPartial(object: Partial): SendAuthorization { const message = createBaseSendAuthorization(); message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: SendAuthorizationAmino): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spendLimit = object.spend_limit?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: SendAuthorization): SendAuthorizationAmino { + const obj: any = {}; + if (message.spendLimit) { + obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.spend_limit = []; + } + return obj; + }, + fromAminoMsg(object: SendAuthorizationAminoMsg): SendAuthorization { + return SendAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: SendAuthorization): SendAuthorizationAminoMsg { + return { + type: "cosmos-sdk/SendAuthorization", + value: SendAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: SendAuthorizationProtoMsg): SendAuthorization { + return SendAuthorization.decode(message.value); + }, + toProto(message: SendAuthorization): Uint8Array { + return SendAuthorization.encode(message).finish(); + }, + toProtoMsg(message: SendAuthorization): SendAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", + value: SendAuthorization.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/bank.ts b/src/codegen/cosmos/bank/v1beta1/bank.ts index 94dd865..3be6817 100644 --- a/src/codegen/cosmos/bank/v1beta1/bank.ts +++ b/src/codegen/cosmos/bank/v1beta1/bank.ts @@ -1,14 +1,24 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** Params defines the parameters for the bank module. */ - export interface Params { sendEnabled: SendEnabled[]; defaultSendEnabled: boolean; } +export interface ParamsProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the bank module. */ +export interface ParamsAmino { + send_enabled?: SendEnabledAmino[]; + default_send_enabled?: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} /** Params defines the parameters for the bank module. */ - export interface ParamsSDKType { send_enabled: SendEnabledSDKType[]; default_send_enabled: boolean; @@ -17,40 +27,76 @@ export interface ParamsSDKType { * SendEnabled maps coin denom to a send_enabled status (whether a denom is * sendable). */ - export interface SendEnabled { denom: string; enabled: boolean; } +export interface SendEnabledProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled"; + value: Uint8Array; +} +/** + * SendEnabled maps coin denom to a send_enabled status (whether a denom is + * sendable). + */ +export interface SendEnabledAmino { + denom?: string; + enabled?: boolean; +} +export interface SendEnabledAminoMsg { + type: "cosmos-sdk/SendEnabled"; + value: SendEnabledAmino; +} /** * SendEnabled maps coin denom to a send_enabled status (whether a denom is * sendable). */ - export interface SendEnabledSDKType { denom: string; enabled: boolean; } /** Input models transaction input. */ - export interface Input { address: string; coins: Coin[]; } +export interface InputProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Input"; + value: Uint8Array; +} +/** Input models transaction input. */ +export interface InputAmino { + address?: string; + coins?: CoinAmino[]; +} +export interface InputAminoMsg { + type: "cosmos-sdk/Input"; + value: InputAmino; +} /** Input models transaction input. */ - export interface InputSDKType { address: string; coins: CoinSDKType[]; } /** Output models transaction outputs. */ - export interface Output { address: string; coins: Coin[]; } +export interface OutputProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Output"; + value: Uint8Array; +} +/** Output models transaction outputs. */ +export interface OutputAmino { + address?: string; + coins?: CoinAmino[]; +} +export interface OutputAminoMsg { + type: "cosmos-sdk/Output"; + value: OutputAmino; +} /** Output models transaction outputs. */ - export interface OutputSDKType { address: string; coins: CoinSDKType[]; @@ -60,20 +106,33 @@ export interface OutputSDKType { * amounts in the network. * This message is deprecated now that supply is indexed by denom. */ - /** @deprecated */ - export interface Supply { total: Coin[]; } +export interface SupplyProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Supply"; + value: Uint8Array; +} +/** + * Supply represents a struct that passively keeps track of the total supply + * amounts in the network. + * This message is deprecated now that supply is indexed by denom. + */ +/** @deprecated */ +export interface SupplyAmino { + total?: CoinAmino[]; +} +export interface SupplyAminoMsg { + type: "cosmos-sdk/Supply"; + value: SupplyAmino; +} /** * 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 SupplySDKType { total: CoinSDKType[]; } @@ -81,7 +140,6 @@ export interface SupplySDKType { * 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; @@ -92,20 +150,21 @@ export interface DenomUnit { * (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with * exponent = 6, thus: 1 atom = 10^6 uatom). */ - exponent: number; /** aliases is a list of string aliases for the given denom */ - aliases: string[]; } +export interface DenomUnitProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit"; + value: Uint8Array; +} /** * DenomUnit represents a struct that describes a given * denomination unit of the basic token. */ - -export interface DenomUnitSDKType { +export interface DenomUnitAmino { /** denom represents the string name of the given denom unit (e.g uatom). */ - denom: string; + 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 @@ -113,37 +172,43 @@ export interface DenomUnitSDKType { * (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; + exponent?: number; /** aliases is a list of string aliases for the given denom */ - + aliases?: string[]; +} +export interface DenomUnitAminoMsg { + type: "cosmos-sdk/DenomUnit"; + value: DenomUnitAmino; +} +/** + * DenomUnit represents a struct that describes a given + * denomination unit of the basic token. + */ +export interface DenomUnitSDKType { + denom: string; + exponent: number; 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 @@ -151,14 +216,12 @@ export interface Metadata { * * 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 @@ -166,325 +229,473 @@ export interface Metadata { * * Since: cosmos-sdk 0.46 */ - uriHash: string; } +export interface MetadataProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Metadata"; + value: Uint8Array; +} /** * Metadata represents a struct that describes * a basic token. */ - -export interface MetadataSDKType { - description: string; +export interface MetadataAmino { + description?: string; /** denom_units represents the list of DenomUnit's for a given coin */ - - denom_units: DenomUnitSDKType[]; + denom_units?: DenomUnitAmino[]; /** base represents the base denom (should be the DenomUnit with exponent = 0). */ - - base: string; + base?: string; /** * display indicates the suggested denom that should be * displayed in clients. */ - - display: string; + display?: string; /** * name defines the name of the token (eg: Cosmos Atom) * * Since: cosmos-sdk 0.43 */ - - name: string; + 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; + symbol?: string; /** * URI to a document (on or off-chain) that contains additional information. Optional. * * Since: cosmos-sdk 0.46 */ - - uri: string; + uri?: string; /** * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that * the document didn't change. Optional. * * Since: cosmos-sdk 0.46 */ - + uri_hash?: string; +} +export interface MetadataAminoMsg { + type: "cosmos-sdk/Metadata"; + value: MetadataAmino; +} +/** + * Metadata represents a struct that describes + * a basic token. + */ +export interface MetadataSDKType { + description: string; + denom_units: DenomUnitSDKType[]; + base: string; + display: string; + name: string; + symbol: string; + uri: string; uri_hash: string; } - function createBaseParams(): Params { return { sendEnabled: [], defaultSendEnabled: false }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.sendEnabled) { SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.defaultSendEnabled === true) { writer.uint32(16).bool(message.defaultSendEnabled); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); break; - case 2: message.defaultSendEnabled = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; message.defaultSendEnabled = object.defaultSendEnabled ?? false; return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + if (object.default_send_enabled !== undefined && object.default_send_enabled !== null) { + message.defaultSendEnabled = object.default_send_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = []; + } + obj.default_send_enabled = message.defaultSendEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Params", + value: Params.encode(message).finish() + }; } - }; - function createBaseSendEnabled(): SendEnabled { return { denom: "", enabled: false }; } - export const SendEnabled = { - encode(message: SendEnabled, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled", + encode(message: SendEnabled, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.enabled === true) { writer.uint32(16).bool(message.enabled); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SendEnabled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSendEnabled(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: message.enabled = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SendEnabled { + fromPartial(object: Partial): SendEnabled { const message = createBaseSendEnabled(); message.denom = object.denom ?? ""; message.enabled = object.enabled ?? false; return message; + }, + fromAmino(object: SendEnabledAmino): SendEnabled { + const message = createBaseSendEnabled(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.enabled !== undefined && object.enabled !== null) { + message.enabled = object.enabled; + } + return message; + }, + toAmino(message: SendEnabled): SendEnabledAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.enabled = message.enabled; + return obj; + }, + fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { + return SendEnabled.fromAmino(object.value); + }, + toAminoMsg(message: SendEnabled): SendEnabledAminoMsg { + return { + type: "cosmos-sdk/SendEnabled", + value: SendEnabled.toAmino(message) + }; + }, + fromProtoMsg(message: SendEnabledProtoMsg): SendEnabled { + return SendEnabled.decode(message.value); + }, + toProto(message: SendEnabled): Uint8Array { + return SendEnabled.encode(message).finish(); + }, + toProtoMsg(message: SendEnabled): SendEnabledProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled", + value: SendEnabled.encode(message).finish() + }; } - }; - function createBaseInput(): Input { return { address: "", coins: [] }; } - export const Input = { - encode(message: Input, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.Input", + encode(message: Input, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - for (const v of message.coins) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Input { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInput(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.coins.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Input { + fromPartial(object: Partial): Input { const message = createBaseInput(); message.address = object.address ?? ""; message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: InputAmino): Input { + const message = createBaseInput(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.coins = object.coins?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Input): InputAmino { + const obj: any = {}; + obj.address = message.address; + if (message.coins) { + obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + fromAminoMsg(object: InputAminoMsg): Input { + return Input.fromAmino(object.value); + }, + toAminoMsg(message: Input): InputAminoMsg { + return { + type: "cosmos-sdk/Input", + value: Input.toAmino(message) + }; + }, + fromProtoMsg(message: InputProtoMsg): Input { + return Input.decode(message.value); + }, + toProto(message: Input): Uint8Array { + return Input.encode(message).finish(); + }, + toProtoMsg(message: Input): InputProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Input", + value: Input.encode(message).finish() + }; } - }; - function createBaseOutput(): Output { return { address: "", coins: [] }; } - export const Output = { - encode(message: Output, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.Output", + encode(message: Output, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - for (const v of message.coins) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Output { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOutput(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.coins.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Output { + fromPartial(object: Partial): Output { const message = createBaseOutput(); message.address = object.address ?? ""; message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: OutputAmino): Output { + const message = createBaseOutput(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.coins = object.coins?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Output): OutputAmino { + const obj: any = {}; + obj.address = message.address; + if (message.coins) { + obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + fromAminoMsg(object: OutputAminoMsg): Output { + return Output.fromAmino(object.value); + }, + toAminoMsg(message: Output): OutputAminoMsg { + return { + type: "cosmos-sdk/Output", + value: Output.toAmino(message) + }; + }, + fromProtoMsg(message: OutputProtoMsg): Output { + return Output.decode(message.value); + }, + toProto(message: Output): Uint8Array { + return Output.encode(message).finish(); + }, + toProtoMsg(message: Output): OutputProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Output", + value: Output.encode(message).finish() + }; } - }; - function createBaseSupply(): Supply { return { total: [] }; } - export const Supply = { - encode(message: Supply, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.Supply", + encode(message: Supply, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.total) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Supply { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSupply(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.total.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Supply { + fromPartial(object: Partial): Supply { const message = createBaseSupply(); message.total = object.total?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: SupplyAmino): Supply { + const message = createBaseSupply(); + message.total = object.total?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Supply): SupplyAmino { + const obj: any = {}; + if (message.total) { + obj.total = message.total.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total = []; + } + return obj; + }, + fromAminoMsg(object: SupplyAminoMsg): Supply { + return Supply.fromAmino(object.value); + }, + toAminoMsg(message: Supply): SupplyAminoMsg { + return { + type: "cosmos-sdk/Supply", + value: Supply.toAmino(message) + }; + }, + fromProtoMsg(message: SupplyProtoMsg): Supply { + return Supply.decode(message.value); + }, + toProto(message: Supply): Uint8Array { + return Supply.encode(message).finish(); + }, + toProtoMsg(message: Supply): SupplyProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Supply", + value: Supply.encode(message).finish() + }; } - }; - function createBaseDenomUnit(): DenomUnit { return { denom: "", @@ -492,64 +703,94 @@ function createBaseDenomUnit(): DenomUnit { aliases: [] }; } - export const DenomUnit = { - encode(message: DenomUnit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit", + encode(message: DenomUnit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.exponent !== 0) { writer.uint32(16).uint32(message.exponent); } - for (const v of message.aliases) { writer.uint32(26).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DenomUnit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDenomUnit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: message.exponent = reader.uint32(); break; - case 3: message.aliases.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DenomUnit { + fromPartial(object: Partial): DenomUnit { const message = createBaseDenomUnit(); message.denom = object.denom ?? ""; message.exponent = object.exponent ?? 0; message.aliases = object.aliases?.map(e => e) || []; return message; + }, + fromAmino(object: DenomUnitAmino): DenomUnit { + const message = createBaseDenomUnit(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + message.aliases = object.aliases?.map(e => e) || []; + return message; + }, + toAmino(message: DenomUnit): DenomUnitAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.exponent = message.exponent; + if (message.aliases) { + obj.aliases = message.aliases.map(e => e); + } else { + obj.aliases = []; + } + return obj; + }, + fromAminoMsg(object: DenomUnitAminoMsg): DenomUnit { + return DenomUnit.fromAmino(object.value); + }, + toAminoMsg(message: DenomUnit): DenomUnitAminoMsg { + return { + type: "cosmos-sdk/DenomUnit", + value: DenomUnit.toAmino(message) + }; + }, + fromProtoMsg(message: DenomUnitProtoMsg): DenomUnit { + return DenomUnit.decode(message.value); + }, + toProto(message: DenomUnit): Uint8Array { + return DenomUnit.encode(message).finish(); + }, + toProtoMsg(message: DenomUnit): DenomUnitProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit", + value: DenomUnit.encode(message).finish() + }; } - }; - function createBaseMetadata(): Metadata { return { description: "", @@ -562,95 +803,74 @@ function createBaseMetadata(): Metadata { uriHash: "" }; } - export const Metadata = { - encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.Metadata", + encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(10).string(message.description); } - for (const v of message.denomUnits) { DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.base !== "") { writer.uint32(26).string(message.base); } - if (message.display !== "") { writer.uint32(34).string(message.display); } - if (message.name !== "") { writer.uint32(42).string(message.name); } - if (message.symbol !== "") { writer.uint32(50).string(message.symbol); } - if (message.uri !== "") { writer.uint32(58).string(message.uri); } - if (message.uriHash !== "") { writer.uint32(66).string(message.uriHash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMetadata(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.description = reader.string(); break; - case 2: message.denomUnits.push(DenomUnit.decode(reader, reader.uint32())); break; - case 3: message.base = reader.string(); break; - case 4: message.display = reader.string(); break; - case 5: message.name = reader.string(); break; - case 6: message.symbol = reader.string(); break; - case 7: message.uri = reader.string(); break; - case 8: message.uriHash = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Metadata { + fromPartial(object: Partial): Metadata { const message = createBaseMetadata(); message.description = object.description ?? ""; message.denomUnits = object.denomUnits?.map(e => DenomUnit.fromPartial(e)) || []; @@ -661,6 +881,68 @@ export const Metadata = { message.uri = object.uri ?? ""; message.uriHash = object.uriHash ?? ""; return message; + }, + fromAmino(object: MetadataAmino): Metadata { + const message = createBaseMetadata(); + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.denomUnits = object.denom_units?.map(e => DenomUnit.fromAmino(e)) || []; + if (object.base !== undefined && object.base !== null) { + message.base = object.base; + } + if (object.display !== undefined && object.display !== null) { + message.display = object.display; + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.symbol !== undefined && object.symbol !== null) { + message.symbol = object.symbol; + } + if (object.uri !== undefined && object.uri !== null) { + message.uri = object.uri; + } + if (object.uri_hash !== undefined && object.uri_hash !== null) { + message.uriHash = object.uri_hash; + } + return message; + }, + toAmino(message: Metadata): MetadataAmino { + const obj: any = {}; + obj.description = message.description; + if (message.denomUnits) { + obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); + } else { + obj.denom_units = []; + } + obj.base = message.base; + obj.display = message.display; + obj.name = message.name; + obj.symbol = message.symbol; + obj.uri = message.uri; + obj.uri_hash = message.uriHash; + return obj; + }, + fromAminoMsg(object: MetadataAminoMsg): Metadata { + return Metadata.fromAmino(object.value); + }, + toAminoMsg(message: Metadata): MetadataAminoMsg { + return { + type: "cosmos-sdk/Metadata", + value: Metadata.toAmino(message) + }; + }, + fromProtoMsg(message: MetadataProtoMsg): Metadata { + return Metadata.decode(message.value); + }, + toProto(message: Metadata): Uint8Array { + return Metadata.encode(message).finish(); + }, + toProtoMsg(message: Metadata): MetadataProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Metadata", + value: Metadata.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/genesis.ts b/src/codegen/cosmos/bank/v1beta1/genesis.ts index 9d81ac9..037563c 100644 --- a/src/codegen/cosmos/bank/v1beta1/genesis.ts +++ b/src/codegen/cosmos/bank/v1beta1/genesis.ts @@ -1,194 +1,276 @@ -import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the bank module's genesis state. */ - export interface GenesisState { /** params defines all the paramaters of the module. */ - params?: Params; + params: Params; /** balances is an array containing the balances of all the accounts. */ - balances: Balance[]; /** * supply represents the total supply. If it is left empty, then supply will be calculated based on the provided * balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. */ - supply: Coin[]; /** denom_metadata defines the metadata of the differents coins. */ - denomMetadata: Metadata[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the bank module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** params defines all the paramaters of the module. */ - params?: ParamsSDKType; + params?: ParamsAmino; /** balances is an array containing the balances of all the accounts. */ - - balances: BalanceSDKType[]; + balances?: BalanceAmino[]; /** * 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: CoinSDKType[]; + supply?: CoinAmino[]; /** denom_metadata defines the metadata of the differents coins. */ - + denom_metadata?: MetadataAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + balances: BalanceSDKType[]; + supply: CoinSDKType[]; denom_metadata: MetadataSDKType[]; } /** * 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[]; } +export interface BalanceProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Balance"; + value: Uint8Array; +} /** * Balance defines an account address and balance pair used in the bank module's * genesis state. */ - -export interface BalanceSDKType { +export interface BalanceAmino { /** address is the address of the balance holder. */ - address: string; + address?: string; /** coins defines the different coins this balance holds. */ - + coins?: CoinAmino[]; +} +export interface BalanceAminoMsg { + type: "cosmos-sdk/Balance"; + value: BalanceAmino; +} +/** + * Balance defines an account address and balance pair used in the bank module's + * genesis state. + */ +export interface BalanceSDKType { + address: string; coins: CoinSDKType[]; } - function createBaseGenesisState(): GenesisState { return { - params: undefined, + params: Params.fromPartial({}), balances: [], supply: [], denomMetadata: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - for (const v of message.balances) { Balance.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.supply) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.denomMetadata) { Metadata.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.params = Params.decode(reader, reader.uint32()); break; - case 2: message.balances.push(Balance.decode(reader, reader.uint32())); break; - case 3: message.supply.push(Coin.decode(reader, reader.uint32())); break; - case 4: message.denomMetadata.push(Metadata.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): 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)) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.balances = object.balances?.map(e => Balance.fromAmino(e)) || []; + message.supply = object.supply?.map(e => Coin.fromAmino(e)) || []; + message.denomMetadata = object.denom_metadata?.map(e => Metadata.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.balances) { + obj.balances = message.balances.map(e => e ? Balance.toAmino(e) : undefined); + } else { + obj.balances = []; + } + if (message.supply) { + obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.supply = []; + } + if (message.denomMetadata) { + obj.denom_metadata = message.denomMetadata.map(e => e ? Metadata.toAmino(e) : undefined); + } else { + obj.denom_metadata = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; - function createBaseBalance(): Balance { return { address: "", coins: [] }; } - export const Balance = { - encode(message: Balance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.Balance", + encode(message: Balance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - for (const v of message.coins) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Balance { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - case 2: message.coins.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Balance { + fromPartial(object: Partial): Balance { const message = createBaseBalance(); message.address = object.address ?? ""; message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: BalanceAmino): Balance { + const message = createBaseBalance(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.coins = object.coins?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Balance): BalanceAmino { + const obj: any = {}; + obj.address = message.address; + if (message.coins) { + obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + fromAminoMsg(object: BalanceAminoMsg): Balance { + return Balance.fromAmino(object.value); + }, + toAminoMsg(message: Balance): BalanceAminoMsg { + return { + type: "cosmos-sdk/Balance", + value: Balance.toAmino(message) + }; + }, + fromProtoMsg(message: BalanceProtoMsg): Balance { + return Balance.decode(message.value); + }, + toProto(message: Balance): Uint8Array { + return Balance.encode(message).finish(); + }, + toProtoMsg(message: Balance): BalanceProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Balance", + value: Balance.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/query.lcd.ts b/src/codegen/cosmos/bank/v1beta1/query.lcd.ts index 7535655..be56dd2 100644 --- a/src/codegen/cosmos/bank/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/bank/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryBalanceRequest, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -21,130 +20,97 @@ export class LCDQueryClient { this.denomOwners = this.denomOwners.bind(this); } /* Balance queries the balance of a single coin for a single account. */ - - async balance(params: QueryBalanceRequest): Promise { const options: any = { params: {} }; - if (typeof params?.denom !== "undefined") { options.params.denom = params.denom; } - const endpoint = `cosmos/bank/v1beta1/balances/${params.address}/by_denom`; return await this.req.get(endpoint, options); } /* AllBalances queries the balance of all coins for a single account. */ - - async allBalances(params: QueryAllBalancesRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/bank/v1beta1/balances/${params.address}`; return await this.req.get(endpoint, options); } /* SpendableBalances queries the spenable balance of all coins for a single account. */ - - async spendableBalances(params: QuerySpendableBalancesRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/bank/v1beta1/spendable_balances/${params.address}`; return await this.req.get(endpoint, options); } /* TotalSupply queries the total supply of all coins. */ - - async totalSupply(params: QueryTotalSupplyRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/bank/v1beta1/supply`; return await this.req.get(endpoint, options); } /* SupplyOf queries the supply of a single coin. */ - - async supplyOf(params: QuerySupplyOfRequest): Promise { const options: any = { params: {} }; - if (typeof params?.denom !== "undefined") { options.params.denom = params.denom; } - const endpoint = `cosmos/bank/v1beta1/supply/by_denom`; return await this.req.get(endpoint, options); } /* Params queries the parameters of x/bank module. */ - - async params(_params: QueryParamsRequest = {}): Promise { const endpoint = `cosmos/bank/v1beta1/params`; return await this.req.get(endpoint); } /* DenomsMetadata queries the client metadata of a given coin denomination. */ - - async denomMetadata(params: QueryDenomMetadataRequest): Promise { const endpoint = `cosmos/bank/v1beta1/denoms_metadata/${params.denom}`; return await this.req.get(endpoint); } /* DenomsMetadata queries the client metadata for all registered coin denominations. */ - - async denomsMetadata(params: QueryDenomsMetadataRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/bank/v1beta1/denoms_metadata`; return await this.req.get(endpoint, options); } /* DenomOwners queries for all account addresses that own a particular token denomination. */ - - async denomOwners(params: QueryDenomOwnersRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/bank/v1beta1/denom_owners/${params.denom}`; return await this.req.get(endpoint, options); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/bank/v1beta1/query.rpc.Query.ts index a60bbc8..8f3b9d9 100644 --- a/src/codegen/cosmos/bank/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/bank/v1beta1/query.rpc.Query.ts @@ -1,49 +1,39 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** Balance queries the balance of a single coin for a single account. */ balance(request: QueryBalanceRequest): Promise; /** AllBalances queries the balance of all coins for a single account. */ - allBalances(request: QueryAllBalancesRequest): Promise; /** * SpendableBalances queries the spenable balance of all coins for a single * account. */ - spendableBalances(request: QuerySpendableBalancesRequest): Promise; /** TotalSupply queries the total supply of all coins. */ - totalSupply(request?: QueryTotalSupplyRequest): Promise; /** SupplyOf queries the supply of a single coin. */ - supplyOf(request: QuerySupplyOfRequest): Promise; /** Params queries the parameters of x/bank module. */ - params(request?: QueryParamsRequest): Promise; /** DenomsMetadata queries the client metadata of a given coin denomination. */ - denomMetadata(request: QueryDenomMetadataRequest): Promise; /** * DenomsMetadata queries the client metadata for all registered coin * denominations. */ - denomsMetadata(request?: QueryDenomsMetadataRequest): Promise; /** * DenomOwners queries for all account addresses that own a particular token * denomination. */ - denomOwners(request: QueryDenomOwnersRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.balance = this.balance.bind(this); @@ -56,65 +46,55 @@ export class QueryClientImpl implements Query { this.denomsMetadata = this.denomsMetadata.bind(this); this.denomOwners = this.denomOwners.bind(this); } - balance(request: QueryBalanceRequest): Promise { const data = QueryBalanceRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "Balance", data); - return promise.then(data => QueryBalanceResponse.decode(new _m0.Reader(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("cosmos.bank.v1beta1.Query", "AllBalances", data); - return promise.then(data => QueryAllBalancesResponse.decode(new _m0.Reader(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("cosmos.bank.v1beta1.Query", "SpendableBalances", data); - return promise.then(data => QuerySpendableBalancesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QuerySpendableBalancesResponse.decode(new BinaryReader(data))); } - totalSupply(request: QueryTotalSupplyRequest = { pagination: undefined }): Promise { const data = QueryTotalSupplyRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "TotalSupply", data); - return promise.then(data => QueryTotalSupplyResponse.decode(new _m0.Reader(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("cosmos.bank.v1beta1.Query", "SupplyOf", data); - return promise.then(data => QuerySupplyOfResponse.decode(new _m0.Reader(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("cosmos.bank.v1beta1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(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("cosmos.bank.v1beta1.Query", "DenomMetadata", data); - return promise.then(data => QueryDenomMetadataResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryDenomMetadataResponse.decode(new BinaryReader(data))); } - denomsMetadata(request: QueryDenomsMetadataRequest = { pagination: undefined }): Promise { const data = QueryDenomsMetadataRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomsMetadata", data); - return promise.then(data => QueryDenomsMetadataResponse.decode(new _m0.Reader(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("cosmos.bank.v1beta1.Query", "DenomOwners", data); - return promise.then(data => QueryDenomOwnersResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryDenomOwnersResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -123,38 +103,29 @@ export const createRpcQueryExtension = (base: QueryClient) => { balance(request: QueryBalanceRequest): Promise { return queryService.balance(request); }, - allBalances(request: QueryAllBalancesRequest): Promise { return queryService.allBalances(request); }, - spendableBalances(request: QuerySpendableBalancesRequest): Promise { return queryService.spendableBalances(request); }, - totalSupply(request?: QueryTotalSupplyRequest): Promise { return queryService.totalSupply(request); }, - supplyOf(request: QuerySupplyOfRequest): Promise { return queryService.supplyOf(request); }, - params(request?: QueryParamsRequest): Promise { return queryService.params(request); }, - denomMetadata(request: QueryDenomMetadataRequest): Promise { return queryService.denomMetadata(request); }, - denomsMetadata(request?: QueryDenomsMetadataRequest): Promise { return queryService.denomsMetadata(request); }, - denomOwners(request: QueryDenomOwnersRequest): Promise { return queryService.denomOwners(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/query.ts b/src/codegen/cosmos/bank/v1beta1/query.ts index 4e17869..324cf9d 100644 --- a/src/codegen/cosmos/bank/v1beta1/query.ts +++ b/src/codegen/cosmos/bank/v1beta1/query.ts @@ -1,133 +1,195 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ - export interface QueryBalanceRequest { /** address is the address to query balances for. */ address: string; /** denom is the coin denom to query balances for. */ - denom: string; } +export interface QueryBalanceRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest"; + value: Uint8Array; +} /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ - -export interface QueryBalanceRequestSDKType { +export interface QueryBalanceRequestAmino { /** address is the address to query balances for. */ - address: string; + address?: string; /** denom is the coin denom to query balances for. */ - + denom?: string; +} +export interface QueryBalanceRequestAminoMsg { + type: "cosmos-sdk/QueryBalanceRequest"; + value: QueryBalanceRequestAmino; +} +/** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ +export interface QueryBalanceRequestSDKType { + address: string; 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; } +export interface QueryBalanceResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse"; + value: Uint8Array; +} /** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ - -export interface QueryBalanceResponseSDKType { +export interface QueryBalanceResponseAmino { /** balance is the balance of the coin. */ + balance?: CoinAmino; +} +export interface QueryBalanceResponseAminoMsg { + type: "cosmos-sdk/QueryBalanceResponse"; + value: QueryBalanceResponseAmino; +} +/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ +export interface QueryBalanceResponseSDKType { balance?: CoinSDKType; } /** 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; } +export interface QueryAllBalancesRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest"; + value: Uint8Array; +} /** QueryBalanceRequest is the request type for the Query/AllBalances RPC method. */ - -export interface QueryAllBalancesRequestSDKType { +export interface QueryAllBalancesRequestAmino { /** address is the address to query balances for. */ - address: string; + address?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryAllBalancesRequestAminoMsg { + type: "cosmos-sdk/QueryAllBalancesRequest"; + value: QueryAllBalancesRequestAmino; +} +/** QueryBalanceRequest is the request type for the Query/AllBalances RPC method. */ +export interface QueryAllBalancesRequestSDKType { + address: string; pagination?: PageRequestSDKType; } /** * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC * method. */ - export interface QueryAllBalancesResponse { /** balances is the balances of all the coins. */ balances: Coin[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryAllBalancesResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse"; + value: Uint8Array; +} /** * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC * method. */ - -export interface QueryAllBalancesResponseSDKType { +export interface QueryAllBalancesResponseAmino { /** balances is the balances of all the coins. */ - balances: CoinSDKType[]; + balances?: CoinAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryAllBalancesResponseAminoMsg { + type: "cosmos-sdk/QueryAllBalancesResponse"; + value: QueryAllBalancesResponseAmino; +} +/** + * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC + * method. + */ +export interface QueryAllBalancesResponseSDKType { + balances: CoinSDKType[]; pagination?: PageResponseSDKType; } /** * QuerySpendableBalancesRequest defines the gRPC request structure for querying * an account's spendable balances. */ - export interface QuerySpendableBalancesRequest { /** address is the address to query spendable balances for. */ address: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QuerySpendableBalancesRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest"; + value: Uint8Array; +} /** * QuerySpendableBalancesRequest defines the gRPC request structure for querying * an account's spendable balances. */ - -export interface QuerySpendableBalancesRequestSDKType { +export interface QuerySpendableBalancesRequestAmino { /** address is the address to query spendable balances for. */ - address: string; + address?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QuerySpendableBalancesRequestAminoMsg { + type: "cosmos-sdk/QuerySpendableBalancesRequest"; + value: QuerySpendableBalancesRequestAmino; +} +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + */ +export interface QuerySpendableBalancesRequestSDKType { + address: string; pagination?: PageRequestSDKType; } /** * QuerySpendableBalancesResponse defines the gRPC response structure for querying * an account's spendable balances. */ - export interface QuerySpendableBalancesResponse { /** balances is the spendable balances of all the coins. */ balances: Coin[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QuerySpendableBalancesResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse"; + value: Uint8Array; +} /** * QuerySpendableBalancesResponse defines the gRPC response structure for querying * an account's spendable balances. */ - -export interface QuerySpendableBalancesResponseSDKType { +export interface QuerySpendableBalancesResponseAmino { /** balances is the spendable balances of all the coins. */ - balances: CoinSDKType[]; + balances?: CoinAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QuerySpendableBalancesResponseAminoMsg { + type: "cosmos-sdk/QuerySpendableBalancesResponse"; + value: QuerySpendableBalancesResponseAmino; +} +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + */ +export interface QuerySpendableBalancesResponseSDKType { + balances: CoinSDKType[]; pagination?: PageResponseSDKType; } /** * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC * method. */ - export interface QueryTotalSupplyRequest { /** * pagination defines an optional pagination for the request. @@ -136,24 +198,37 @@ export interface QueryTotalSupplyRequest { */ pagination?: PageRequest; } +export interface QueryTotalSupplyRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest"; + value: Uint8Array; +} /** * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC * method. */ - -export interface QueryTotalSupplyRequestSDKType { +export interface QueryTotalSupplyRequestAmino { /** * pagination defines an optional pagination for the request. * * Since: cosmos-sdk 0.43 */ + pagination?: PageRequestAmino; +} +export interface QueryTotalSupplyRequestAminoMsg { + type: "cosmos-sdk/QueryTotalSupplyRequest"; + value: QueryTotalSupplyRequestAmino; +} +/** + * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC + * method. + */ +export interface QueryTotalSupplyRequestSDKType { pagination?: PageRequestSDKType; } /** * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC * method */ - export interface QueryTotalSupplyResponse { /** supply is the supply of the coins */ supply: Coin[]; @@ -162,155 +237,264 @@ export interface QueryTotalSupplyResponse { * * Since: cosmos-sdk 0.43 */ - pagination?: PageResponse; } +export interface QueryTotalSupplyResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse"; + value: Uint8Array; +} /** * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC * method */ - -export interface QueryTotalSupplyResponseSDKType { +export interface QueryTotalSupplyResponseAmino { /** supply is the supply of the coins */ - supply: CoinSDKType[]; + supply?: CoinAmino[]; /** * pagination defines the pagination in the response. * * Since: cosmos-sdk 0.43 */ - + pagination?: PageResponseAmino; +} +export interface QueryTotalSupplyResponseAminoMsg { + type: "cosmos-sdk/QueryTotalSupplyResponse"; + value: QueryTotalSupplyResponseAmino; +} +/** + * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC + * method + */ +export interface QueryTotalSupplyResponseSDKType { + supply: CoinSDKType[]; pagination?: PageResponseSDKType; } /** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */ - export interface QuerySupplyOfRequest { /** denom is the coin denom to query balances for. */ denom: string; } +export interface QuerySupplyOfRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest"; + value: Uint8Array; +} /** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */ - -export interface QuerySupplyOfRequestSDKType { +export interface QuerySupplyOfRequestAmino { /** denom is the coin denom to query balances for. */ + denom?: string; +} +export interface QuerySupplyOfRequestAminoMsg { + type: "cosmos-sdk/QuerySupplyOfRequest"; + value: QuerySupplyOfRequestAmino; +} +/** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfRequestSDKType { 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; + amount: Coin; +} +export interface QuerySupplyOfResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse"; + value: Uint8Array; } /** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ - -export interface QuerySupplyOfResponseSDKType { +export interface QuerySupplyOfResponseAmino { /** amount is the supply of the coin. */ - amount?: CoinSDKType; + amount?: CoinAmino; +} +export interface QuerySupplyOfResponseAminoMsg { + type: "cosmos-sdk/QuerySupplyOfResponse"; + value: QuerySupplyOfResponseAmino; +} +/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfResponseSDKType { + amount: CoinSDKType; } /** QueryParamsRequest defines the request type for querying x/bank parameters. */ - export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest defines the request type for querying x/bank parameters. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsRequest defines the request type for querying x/bank parameters. */ - export interface QueryParamsRequestSDKType {} /** QueryParamsResponse defines the response type for querying x/bank parameters. */ - export interface QueryParamsResponse { - params?: Params; + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse defines the response type for querying x/bank parameters. */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; } /** QueryParamsResponse defines the response type for querying x/bank parameters. */ - export interface QueryParamsResponseSDKType { - params?: ParamsSDKType; + params: ParamsSDKType; } /** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ - export interface QueryDenomsMetadataRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryDenomsMetadataRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest"; + value: Uint8Array; +} /** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ - -export interface QueryDenomsMetadataRequestSDKType { +export interface QueryDenomsMetadataRequestAmino { /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomsMetadataRequestAminoMsg { + type: "cosmos-sdk/QueryDenomsMetadataRequest"; + value: QueryDenomsMetadataRequestAmino; +} +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequestSDKType { pagination?: PageRequestSDKType; } /** * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC * method. */ - export interface QueryDenomsMetadataResponse { /** metadata provides the client information for all the registered tokens. */ metadatas: Metadata[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryDenomsMetadataResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse"; + value: Uint8Array; +} /** * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC * method. */ - -export interface QueryDenomsMetadataResponseSDKType { +export interface QueryDenomsMetadataResponseAmino { /** metadata provides the client information for all the registered tokens. */ - metadatas: MetadataSDKType[]; + metadatas?: MetadataAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryDenomsMetadataResponseAminoMsg { + type: "cosmos-sdk/QueryDenomsMetadataResponse"; + value: QueryDenomsMetadataResponseAmino; +} +/** + * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC + * method. + */ +export interface QueryDenomsMetadataResponseSDKType { + metadatas: MetadataSDKType[]; pagination?: PageResponseSDKType; } /** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */ - export interface QueryDenomMetadataRequest { /** denom is the coin denom to query the metadata for. */ denom: string; } +export interface QueryDenomMetadataRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest"; + value: Uint8Array; +} /** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */ - -export interface QueryDenomMetadataRequestSDKType { +export interface QueryDenomMetadataRequestAmino { /** denom is the coin denom to query the metadata for. */ + denom?: string; +} +export interface QueryDenomMetadataRequestAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataRequest"; + value: QueryDenomMetadataRequestAmino; +} +/** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */ +export interface QueryDenomMetadataRequestSDKType { 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; + metadata: Metadata; +} +export interface QueryDenomMetadataResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse"; + value: Uint8Array; } /** * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC * method. */ - -export interface QueryDenomMetadataResponseSDKType { +export interface QueryDenomMetadataResponseAmino { /** metadata describes and provides all the client information for the requested token. */ - metadata?: MetadataSDKType; + metadata?: MetadataAmino; +} +export interface QueryDenomMetadataResponseAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataResponse"; + value: QueryDenomMetadataResponseAmino; +} +/** + * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC + * method. + */ +export interface QueryDenomMetadataResponseSDKType { + metadata: MetadataSDKType; } /** * QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, * which queries for a paginated set of all account holders of a particular * denomination. */ - export interface QueryDenomOwnersRequest { /** denom defines the coin denomination to query all account holders for. */ denom: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryDenomOwnersRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest"; + value: Uint8Array; +} /** * QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, * which queries for a paginated set of all account holders of a particular * denomination. */ - -export interface QueryDenomOwnersRequestSDKType { +export interface QueryDenomOwnersRequestAmino { /** denom defines the coin denomination to query all account holders for. */ - denom: string; + denom?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryDenomOwnersRequestAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersRequest"; + value: QueryDenomOwnersRequestAmino; +} +/** + * 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 QueryDenomOwnersRequestSDKType { + denom: string; pagination?: PageRequestSDKType; } /** @@ -318,984 +502,1490 @@ export interface QueryDenomOwnersRequestSDKType { * particular denominated token. It contains the account address and account * balance of the denominated token. */ - export interface DenomOwner { /** address defines the address that owns a particular denomination. */ address: string; /** balance is the balance of the denominated coin for an account. */ - - balance?: Coin; + balance: Coin; +} +export interface DenomOwnerProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner"; + value: Uint8Array; } /** * DenomOwner defines structure representing an account that owns or holds a * particular denominated token. It contains the account address and account * balance of the denominated token. */ - -export interface DenomOwnerSDKType { +export interface DenomOwnerAmino { /** address defines the address that owns a particular denomination. */ - address: string; + address?: string; /** balance is the balance of the denominated coin for an account. */ - - balance?: CoinSDKType; + balance?: CoinAmino; +} +export interface DenomOwnerAminoMsg { + type: "cosmos-sdk/DenomOwner"; + value: DenomOwnerAmino; +} +/** + * DenomOwner defines structure representing an account that owns or holds a + * particular denominated token. It contains the account address and account + * balance of the denominated token. + */ +export interface DenomOwnerSDKType { + address: string; + balance: CoinSDKType; } /** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */ - export interface QueryDenomOwnersResponse { denomOwners: DenomOwner[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryDenomOwnersResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse"; + value: Uint8Array; +} +/** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */ +export interface QueryDenomOwnersResponseAmino { + denom_owners?: DenomOwnerAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDenomOwnersResponseAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersResponse"; + value: QueryDenomOwnersResponseAmino; +} /** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */ - export interface QueryDenomOwnersResponseSDKType { denom_owners: DenomOwnerSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } - function createBaseQueryBalanceRequest(): QueryBalanceRequest { return { address: "", denom: "" }; } - export const QueryBalanceRequest = { - encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", + encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.denom !== "") { writer.uint32(18).string(message.denom); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.denom = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryBalanceRequest { + fromPartial(object: Partial): QueryBalanceRequest { const message = createBaseQueryBalanceRequest(); message.address = object.address ?? ""; message.denom = object.denom ?? ""; return message; + }, + fromAmino(object: QueryBalanceRequestAmino): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { + const obj: any = {}; + obj.address = message.address; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { + return QueryBalanceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryBalanceRequest): QueryBalanceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryBalanceRequest", + value: QueryBalanceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBalanceRequestProtoMsg): QueryBalanceRequest { + return QueryBalanceRequest.decode(message.value); + }, + toProto(message: QueryBalanceRequest): Uint8Array { + return QueryBalanceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryBalanceRequest): QueryBalanceRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", + value: QueryBalanceRequest.encode(message).finish() + }; } - }; - function createBaseQueryBalanceResponse(): QueryBalanceResponse { return { balance: undefined }; } - export const QueryBalanceResponse = { - encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", + encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.balance !== undefined) { Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.balance = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryBalanceResponse { + fromPartial(object: Partial): QueryBalanceResponse { const message = createBaseQueryBalanceResponse(); message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; return message; + }, + fromAmino(object: QueryBalanceResponseAmino): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { + const obj: any = {}; + obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + return obj; + }, + fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { + return QueryBalanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryBalanceResponse): QueryBalanceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryBalanceResponse", + value: QueryBalanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBalanceResponseProtoMsg): QueryBalanceResponse { + return QueryBalanceResponse.decode(message.value); + }, + toProto(message: QueryBalanceResponse): Uint8Array { + return QueryBalanceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryBalanceResponse): QueryBalanceResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", + value: QueryBalanceResponse.encode(message).finish() + }; } - }; - function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { return { address: "", pagination: undefined }; } - export const QueryAllBalancesRequest = { - encode(message: QueryAllBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllBalancesRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllBalancesRequest { + fromPartial(object: Partial): QueryAllBalancesRequest { const message = createBaseQueryAllBalancesRequest(); message.address = object.address ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryAllBalancesRequestAmino): QueryAllBalancesRequest { + const message = createBaseQueryAllBalancesRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { + const obj: any = {}; + obj.address = message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllBalancesRequestAminoMsg): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllBalancesRequest): QueryAllBalancesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllBalancesRequest", + value: QueryAllBalancesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllBalancesRequestProtoMsg): QueryAllBalancesRequest { + return QueryAllBalancesRequest.decode(message.value); + }, + toProto(message: QueryAllBalancesRequest): Uint8Array { + return QueryAllBalancesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllBalancesRequest): QueryAllBalancesRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", + value: QueryAllBalancesRequest.encode(message).finish() + }; } - }; - function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { return { balances: [], pagination: undefined }; } - export const QueryAllBalancesResponse = { - encode(message: QueryAllBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.balances) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAllBalancesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.balances.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllBalancesResponse { + fromPartial(object: Partial): QueryAllBalancesResponse { const message = createBaseQueryAllBalancesResponse(); message.balances = object.balances?.map(e => Coin.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryAllBalancesResponseAmino): QueryAllBalancesResponse { + const message = createBaseQueryAllBalancesResponse(); + message.balances = object.balances?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllBalancesResponse): QueryAllBalancesResponseAmino { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.balances = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllBalancesResponseAminoMsg): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllBalancesResponse): QueryAllBalancesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllBalancesResponse", + value: QueryAllBalancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllBalancesResponseProtoMsg): QueryAllBalancesResponse { + return QueryAllBalancesResponse.decode(message.value); + }, + toProto(message: QueryAllBalancesResponse): Uint8Array { + return QueryAllBalancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllBalancesResponse): QueryAllBalancesResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", + value: QueryAllBalancesResponse.encode(message).finish() + }; } - }; - function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest { return { address: "", pagination: undefined }; } - export const QuerySpendableBalancesRequest = { - encode(message: QuerySpendableBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySpendableBalancesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySpendableBalancesRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySpendableBalancesRequest { + fromPartial(object: Partial): QuerySpendableBalancesRequest { const message = createBaseQuerySpendableBalancesRequest(); message.address = object.address ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QuerySpendableBalancesRequestAmino): QuerySpendableBalancesRequest { + const message = createBaseQuerySpendableBalancesRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { + const obj: any = {}; + obj.address = message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalancesRequestAminoMsg): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalancesRequest", + value: QuerySpendableBalancesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalancesRequestProtoMsg): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.decode(message.value); + }, + toProto(message: QuerySpendableBalancesRequest): Uint8Array { + return QuerySpendableBalancesRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", + value: QuerySpendableBalancesRequest.encode(message).finish() + }; } - }; - function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse { return { balances: [], pagination: undefined }; } - export const QuerySpendableBalancesResponse = { - encode(message: QuerySpendableBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.balances) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySpendableBalancesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySpendableBalancesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.balances.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySpendableBalancesResponse { + fromPartial(object: Partial): QuerySpendableBalancesResponse { const message = createBaseQuerySpendableBalancesResponse(); message.balances = object.balances?.map(e => Coin.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QuerySpendableBalancesResponseAmino): QuerySpendableBalancesResponse { + const message = createBaseQuerySpendableBalancesResponse(); + message.balances = object.balances?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseAmino { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.balances = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalancesResponseAminoMsg): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalancesResponse", + value: QuerySpendableBalancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalancesResponseProtoMsg): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.decode(message.value); + }, + toProto(message: QuerySpendableBalancesResponse): Uint8Array { + return QuerySpendableBalancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", + value: QuerySpendableBalancesResponse.encode(message).finish() + }; } - }; - function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { return { pagination: undefined }; } - export const QueryTotalSupplyRequest = { - encode(message: QueryTotalSupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTotalSupplyRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryTotalSupplyRequest { + fromPartial(object: Partial): QueryTotalSupplyRequest { const message = createBaseQueryTotalSupplyRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryTotalSupplyRequestAmino): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalSupplyRequestAminoMsg): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTotalSupplyRequest", + value: QueryTotalSupplyRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalSupplyRequestProtoMsg): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.decode(message.value); + }, + toProto(message: QueryTotalSupplyRequest): Uint8Array { + return QueryTotalSupplyRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", + value: QueryTotalSupplyRequest.encode(message).finish() + }; } - }; - function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { return { supply: [], pagination: undefined }; } - export const QueryTotalSupplyResponse = { - encode(message: QueryTotalSupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.supply) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTotalSupplyResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.supply.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryTotalSupplyResponse { + fromPartial(object: Partial): QueryTotalSupplyResponse { const message = createBaseQueryTotalSupplyResponse(); message.supply = object.supply?.map(e => Coin.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryTotalSupplyResponseAmino): QueryTotalSupplyResponse { + const message = createBaseQueryTotalSupplyResponse(); + message.supply = object.supply?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAmino { + const obj: any = {}; + if (message.supply) { + obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.supply = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalSupplyResponseAminoMsg): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTotalSupplyResponse", + value: QueryTotalSupplyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalSupplyResponseProtoMsg): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.decode(message.value); + }, + toProto(message: QueryTotalSupplyResponse): Uint8Array { + return QueryTotalSupplyResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", + value: QueryTotalSupplyResponse.encode(message).finish() + }; } - }; - function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { return { denom: "" }; } - export const QuerySupplyOfRequest = { - encode(message: QuerySupplyOfRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySupplyOfRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySupplyOfRequest { + fromPartial(object: Partial): QuerySupplyOfRequest { const message = createBaseQuerySupplyOfRequest(); message.denom = object.denom ?? ""; return message; + }, + fromAmino(object: QuerySupplyOfRequestAmino): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySupplyOfRequest): QuerySupplyOfRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySupplyOfRequest", + value: QuerySupplyOfRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySupplyOfRequestProtoMsg): QuerySupplyOfRequest { + return QuerySupplyOfRequest.decode(message.value); + }, + toProto(message: QuerySupplyOfRequest): Uint8Array { + return QuerySupplyOfRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySupplyOfRequest): QuerySupplyOfRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", + value: QuerySupplyOfRequest.encode(message).finish() + }; } - }; - function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { return { - amount: undefined + amount: Coin.fromPartial({}) }; } - export const QuerySupplyOfResponse = { - encode(message: QuerySupplyOfResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySupplyOfResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.amount = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySupplyOfResponse { + fromPartial(object: Partial): QuerySupplyOfResponse { const message = createBaseQuerySupplyOfResponse(); message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; + }, + fromAmino(object: QuerySupplyOfResponseAmino): QuerySupplyOfResponse { + const message = createBaseQuerySupplyOfResponse(); + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: QuerySupplyOfResponse): QuerySupplyOfResponseAmino { + const obj: any = {}; + obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySupplyOfResponseAminoMsg): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySupplyOfResponse): QuerySupplyOfResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySupplyOfResponse", + value: QuerySupplyOfResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySupplyOfResponseProtoMsg): QuerySupplyOfResponse { + return QuerySupplyOfResponse.decode(message.value); + }, + toProto(message: QuerySupplyOfResponse): Uint8Array { + return QuerySupplyOfResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySupplyOfResponse): QuerySupplyOfResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", + value: QuerySupplyOfResponse.encode(message).finish() + }; } - }; - function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } - export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParamsRequest { + fromPartial(_: Partial): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + params: Params.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { return { pagination: undefined }; } - export const QueryDenomsMetadataRequest = { - encode(message: QueryDenomsMetadataRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomsMetadataRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomsMetadataRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomsMetadataRequest { + fromPartial(object: Partial): QueryDenomsMetadataRequest { const message = createBaseQueryDenomsMetadataRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDenomsMetadataRequestAmino): QueryDenomsMetadataRequest { + const message = createBaseQueryDenomsMetadataRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomsMetadataRequestAminoMsg): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomsMetadataRequest", + value: QueryDenomsMetadataRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomsMetadataRequestProtoMsg): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.decode(message.value); + }, + toProto(message: QueryDenomsMetadataRequest): Uint8Array { + return QueryDenomsMetadataRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", + value: QueryDenomsMetadataRequest.encode(message).finish() + }; } - }; - function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { return { metadatas: [], pagination: undefined }; } - export const QueryDenomsMetadataResponse = { - encode(message: QueryDenomsMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.metadatas) { Metadata.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomsMetadataResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomsMetadataResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.metadatas.push(Metadata.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomsMetadataResponse { + fromPartial(object: Partial): QueryDenomsMetadataResponse { const message = createBaseQueryDenomsMetadataResponse(); message.metadatas = object.metadatas?.map(e => Metadata.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDenomsMetadataResponseAmino): QueryDenomsMetadataResponse { + const message = createBaseQueryDenomsMetadataResponse(); + message.metadatas = object.metadatas?.map(e => Metadata.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseAmino { + const obj: any = {}; + if (message.metadatas) { + obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e) : undefined); + } else { + obj.metadatas = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomsMetadataResponseAminoMsg): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomsMetadataResponse", + value: QueryDenomsMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomsMetadataResponseProtoMsg): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.decode(message.value); + }, + toProto(message: QueryDenomsMetadataResponse): Uint8Array { + return QueryDenomsMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", + value: QueryDenomsMetadataResponse.encode(message).finish() + }; } - }; - function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { return { denom: "" }; } - export const QueryDenomMetadataRequest = { - encode(message: QueryDenomMetadataRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomMetadataRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomMetadataRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomMetadataRequest { + fromPartial(object: Partial): QueryDenomMetadataRequest { const message = createBaseQueryDenomMetadataRequest(); message.denom = object.denom ?? ""; return message; + }, + fromAmino(object: QueryDenomMetadataRequestAmino): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataRequest", + value: QueryDenomMetadataRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataRequestProtoMsg): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.decode(message.value); + }, + toProto(message: QueryDenomMetadataRequest): Uint8Array { + return QueryDenomMetadataRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", + value: QueryDenomMetadataRequest.encode(message).finish() + }; } - }; - function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { return { - metadata: undefined + metadata: Metadata.fromPartial({}) }; } - export const QueryDenomMetadataResponse = { - encode(message: QueryDenomMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metadata !== undefined) { Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomMetadataResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomMetadataResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.metadata = Metadata.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomMetadataResponse { + fromPartial(object: Partial): QueryDenomMetadataResponse { const message = createBaseQueryDenomMetadataResponse(); message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; return message; + }, + fromAmino(object: QueryDenomMetadataResponseAmino): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Metadata.fromAmino(object.metadata); + } + return message; + }, + toAmino(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseAmino { + const obj: any = {}; + obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataResponseAminoMsg): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataResponse", + value: QueryDenomMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataResponseProtoMsg): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.decode(message.value); + }, + toProto(message: QueryDenomMetadataResponse): Uint8Array { + return QueryDenomMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", + value: QueryDenomMetadataResponse.encode(message).finish() + }; } - }; - function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { return { denom: "", pagination: undefined }; } - export const QueryDenomOwnersRequest = { - encode(message: QueryDenomOwnersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", + encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomOwnersRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomOwnersRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomOwnersRequest { + fromPartial(object: Partial): QueryDenomOwnersRequest { const message = createBaseQueryDenomOwnersRequest(); message.denom = object.denom ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDenomOwnersRequestAmino): QueryDenomOwnersRequest { + const message = createBaseQueryDenomOwnersRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersRequestAminoMsg): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersRequest", + value: QueryDenomOwnersRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersRequestProtoMsg): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.decode(message.value); + }, + toProto(message: QueryDenomOwnersRequest): Uint8Array { + return QueryDenomOwnersRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", + value: QueryDenomOwnersRequest.encode(message).finish() + }; } - }; - function createBaseDenomOwner(): DenomOwner { return { address: "", - balance: undefined + balance: Coin.fromPartial({}) }; } - export const DenomOwner = { - encode(message: DenomOwner, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner", + encode(message: DenomOwner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.balance !== undefined) { Coin.encode(message.balance, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DenomOwner { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDenomOwner(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.balance = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DenomOwner { + fromPartial(object: Partial): DenomOwner { const message = createBaseDenomOwner(); message.address = object.address ?? ""; message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; return message; + }, + fromAmino(object: DenomOwnerAmino): DenomOwner { + const message = createBaseDenomOwner(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: DenomOwner): DenomOwnerAmino { + const obj: any = {}; + obj.address = message.address; + obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + return obj; + }, + fromAminoMsg(object: DenomOwnerAminoMsg): DenomOwner { + return DenomOwner.fromAmino(object.value); + }, + toAminoMsg(message: DenomOwner): DenomOwnerAminoMsg { + return { + type: "cosmos-sdk/DenomOwner", + value: DenomOwner.toAmino(message) + }; + }, + fromProtoMsg(message: DenomOwnerProtoMsg): DenomOwner { + return DenomOwner.decode(message.value); + }, + toProto(message: DenomOwner): Uint8Array { + return DenomOwner.encode(message).finish(); + }, + toProtoMsg(message: DenomOwner): DenomOwnerProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner", + value: DenomOwner.encode(message).finish() + }; } - }; - function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { return { denomOwners: [], pagination: undefined }; } - export const QueryDenomOwnersResponse = { - encode(message: QueryDenomOwnersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", + encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denomOwners) { DenomOwner.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomOwnersResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomOwnersResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomOwnersResponse { + fromPartial(object: Partial): QueryDenomOwnersResponse { const message = createBaseQueryDenomOwnersResponse(); message.denomOwners = object.denomOwners?.map(e => DenomOwner.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDenomOwnersResponseAmino): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denom_owners?.map(e => DenomOwner.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseAmino { + const obj: any = {}; + if (message.denomOwners) { + obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); + } else { + obj.denom_owners = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersResponseAminoMsg): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersResponse", + value: QueryDenomOwnersResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersResponseProtoMsg): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.decode(message.value); + }, + toProto(message: QueryDenomOwnersResponse): Uint8Array { + return QueryDenomOwnersResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", + value: QueryDenomOwnersResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/tx.amino.ts b/src/codegen/cosmos/bank/v1beta1/tx.amino.ts index ea2280e..1aa9a24 100644 --- a/src/codegen/cosmos/bank/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/bank/v1beta1/tx.amino.ts @@ -1,110 +1,13 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgSend, MsgMultiSend } from "./tx"; -export interface AminoMsgSend extends AminoMsg { - type: "cosmos-sdk/MsgSend"; - value: { - from_address: string; - to_address: string; - amount: { - denom: string; - amount: string; - }[]; - }; -} -export interface AminoMsgMultiSend extends AminoMsg { - type: "cosmos-sdk/MsgMultiSend"; - value: { - inputs: { - address: string; - coins: { - denom: string; - amount: string; - }[]; - }[]; - outputs: { - address: string; - coins: { - denom: string; - amount: string; - }[]; - }[]; - }; -} export const AminoConverter = { "/cosmos.bank.v1beta1.MsgSend": { aminoType: "cosmos-sdk/MsgSend", - toAmino: ({ - fromAddress, - toAddress, - amount - }: MsgSend): AminoMsgSend["value"] => { - return { - from_address: fromAddress, - to_address: toAddress, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })) - }; - }, - fromAmino: ({ - from_address, - to_address, - amount - }: AminoMsgSend["value"]): MsgSend => { - return { - fromAddress: from_address, - toAddress: to_address, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })) - }; - } + toAmino: MsgSend.toAmino, + fromAmino: MsgSend.fromAmino }, "/cosmos.bank.v1beta1.MsgMultiSend": { aminoType: "cosmos-sdk/MsgMultiSend", - toAmino: ({ - inputs, - outputs - }: MsgMultiSend): AminoMsgMultiSend["value"] => { - return { - inputs: inputs.map(el0 => ({ - address: el0.address, - coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount - })) - })), - outputs: outputs.map(el0 => ({ - address: el0.address, - coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount - })) - })) - }; - }, - fromAmino: ({ - inputs, - outputs - }: AminoMsgMultiSend["value"]): MsgMultiSend => { - return { - inputs: inputs.map(el0 => ({ - address: el0.address, - coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount - })) - })), - outputs: outputs.map(el0 => ({ - address: el0.address, - coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount - })) - })) - }; - } + toAmino: MsgMultiSend.toAmino, + fromAmino: MsgMultiSend.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/tx.registry.ts b/src/codegen/cosmos/bank/v1beta1/tx.registry.ts index 5bc1dee..9a00ea4 100644 --- a/src/codegen/cosmos/bank/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/bank/v1beta1/tx.registry.ts @@ -14,14 +14,12 @@ export const MessageComposer = { value: MsgSend.encode(value).finish() }; }, - multiSend(value: MsgMultiSend) { return { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.encode(value).finish() }; } - }, withTypeUrl: { send(value: MsgSend) { @@ -30,14 +28,12 @@ export const MessageComposer = { value }; }, - multiSend(value: MsgMultiSend) { return { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value }; } - }, fromPartial: { send(value: MsgSend) { @@ -46,13 +42,11 @@ export const MessageComposer = { value: MsgSend.fromPartial(value) }; }, - multiSend(value: MsgMultiSend) { return { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/bank/v1beta1/tx.rpc.msg.ts index 4112bb9..370da8f 100644 --- a/src/codegen/cosmos/bank/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -1,34 +1,28 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendResponse, MsgMultiSend, MsgMultiSendResponse } from "./tx"; /** Msg defines the bank Msg service. */ - export interface Msg { /** Send defines a method for sending coins from one account to another account. */ send(request: MsgSend): Promise; /** MultiSend defines a method for sending coins from some accounts to other accounts. */ - multiSend(request: MsgMultiSend): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); } - send(request: MsgSend): Promise { const data = MsgSend.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data); - return promise.then(data => MsgSendResponse.decode(new _m0.Reader(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("cosmos.bank.v1beta1.Msg", "MultiSend", data); - return promise.then(data => MsgMultiSendResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgMultiSendResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/bank/v1beta1/tx.ts b/src/codegen/cosmos/bank/v1beta1/tx.ts index 25716b1..7376447 100644 --- a/src/codegen/cosmos/bank/v1beta1/tx.ts +++ b/src/codegen/cosmos/bank/v1beta1/tx.ts @@ -1,46 +1,83 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType } from "./bank"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** MsgSend represents a message to send coins from one account to another. */ - export interface MsgSend { fromAddress: string; toAddress: string; amount: Coin[]; } +export interface MsgSendProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSend"; + value: Uint8Array; +} +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSendAmino { + from_address?: string; + to_address?: string; + amount?: CoinAmino[]; +} +export interface MsgSendAminoMsg { + type: "cosmos-sdk/MsgSend"; + value: MsgSendAmino; +} /** MsgSend represents a message to send coins from one account to another. */ - export interface MsgSendSDKType { from_address: string; to_address: string; amount: CoinSDKType[]; } /** MsgSendResponse defines the Msg/Send response type. */ - export interface MsgSendResponse {} +export interface MsgSendResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse"; + value: Uint8Array; +} +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponseAmino {} +export interface MsgSendResponseAminoMsg { + type: "cosmos-sdk/MsgSendResponse"; + value: MsgSendResponseAmino; +} /** MsgSendResponse defines the Msg/Send response type. */ - export interface MsgSendResponseSDKType {} /** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ - export interface MsgMultiSend { inputs: Input[]; outputs: Output[]; } +export interface MsgMultiSendProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend"; + value: Uint8Array; +} +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ +export interface MsgMultiSendAmino { + inputs?: InputAmino[]; + outputs?: OutputAmino[]; +} +export interface MsgMultiSendAminoMsg { + type: "cosmos-sdk/MsgMultiSend"; + value: MsgMultiSendAmino; +} /** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ - export interface MsgMultiSendSDKType { inputs: InputSDKType[]; outputs: OutputSDKType[]; } /** MsgMultiSendResponse defines the Msg/MultiSend response type. */ - export interface MsgMultiSendResponse {} +export interface MsgMultiSendResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse"; + value: Uint8Array; +} +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponseAmino {} +export interface MsgMultiSendResponseAminoMsg { + type: "cosmos-sdk/MsgMultiSendResponse"; + value: MsgMultiSendResponseAmino; +} /** MsgMultiSendResponse defines the Msg/MultiSend response type. */ - export interface MsgMultiSendResponseSDKType {} - function createBaseMsgSend(): MsgSend { return { fromAddress: "", @@ -48,183 +85,288 @@ function createBaseMsgSend(): MsgSend { amount: [] }; } - export const MsgSend = { - encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== "") { writer.uint32(18).string(message.toAddress); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.fromAddress = reader.string(); break; - case 2: message.toAddress = reader.string(); break; - case 3: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSend { + fromPartial(object: Partial): MsgSend { const message = createBaseMsgSend(); message.fromAddress = object.fromAddress ?? ""; message.toAddress = object.toAddress ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgSendAmino): MsgSend { + const message = createBaseMsgSend(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgSend): MsgSendAmino { + const obj: any = {}; + obj.from_address = message.fromAddress; + obj.to_address = message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgSendAminoMsg): MsgSend { + return MsgSend.fromAmino(object.value); + }, + toAminoMsg(message: MsgSend): MsgSendAminoMsg { + return { + type: "cosmos-sdk/MsgSend", + value: MsgSend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendProtoMsg): MsgSend { + return MsgSend.decode(message.value); + }, + toProto(message: MsgSend): Uint8Array { + return MsgSend.encode(message).finish(); + }, + toProtoMsg(message: MsgSend): MsgSendProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: MsgSend.encode(message).finish() + }; } - }; - function createBaseMsgSendResponse(): MsgSendResponse { return {}; } - export const MsgSendResponse = { - encode(_: MsgSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", + encode(_: MsgSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgSendResponse { + fromPartial(_: Partial): MsgSendResponse { const message = createBaseMsgSendResponse(); return message; + }, + fromAmino(_: MsgSendResponseAmino): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, + toAmino(_: MsgSendResponse): MsgSendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSendResponseAminoMsg): MsgSendResponse { + return MsgSendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSendResponse): MsgSendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSendResponse", + value: MsgSendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendResponseProtoMsg): MsgSendResponse { + return MsgSendResponse.decode(message.value); + }, + toProto(message: MsgSendResponse): Uint8Array { + return MsgSendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSendResponse): MsgSendResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", + value: MsgSendResponse.encode(message).finish() + }; } - }; - function createBaseMsgMultiSend(): MsgMultiSend { return { inputs: [], outputs: [] }; } - export const MsgMultiSend = { - encode(message: MsgMultiSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", + encode(message: MsgMultiSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.inputs) { Input.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.outputs) { Output.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSend { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgMultiSend(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.inputs.push(Input.decode(reader, reader.uint32())); break; - case 2: message.outputs.push(Output.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgMultiSend { + fromPartial(object: Partial): MsgMultiSend { const message = createBaseMsgMultiSend(); message.inputs = object.inputs?.map(e => Input.fromPartial(e)) || []; message.outputs = object.outputs?.map(e => Output.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgMultiSendAmino): MsgMultiSend { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map(e => Input.fromAmino(e)) || []; + message.outputs = object.outputs?.map(e => Output.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgMultiSend): MsgMultiSendAmino { + const obj: any = {}; + if (message.inputs) { + obj.inputs = message.inputs.map(e => e ? Input.toAmino(e) : undefined); + } else { + obj.inputs = []; + } + if (message.outputs) { + obj.outputs = message.outputs.map(e => e ? Output.toAmino(e) : undefined); + } else { + obj.outputs = []; + } + return obj; + }, + fromAminoMsg(object: MsgMultiSendAminoMsg): MsgMultiSend { + return MsgMultiSend.fromAmino(object.value); + }, + toAminoMsg(message: MsgMultiSend): MsgMultiSendAminoMsg { + return { + type: "cosmos-sdk/MsgMultiSend", + value: MsgMultiSend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMultiSendProtoMsg): MsgMultiSend { + return MsgMultiSend.decode(message.value); + }, + toProto(message: MsgMultiSend): Uint8Array { + return MsgMultiSend.encode(message).finish(); + }, + toProtoMsg(message: MsgMultiSend): MsgMultiSendProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", + value: MsgMultiSend.encode(message).finish() + }; } - }; - function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { return {}; } - export const MsgMultiSendResponse = { - encode(_: MsgMultiSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", + encode(_: MsgMultiSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSendResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgMultiSendResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgMultiSendResponse { + fromPartial(_: Partial): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, + fromAmino(_: MsgMultiSendResponseAmino): MsgMultiSendResponse { const message = createBaseMsgMultiSendResponse(); return message; + }, + toAmino(_: MsgMultiSendResponse): MsgMultiSendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgMultiSendResponseAminoMsg): MsgMultiSendResponse { + return MsgMultiSendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgMultiSendResponse): MsgMultiSendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgMultiSendResponse", + value: MsgMultiSendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMultiSendResponseProtoMsg): MsgMultiSendResponse { + return MsgMultiSendResponse.decode(message.value); + }, + toProto(message: MsgMultiSendResponse): Uint8Array { + return MsgMultiSendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgMultiSendResponse): MsgMultiSendResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", + value: MsgMultiSendResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/abci/v1beta1/abci.ts b/src/codegen/cosmos/base/abci/v1beta1/abci.ts index 6dfe82c..a1e4836 100644 --- a/src/codegen/cosmos/base/abci/v1beta1/abci.ts +++ b/src/codegen/cosmos/base/abci/v1beta1/abci.ts @@ -1,54 +1,42 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { Event, EventSDKType } from "../../../../tendermint/abci/types"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Event, EventAmino, EventSDKType } from "../../../../tendermint/abci/types"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * 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: Long; + height: bigint; /** The transaction hash. */ - txhash: string; /** Namespace for the Code */ - codespace: string; /** Response code. */ - code: number; /** Result bytes, if any. */ - data: string; /** * The output of the application's logger (raw string). May be * non-deterministic. */ - rawLog: string; /** The output of the application's logger (typed). May be non-deterministic. */ - logs: ABCIMessageLog[]; /** Additional information. May be non-deterministic. */ - info: string; /** Amount of gas requested for transaction. */ - - gasWanted: Long; + gasWanted: bigint; /** Amount of gas consumed by transaction. */ - - gasUsed: Long; + gasUsed: bigint; /** The request transaction bytes. */ - tx?: Any; /** * Time of the previous block. For heights > 1, it's the weighted median of * the timestamps of the valid votes in the block.LastCommit. For height == 1, * it's genesis time. */ - timestamp: string; /** * Events defines all the events emitted by processing a transaction. Note, @@ -58,57 +46,48 @@ export interface TxResponse { * * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 */ - events: Event[]; } +export interface TxResponseProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse"; + value: Uint8Array; +} /** * TxResponse defines a structure containing relevant tx data and metadata. The * tags are stringified and the log is JSON decoded. */ - -export interface TxResponseSDKType { +export interface TxResponseAmino { /** The block height */ - height: Long; + height?: string; /** The transaction hash. */ - - txhash: string; + txhash?: string; /** Namespace for the Code */ - - codespace: string; + codespace?: string; /** Response code. */ - - code: number; + code?: number; /** Result bytes, if any. */ - - data: string; + data?: string; /** * The output of the application's logger (raw string). May be * non-deterministic. */ - - raw_log: string; + raw_log?: string; /** The output of the application's logger (typed). May be non-deterministic. */ - - logs: ABCIMessageLogSDKType[]; + logs?: ABCIMessageLogAmino[]; /** Additional information. May be non-deterministic. */ - - info: string; + info?: string; /** Amount of gas requested for transaction. */ - - gas_wanted: Long; + gas_wanted?: string; /** Amount of gas consumed by transaction. */ - - gas_used: Long; + gas_used?: string; /** The request transaction bytes. */ - - tx?: AnySDKType; + tx?: AnyAmino; /** * Time of the previous block. For heights > 1, it's the weighted median of * the timestamps of the valid votes in the block.LastCommit. For height == 1, * it's genesis time. */ - - timestamp: string; + 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 @@ -117,11 +96,32 @@ export interface TxResponseSDKType { * * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 */ - + events?: EventAmino[]; +} +export interface TxResponseAminoMsg { + type: "cosmos-sdk/TxResponse"; + value: TxResponseAmino; +} +/** + * TxResponse defines a structure containing relevant tx data and metadata. The + * tags are stringified and the log is JSON decoded. + */ +export interface TxResponseSDKType { + height: bigint; + txhash: string; + codespace: string; + code: number; + data: string; + raw_log: string; + logs: ABCIMessageLogSDKType[]; + info: string; + gas_wanted: bigint; + gas_used: bigint; + tx?: AnySDKType; + timestamp: string; events: EventSDKType[]; } /** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ - export interface ABCIMessageLog { msgIndex: number; log: string; @@ -129,35 +129,60 @@ export interface ABCIMessageLog { * Events contains a slice of Event objects that were emitted during some * execution. */ - events: StringEvent[]; } +export interface ABCIMessageLogProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog"; + value: Uint8Array; +} /** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ - -export interface ABCIMessageLogSDKType { - msg_index: number; - log: string; +export interface ABCIMessageLogAmino { + msg_index?: number; + log?: string; /** * Events contains a slice of Event objects that were emitted during some * execution. */ - + events?: StringEventAmino[]; +} +export interface ABCIMessageLogAminoMsg { + type: "cosmos-sdk/ABCIMessageLog"; + value: ABCIMessageLogAmino; +} +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLogSDKType { + msg_index: number; + log: string; events: StringEventSDKType[]; } /** * StringEvent defines en Event object wrapper where all the attributes * contain key/value pairs that are strings instead of raw bytes. */ - export interface StringEvent { type: string; attributes: Attribute[]; } +export interface StringEventProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent"; + value: Uint8Array; +} +/** + * StringEvent defines en Event object wrapper where all the attributes + * contain key/value pairs that are strings instead of raw bytes. + */ +export interface StringEventAmino { + type?: string; + attributes?: AttributeAmino[]; +} +export interface StringEventAminoMsg { + type: "cosmos-sdk/StringEvent"; + value: StringEventAmino; +} /** * StringEvent defines en Event object wrapper where all the attributes * contain key/value pairs that are strings instead of raw bytes. */ - export interface StringEventSDKType { type: string; attributes: AttributeSDKType[]; @@ -166,40 +191,62 @@ export interface StringEventSDKType { * Attribute defines an attribute wrapper where the key and value are * strings instead of raw bytes. */ - export interface Attribute { key: string; value: string; } +export interface AttributeProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute"; + value: Uint8Array; +} +/** + * Attribute defines an attribute wrapper where the key and value are + * strings instead of raw bytes. + */ +export interface AttributeAmino { + key?: string; + value?: string; +} +export interface AttributeAminoMsg { + type: "cosmos-sdk/Attribute"; + value: AttributeAmino; +} /** * Attribute defines an attribute wrapper where the key and value are * strings instead of raw bytes. */ - export interface AttributeSDKType { 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: Long; + gasWanted: bigint; /** GasUsed is the amount of gas actually consumed. */ - - gasUsed: Long; + gasUsed: bigint; +} +export interface GasInfoProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo"; + value: Uint8Array; } /** GasInfo defines tx execution gas context. */ - -export interface GasInfoSDKType { +export interface GasInfoAmino { /** GasWanted is the maximum units of work we allow this tx to perform. */ - gas_wanted: Long; + gas_wanted?: string; /** GasUsed is the amount of gas actually consumed. */ - - gas_used: Long; + gas_used?: string; +} +export interface GasInfoAminoMsg { + type: "cosmos-sdk/GasInfo"; + value: GasInfoAmino; +} +/** GasInfo defines tx execution gas context. */ +export interface GasInfoSDKType { + gas_wanted: bigint; + gas_used: bigint; } /** Result is the union of ResponseFormat and ResponseCheckTx. */ - export interface Result { /** * Data is any data returned from message or handler execution. It MUST be @@ -207,91 +254,125 @@ export interface Result { * Deprecated. This field is still populated, but prefer msg_response instead * because it also contains the Msg response typeURL. */ - /** @deprecated */ data: Uint8Array; /** Log contains the log information from message or handler execution. */ - log: string; /** * Events contains a slice of Event objects that were emitted during message * or handler execution. */ - events: Event[]; /** * msg_responses contains the Msg handler responses type packed in Anys. * * Since: cosmos-sdk 0.46 */ - msgResponses: Any[]; } +export interface ResultProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.Result"; + value: Uint8Array; +} /** Result is the union of ResponseFormat and ResponseCheckTx. */ - -export interface ResultSDKType { +export interface ResultAmino { /** * Data is any data returned from message or handler execution. It MUST be * length prefixed in order to separate data from multiple message executions. * Deprecated. This field is still populated, but prefer msg_response instead * because it also contains the Msg response typeURL. */ - /** @deprecated */ - data: Uint8Array; + data?: string; /** Log contains the log information from message or handler execution. */ - - log: string; + log?: string; /** * Events contains a slice of Event objects that were emitted during message * or handler execution. */ - - events: EventSDKType[]; + events?: EventAmino[]; /** * msg_responses contains the Msg handler responses type packed in Anys. * * Since: cosmos-sdk 0.46 */ - + msg_responses?: AnyAmino[]; +} +export interface ResultAminoMsg { + type: "cosmos-sdk/Result"; + value: ResultAmino; +} +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface ResultSDKType { + /** @deprecated */ + data: Uint8Array; + log: string; + events: EventSDKType[]; msg_responses: AnySDKType[]; } /** * SimulationResponse defines the response generated when a transaction is * successfully simulated. */ - export interface SimulationResponse { - gasInfo?: GasInfo; + gasInfo: GasInfo; result?: Result; } +export interface SimulationResponseProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse"; + value: Uint8Array; +} +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponseAmino { + gas_info?: GasInfoAmino; + result?: ResultAmino; +} +export interface SimulationResponseAminoMsg { + type: "cosmos-sdk/SimulationResponse"; + value: SimulationResponseAmino; +} /** * SimulationResponse defines the response generated when a transaction is * successfully simulated. */ - export interface SimulationResponseSDKType { - gas_info?: GasInfoSDKType; + gas_info: GasInfoSDKType; result?: ResultSDKType; } /** * MsgData defines the data returned in a Result object during message * execution. */ - /** @deprecated */ - export interface MsgData { msgType: string; data: Uint8Array; } +export interface MsgDataProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData"; + value: Uint8Array; +} +/** + * MsgData defines the data returned in a Result object during message + * execution. + */ +/** @deprecated */ +export interface MsgDataAmino { + msg_type?: string; + data?: string; +} +export interface MsgDataAminoMsg { + type: "cosmos-sdk/MsgData"; + value: MsgDataAmino; +} /** * MsgData defines the data returned in a Result object during message * execution. */ - /** @deprecated */ - export interface MsgDataSDKType { msg_type: string; data: Uint8Array; @@ -300,10 +381,8 @@ export interface MsgDataSDKType { * 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[]; /** @@ -311,73 +390,90 @@ export interface TxMsgData { * * Since: cosmos-sdk 0.46 */ - msgResponses: Any[]; } +export interface TxMsgDataProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData"; + value: Uint8Array; +} /** * TxMsgData defines a list of MsgData. A transaction will have a MsgData object * for each message. */ - -export interface TxMsgDataSDKType { +export interface TxMsgDataAmino { /** data field is deprecated and not populated. */ - /** @deprecated */ - data: MsgDataSDKType[]; + data?: MsgDataAmino[]; /** * msg_responses contains the Msg handler responses packed into Anys. * * Since: cosmos-sdk 0.46 */ - + msg_responses?: AnyAmino[]; +} +export interface TxMsgDataAminoMsg { + type: "cosmos-sdk/TxMsgData"; + value: TxMsgDataAmino; +} +/** + * TxMsgData defines a list of MsgData. A transaction will have a MsgData object + * for each message. + */ +export interface TxMsgDataSDKType { + /** @deprecated */ + data: MsgDataSDKType[]; msg_responses: AnySDKType[]; } /** SearchTxsResult defines a structure for querying txs pageable */ - export interface SearchTxsResult { /** Count of all txs */ - totalCount: Long; + totalCount: bigint; /** Count of txs in current page */ - - count: Long; + count: bigint; /** Index of current page, start from 1 */ - - pageNumber: Long; + pageNumber: bigint; /** Count of total pages */ - - pageTotal: Long; + pageTotal: bigint; /** Max count txs per page */ - - limit: Long; + limit: bigint; /** List of txs in current page */ - txs: TxResponse[]; } +export interface SearchTxsResultProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult"; + value: Uint8Array; +} /** SearchTxsResult defines a structure for querying txs pageable */ - -export interface SearchTxsResultSDKType { +export interface SearchTxsResultAmino { /** Count of all txs */ - total_count: Long; + total_count?: string; /** Count of txs in current page */ - - count: Long; + count?: string; /** Index of current page, start from 1 */ - - page_number: Long; + page_number?: string; /** Count of total pages */ - - page_total: Long; + page_total?: string; /** Max count txs per page */ - - limit: Long; + limit?: string; /** List of txs in current page */ - + txs?: TxResponseAmino[]; +} +export interface SearchTxsResultAminoMsg { + type: "cosmos-sdk/SearchTxsResult"; + value: SearchTxsResultAmino; +} +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResultSDKType { + total_count: bigint; + count: bigint; + page_number: bigint; + page_total: bigint; + limit: bigint; txs: TxResponseSDKType[]; } - function createBaseTxResponse(): TxResponse { return { - height: Long.ZERO, + height: BigInt(0), txhash: "", codespace: "", code: 0, @@ -385,144 +481,113 @@ function createBaseTxResponse(): TxResponse { rawLog: "", logs: [], info: "", - gasWanted: Long.ZERO, - gasUsed: Long.ZERO, + gasWanted: BigInt(0), + gasUsed: BigInt(0), tx: undefined, timestamp: "", events: [] }; } - export const TxResponse = { - encode(message: TxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", + encode(message: TxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - if (message.txhash !== "") { writer.uint32(18).string(message.txhash); } - if (message.codespace !== "") { writer.uint32(26).string(message.codespace); } - if (message.code !== 0) { writer.uint32(32).uint32(message.code); } - if (message.data !== "") { writer.uint32(42).string(message.data); } - if (message.rawLog !== "") { writer.uint32(50).string(message.rawLog); } - for (const v of message.logs) { ABCIMessageLog.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.info !== "") { writer.uint32(66).string(message.info); } - - if (!message.gasWanted.isZero()) { + if (message.gasWanted !== BigInt(0)) { writer.uint32(72).int64(message.gasWanted); } - - if (!message.gasUsed.isZero()) { + if (message.gasUsed !== BigInt(0)) { writer.uint32(80).int64(message.gasUsed); } - if (message.tx !== undefined) { Any.encode(message.tx, writer.uint32(90).fork()).ldelim(); } - if (message.timestamp !== "") { writer.uint32(98).string(message.timestamp); } - for (const v of message.events) { Event.encode(v!, writer.uint32(106).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TxResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTxResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 2: message.txhash = reader.string(); break; - case 3: message.codespace = reader.string(); break; - case 4: message.code = reader.uint32(); break; - case 5: message.data = reader.string(); break; - case 6: message.rawLog = reader.string(); break; - case 7: message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); break; - case 8: message.info = reader.string(); break; - case 9: - message.gasWanted = (reader.int64() as Long); + message.gasWanted = reader.int64(); break; - case 10: - message.gasUsed = (reader.int64() as Long); + message.gasUsed = reader.int64(); break; - case 11: message.tx = Any.decode(reader, reader.uint32()); break; - case 12: message.timestamp = reader.string(); break; - case 13: message.events.push(Event.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TxResponse { + fromPartial(object: Partial): TxResponse { const message = createBaseTxResponse(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.txhash = object.txhash ?? ""; message.codespace = object.codespace ?? ""; message.code = object.code ?? 0; @@ -530,16 +595,99 @@ export const TxResponse = { message.rawLog = object.rawLog ?? ""; message.logs = object.logs?.map(e => ABCIMessageLog.fromPartial(e)) || []; message.info = object.info ?? ""; - message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? Long.fromValue(object.gasWanted) : Long.ZERO; - message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? Long.fromValue(object.gasUsed) : Long.ZERO; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); message.tx = object.tx !== undefined && object.tx !== null ? Any.fromPartial(object.tx) : undefined; message.timestamp = object.timestamp ?? ""; message.events = object.events?.map(e => Event.fromPartial(e)) || []; return message; + }, + fromAmino(object: TxResponseAmino): TxResponse { + const message = createBaseTxResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.txhash !== undefined && object.txhash !== null) { + message.txhash = object.txhash; + } + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = object.data; + } + if (object.raw_log !== undefined && object.raw_log !== null) { + message.rawLog = object.raw_log; + } + message.logs = object.logs?.map(e => ABCIMessageLog.fromAmino(e)) || []; + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + if (object.tx !== undefined && object.tx !== null) { + message.tx = Any.fromAmino(object.tx); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = object.timestamp; + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxResponse): TxResponseAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.txhash = message.txhash; + obj.codespace = message.codespace; + obj.code = message.code; + obj.data = message.data; + obj.raw_log = message.rawLog; + if (message.logs) { + obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); + } else { + obj.logs = []; + } + obj.info = message.info; + obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; + obj.timestamp = message.timestamp; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + fromAminoMsg(object: TxResponseAminoMsg): TxResponse { + return TxResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxResponse): TxResponseAminoMsg { + return { + type: "cosmos-sdk/TxResponse", + value: TxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxResponseProtoMsg): TxResponse { + return TxResponse.decode(message.value); + }, + toProto(message: TxResponse): Uint8Array { + return TxResponse.encode(message).finish(); + }, + toProtoMsg(message: TxResponse): TxResponseProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", + value: TxResponse.encode(message).finish() + }; } - }; - function createBaseABCIMessageLog(): ABCIMessageLog { return { msgIndex: 0, @@ -547,229 +695,339 @@ function createBaseABCIMessageLog(): ABCIMessageLog { events: [] }; } - export const ABCIMessageLog = { - encode(message: ABCIMessageLog, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", + encode(message: ABCIMessageLog, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgIndex !== 0) { writer.uint32(8).uint32(message.msgIndex); } - if (message.log !== "") { writer.uint32(18).string(message.log); } - for (const v of message.events) { StringEvent.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ABCIMessageLog { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseABCIMessageLog(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.msgIndex = reader.uint32(); break; - case 2: message.log = reader.string(); break; - case 3: message.events.push(StringEvent.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ABCIMessageLog { + fromPartial(object: Partial): ABCIMessageLog { const message = createBaseABCIMessageLog(); message.msgIndex = object.msgIndex ?? 0; message.log = object.log ?? ""; message.events = object.events?.map(e => StringEvent.fromPartial(e)) || []; return message; + }, + fromAmino(object: ABCIMessageLogAmino): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + if (object.msg_index !== undefined && object.msg_index !== null) { + message.msgIndex = object.msg_index; + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + message.events = object.events?.map(e => StringEvent.fromAmino(e)) || []; + return message; + }, + toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { + const obj: any = {}; + obj.msg_index = message.msgIndex; + obj.log = message.log; + if (message.events) { + obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + fromAminoMsg(object: ABCIMessageLogAminoMsg): ABCIMessageLog { + return ABCIMessageLog.fromAmino(object.value); + }, + toAminoMsg(message: ABCIMessageLog): ABCIMessageLogAminoMsg { + return { + type: "cosmos-sdk/ABCIMessageLog", + value: ABCIMessageLog.toAmino(message) + }; + }, + fromProtoMsg(message: ABCIMessageLogProtoMsg): ABCIMessageLog { + return ABCIMessageLog.decode(message.value); + }, + toProto(message: ABCIMessageLog): Uint8Array { + return ABCIMessageLog.encode(message).finish(); + }, + toProtoMsg(message: ABCIMessageLog): ABCIMessageLogProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", + value: ABCIMessageLog.encode(message).finish() + }; } - }; - function createBaseStringEvent(): StringEvent { return { type: "", attributes: [] }; } - export const StringEvent = { - encode(message: StringEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", + encode(message: StringEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); } - for (const v of message.attributes) { Attribute.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StringEvent { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseStringEvent(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.type = reader.string(); break; - case 2: message.attributes.push(Attribute.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): StringEvent { + fromPartial(object: Partial): StringEvent { const message = createBaseStringEvent(); message.type = object.type ?? ""; message.attributes = object.attributes?.map(e => Attribute.fromPartial(e)) || []; return message; + }, + fromAmino(object: StringEventAmino): StringEvent { + const message = createBaseStringEvent(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + message.attributes = object.attributes?.map(e => Attribute.fromAmino(e)) || []; + return message; + }, + toAmino(message: StringEvent): StringEventAmino { + const obj: any = {}; + obj.type = message.type; + if (message.attributes) { + obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); + } else { + obj.attributes = []; + } + return obj; + }, + fromAminoMsg(object: StringEventAminoMsg): StringEvent { + return StringEvent.fromAmino(object.value); + }, + toAminoMsg(message: StringEvent): StringEventAminoMsg { + return { + type: "cosmos-sdk/StringEvent", + value: StringEvent.toAmino(message) + }; + }, + fromProtoMsg(message: StringEventProtoMsg): StringEvent { + return StringEvent.decode(message.value); + }, + toProto(message: StringEvent): Uint8Array { + return StringEvent.encode(message).finish(); + }, + toProtoMsg(message: StringEvent): StringEventProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", + value: StringEvent.encode(message).finish() + }; } - }; - function createBaseAttribute(): Attribute { return { key: "", value: "" }; } - export const Attribute = { - encode(message: Attribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute", + encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== "") { writer.uint32(18).string(message.value); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Attribute { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAttribute(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.string(); break; - case 2: message.value = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Attribute { + fromPartial(object: Partial): Attribute { const message = createBaseAttribute(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; + }, + fromAmino(object: AttributeAmino): Attribute { + const message = createBaseAttribute(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: Attribute): AttributeAmino { + const obj: any = {}; + obj.key = message.key; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: AttributeAminoMsg): Attribute { + return Attribute.fromAmino(object.value); + }, + toAminoMsg(message: Attribute): AttributeAminoMsg { + return { + type: "cosmos-sdk/Attribute", + value: Attribute.toAmino(message) + }; + }, + fromProtoMsg(message: AttributeProtoMsg): Attribute { + return Attribute.decode(message.value); + }, + toProto(message: Attribute): Uint8Array { + return Attribute.encode(message).finish(); + }, + toProtoMsg(message: Attribute): AttributeProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute", + value: Attribute.encode(message).finish() + }; } - }; - function createBaseGasInfo(): GasInfo { return { - gasWanted: Long.UZERO, - gasUsed: Long.UZERO + gasWanted: BigInt(0), + gasUsed: BigInt(0) }; } - export const GasInfo = { - encode(message: GasInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.gasWanted.isZero()) { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", + encode(message: GasInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.gasWanted !== BigInt(0)) { writer.uint32(8).uint64(message.gasWanted); } - - if (!message.gasUsed.isZero()) { + if (message.gasUsed !== BigInt(0)) { writer.uint32(16).uint64(message.gasUsed); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GasInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGasInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.gasWanted = (reader.uint64() as Long); + message.gasWanted = reader.uint64(); break; - case 2: - message.gasUsed = (reader.uint64() as Long); + message.gasUsed = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GasInfo { + fromPartial(object: Partial): GasInfo { const message = createBaseGasInfo(); - message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? Long.fromValue(object.gasWanted) : Long.UZERO; - message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? Long.fromValue(object.gasUsed) : Long.UZERO; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); return message; + }, + fromAmino(object: GasInfoAmino): GasInfo { + const message = createBaseGasInfo(); + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + return message; + }, + toAmino(message: GasInfo): GasInfoAmino { + const obj: any = {}; + obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GasInfoAminoMsg): GasInfo { + return GasInfo.fromAmino(object.value); + }, + toAminoMsg(message: GasInfo): GasInfoAminoMsg { + return { + type: "cosmos-sdk/GasInfo", + value: GasInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GasInfoProtoMsg): GasInfo { + return GasInfo.decode(message.value); + }, + toProto(message: GasInfo): Uint8Array { + return GasInfo.encode(message).finish(); + }, + toProtoMsg(message: GasInfo): GasInfoProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", + value: GasInfo.encode(message).finish() + }; } - }; - function createBaseResult(): Result { return { data: new Uint8Array(), @@ -778,329 +1036,482 @@ function createBaseResult(): Result { msgResponses: [] }; } - export const Result = { - encode(message: Result, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.abci.v1beta1.Result", + encode(message: Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); } - if (message.log !== "") { writer.uint32(18).string(message.log); } - for (const v of message.events) { Event.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.msgResponses) { Any.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Result { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResult(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.data = reader.bytes(); break; - case 2: message.log = reader.string(); break; - case 3: message.events.push(Event.decode(reader, reader.uint32())); break; - case 4: message.msgResponses.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Result { + fromPartial(object: Partial): Result { const message = createBaseResult(); message.data = object.data ?? new Uint8Array(); message.log = object.log ?? ""; message.events = object.events?.map(e => Event.fromPartial(e)) || []; message.msgResponses = object.msgResponses?.map(e => Any.fromPartial(e)) || []; return message; + }, + fromAmino(object: ResultAmino): Result { + const message = createBaseResult(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + message.msgResponses = object.msg_responses?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: Result): ResultAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = []; + } + if (message.msgResponses) { + obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.msg_responses = []; + } + return obj; + }, + fromAminoMsg(object: ResultAminoMsg): Result { + return Result.fromAmino(object.value); + }, + toAminoMsg(message: Result): ResultAminoMsg { + return { + type: "cosmos-sdk/Result", + value: Result.toAmino(message) + }; + }, + fromProtoMsg(message: ResultProtoMsg): Result { + return Result.decode(message.value); + }, + toProto(message: Result): Uint8Array { + return Result.encode(message).finish(); + }, + toProtoMsg(message: Result): ResultProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.Result", + value: Result.encode(message).finish() + }; } - }; - function createBaseSimulationResponse(): SimulationResponse { return { - gasInfo: undefined, + gasInfo: GasInfo.fromPartial({}), result: undefined }; } - export const SimulationResponse = { - encode(message: SimulationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", + encode(message: SimulationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasInfo !== undefined) { GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); } - if (message.result !== undefined) { Result.encode(message.result, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SimulationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSimulationResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.gasInfo = GasInfo.decode(reader, reader.uint32()); break; - case 2: message.result = Result.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SimulationResponse { + fromPartial(object: Partial): SimulationResponse { const message = createBaseSimulationResponse(); message.gasInfo = object.gasInfo !== undefined && object.gasInfo !== null ? GasInfo.fromPartial(object.gasInfo) : undefined; message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined; return message; + }, + fromAmino(object: SimulationResponseAmino): SimulationResponse { + const message = createBaseSimulationResponse(); + if (object.gas_info !== undefined && object.gas_info !== null) { + message.gasInfo = GasInfo.fromAmino(object.gas_info); + } + if (object.result !== undefined && object.result !== null) { + message.result = Result.fromAmino(object.result); + } + return message; + }, + toAmino(message: SimulationResponse): SimulationResponseAmino { + const obj: any = {}; + obj.gas_info = message.gasInfo ? GasInfo.toAmino(message.gasInfo) : undefined; + obj.result = message.result ? Result.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: SimulationResponseAminoMsg): SimulationResponse { + return SimulationResponse.fromAmino(object.value); + }, + toAminoMsg(message: SimulationResponse): SimulationResponseAminoMsg { + return { + type: "cosmos-sdk/SimulationResponse", + value: SimulationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: SimulationResponseProtoMsg): SimulationResponse { + return SimulationResponse.decode(message.value); + }, + toProto(message: SimulationResponse): Uint8Array { + return SimulationResponse.encode(message).finish(); + }, + toProtoMsg(message: SimulationResponse): SimulationResponseProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", + value: SimulationResponse.encode(message).finish() + }; } - }; - function createBaseMsgData(): MsgData { return { msgType: "", data: new Uint8Array() }; } - export const MsgData = { - encode(message: MsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData", + encode(message: MsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgType !== "") { writer.uint32(10).string(message.msgType); } - if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.msgType = reader.string(); break; - case 2: message.data = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgData { + fromPartial(object: Partial): MsgData { const message = createBaseMsgData(); message.msgType = object.msgType ?? ""; message.data = object.data ?? new Uint8Array(); return message; + }, + fromAmino(object: MsgDataAmino): MsgData { + const message = createBaseMsgData(); + if (object.msg_type !== undefined && object.msg_type !== null) { + message.msgType = object.msg_type; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgData): MsgDataAmino { + const obj: any = {}; + obj.msg_type = message.msgType; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgDataAminoMsg): MsgData { + return MsgData.fromAmino(object.value); + }, + toAminoMsg(message: MsgData): MsgDataAminoMsg { + return { + type: "cosmos-sdk/MsgData", + value: MsgData.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDataProtoMsg): MsgData { + return MsgData.decode(message.value); + }, + toProto(message: MsgData): Uint8Array { + return MsgData.encode(message).finish(); + }, + toProtoMsg(message: MsgData): MsgDataProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData", + value: MsgData.encode(message).finish() + }; } - }; - function createBaseTxMsgData(): TxMsgData { return { data: [], msgResponses: [] }; } - export const TxMsgData = { - encode(message: TxMsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", + encode(message: TxMsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { MsgData.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.msgResponses) { Any.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TxMsgData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTxMsgData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.data.push(MsgData.decode(reader, reader.uint32())); break; - case 2: message.msgResponses.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TxMsgData { + fromPartial(object: Partial): TxMsgData { const message = createBaseTxMsgData(); message.data = object.data?.map(e => MsgData.fromPartial(e)) || []; message.msgResponses = object.msgResponses?.map(e => Any.fromPartial(e)) || []; return message; + }, + fromAmino(object: TxMsgDataAmino): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map(e => MsgData.fromAmino(e)) || []; + message.msgResponses = object.msg_responses?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxMsgData): TxMsgDataAmino { + const obj: any = {}; + if (message.data) { + obj.data = message.data.map(e => e ? MsgData.toAmino(e) : undefined); + } else { + obj.data = []; + } + if (message.msgResponses) { + obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.msg_responses = []; + } + return obj; + }, + fromAminoMsg(object: TxMsgDataAminoMsg): TxMsgData { + return TxMsgData.fromAmino(object.value); + }, + toAminoMsg(message: TxMsgData): TxMsgDataAminoMsg { + return { + type: "cosmos-sdk/TxMsgData", + value: TxMsgData.toAmino(message) + }; + }, + fromProtoMsg(message: TxMsgDataProtoMsg): TxMsgData { + return TxMsgData.decode(message.value); + }, + toProto(message: TxMsgData): Uint8Array { + return TxMsgData.encode(message).finish(); + }, + toProtoMsg(message: TxMsgData): TxMsgDataProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", + value: TxMsgData.encode(message).finish() + }; } - }; - function createBaseSearchTxsResult(): SearchTxsResult { return { - totalCount: Long.UZERO, - count: Long.UZERO, - pageNumber: Long.UZERO, - pageTotal: Long.UZERO, - limit: Long.UZERO, + totalCount: BigInt(0), + count: BigInt(0), + pageNumber: BigInt(0), + pageTotal: BigInt(0), + limit: BigInt(0), txs: [] }; } - export const SearchTxsResult = { - encode(message: SearchTxsResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.totalCount.isZero()) { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", + encode(message: SearchTxsResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.totalCount !== BigInt(0)) { writer.uint32(8).uint64(message.totalCount); } - - if (!message.count.isZero()) { + if (message.count !== BigInt(0)) { writer.uint32(16).uint64(message.count); } - - if (!message.pageNumber.isZero()) { + if (message.pageNumber !== BigInt(0)) { writer.uint32(24).uint64(message.pageNumber); } - - if (!message.pageTotal.isZero()) { + if (message.pageTotal !== BigInt(0)) { writer.uint32(32).uint64(message.pageTotal); } - - if (!message.limit.isZero()) { + if (message.limit !== BigInt(0)) { writer.uint32(40).uint64(message.limit); } - for (const v of message.txs) { TxResponse.encode(v!, writer.uint32(50).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SearchTxsResult { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSearchTxsResult(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.totalCount = (reader.uint64() as Long); + message.totalCount = reader.uint64(); break; - case 2: - message.count = (reader.uint64() as Long); + message.count = reader.uint64(); break; - case 3: - message.pageNumber = (reader.uint64() as Long); + message.pageNumber = reader.uint64(); break; - case 4: - message.pageTotal = (reader.uint64() as Long); + message.pageTotal = reader.uint64(); break; - case 5: - message.limit = (reader.uint64() as Long); + message.limit = reader.uint64(); break; - case 6: message.txs.push(TxResponse.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SearchTxsResult { + fromPartial(object: Partial): SearchTxsResult { const message = createBaseSearchTxsResult(); - message.totalCount = object.totalCount !== undefined && object.totalCount !== null ? Long.fromValue(object.totalCount) : Long.UZERO; - message.count = object.count !== undefined && object.count !== null ? Long.fromValue(object.count) : Long.UZERO; - message.pageNumber = object.pageNumber !== undefined && object.pageNumber !== null ? Long.fromValue(object.pageNumber) : Long.UZERO; - message.pageTotal = object.pageTotal !== undefined && object.pageTotal !== null ? Long.fromValue(object.pageTotal) : Long.UZERO; - message.limit = object.limit !== undefined && object.limit !== null ? Long.fromValue(object.limit) : Long.UZERO; + message.totalCount = object.totalCount !== undefined && object.totalCount !== null ? BigInt(object.totalCount.toString()) : BigInt(0); + message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); + message.pageNumber = object.pageNumber !== undefined && object.pageNumber !== null ? BigInt(object.pageNumber.toString()) : BigInt(0); + message.pageTotal = object.pageTotal !== undefined && object.pageTotal !== null ? BigInt(object.pageTotal.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); message.txs = object.txs?.map(e => TxResponse.fromPartial(e)) || []; return message; + }, + fromAmino(object: SearchTxsResultAmino): SearchTxsResult { + const message = createBaseSearchTxsResult(); + if (object.total_count !== undefined && object.total_count !== null) { + message.totalCount = BigInt(object.total_count); + } + if (object.count !== undefined && object.count !== null) { + message.count = BigInt(object.count); + } + if (object.page_number !== undefined && object.page_number !== null) { + message.pageNumber = BigInt(object.page_number); + } + if (object.page_total !== undefined && object.page_total !== null) { + message.pageTotal = BigInt(object.page_total); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + message.txs = object.txs?.map(e => TxResponse.fromAmino(e)) || []; + return message; + }, + toAmino(message: SearchTxsResult): SearchTxsResultAmino { + const obj: any = {}; + obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; + obj.count = message.count ? message.count.toString() : undefined; + obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; + obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; + obj.limit = message.limit ? message.limit.toString() : undefined; + if (message.txs) { + obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); + } else { + obj.txs = []; + } + return obj; + }, + fromAminoMsg(object: SearchTxsResultAminoMsg): SearchTxsResult { + return SearchTxsResult.fromAmino(object.value); + }, + toAminoMsg(message: SearchTxsResult): SearchTxsResultAminoMsg { + return { + type: "cosmos-sdk/SearchTxsResult", + value: SearchTxsResult.toAmino(message) + }; + }, + fromProtoMsg(message: SearchTxsResultProtoMsg): SearchTxsResult { + return SearchTxsResult.decode(message.value); + }, + toProto(message: SearchTxsResult): Uint8Array { + return SearchTxsResult.encode(message).finish(); + }, + toProtoMsg(message: SearchTxsResult): SearchTxsResultProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", + value: SearchTxsResult.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/kv/v1beta1/kv.ts b/src/codegen/cosmos/base/kv/v1beta1/kv.ts index 8ce74b6..0753fe1 100644 --- a/src/codegen/cosmos/base/kv/v1beta1/kv.ts +++ b/src/codegen/cosmos/base/kv/v1beta1/kv.ts @@ -1,124 +1,197 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** Pairs defines a repeated slice of Pair objects. */ - export interface Pairs { pairs: Pair[]; } +export interface PairsProtoMsg { + typeUrl: "/cosmos.base.kv.v1beta1.Pairs"; + value: Uint8Array; +} +/** Pairs defines a repeated slice of Pair objects. */ +export interface PairsAmino { + pairs?: PairAmino[]; +} +export interface PairsAminoMsg { + type: "cosmos-sdk/Pairs"; + value: PairsAmino; +} /** Pairs defines a repeated slice of Pair objects. */ - export interface PairsSDKType { pairs: PairSDKType[]; } /** Pair defines a key/value bytes tuple. */ - export interface Pair { key: Uint8Array; value: Uint8Array; } +export interface PairProtoMsg { + typeUrl: "/cosmos.base.kv.v1beta1.Pair"; + value: Uint8Array; +} +/** Pair defines a key/value bytes tuple. */ +export interface PairAmino { + key?: string; + value?: string; +} +export interface PairAminoMsg { + type: "cosmos-sdk/Pair"; + value: PairAmino; +} /** Pair defines a key/value bytes tuple. */ - export interface PairSDKType { key: Uint8Array; value: Uint8Array; } - function createBasePairs(): Pairs { return { pairs: [] }; } - export const Pairs = { - encode(message: Pairs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.kv.v1beta1.Pairs", + encode(message: Pairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pairs) { Pair.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Pairs { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.pairs.push(Pair.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Pairs { + fromPartial(object: Partial): Pairs { const message = createBasePairs(); message.pairs = object.pairs?.map(e => Pair.fromPartial(e)) || []; return message; + }, + fromAmino(object: PairsAmino): Pairs { + const message = createBasePairs(); + message.pairs = object.pairs?.map(e => Pair.fromAmino(e)) || []; + return message; + }, + toAmino(message: Pairs): PairsAmino { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map(e => e ? Pair.toAmino(e) : undefined); + } else { + obj.pairs = []; + } + return obj; + }, + fromAminoMsg(object: PairsAminoMsg): Pairs { + return Pairs.fromAmino(object.value); + }, + toAminoMsg(message: Pairs): PairsAminoMsg { + return { + type: "cosmos-sdk/Pairs", + value: Pairs.toAmino(message) + }; + }, + fromProtoMsg(message: PairsProtoMsg): Pairs { + return Pairs.decode(message.value); + }, + toProto(message: Pairs): Uint8Array { + return Pairs.encode(message).finish(); + }, + toProtoMsg(message: Pairs): PairsProtoMsg { + return { + typeUrl: "/cosmos.base.kv.v1beta1.Pairs", + value: Pairs.encode(message).finish() + }; } - }; - function createBasePair(): Pair { return { key: new Uint8Array(), value: new Uint8Array() }; } - export const Pair = { - encode(message: Pair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.kv.v1beta1.Pair", + encode(message: Pair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Pair { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.key = reader.bytes(); break; - case 2: message.value = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Pair { + fromPartial(object: Partial): Pair { const message = createBasePair(); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); return message; + }, + fromAmino(object: PairAmino): Pair { + const message = createBasePair(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: Pair): PairAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: PairAminoMsg): Pair { + return Pair.fromAmino(object.value); + }, + toAminoMsg(message: Pair): PairAminoMsg { + return { + type: "cosmos-sdk/Pair", + value: Pair.toAmino(message) + }; + }, + fromProtoMsg(message: PairProtoMsg): Pair { + return Pair.decode(message.value); + }, + toProto(message: Pair): Uint8Array { + return Pair.encode(message).finish(); + }, + toProtoMsg(message: Pair): PairProtoMsg { + return { + typeUrl: "/cosmos.base.kv.v1beta1.Pair", + value: Pair.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/query/v1beta1/pagination.ts b/src/codegen/cosmos/base/query/v1beta1/pagination.ts index 0ccf2df..da442ae 100644 --- a/src/codegen/cosmos/base/query/v1beta1/pagination.ts +++ b/src/codegen/cosmos/base/query/v1beta1/pagination.ts @@ -1,5 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * PageRequest is to be embedded in gRPC request messages for efficient * pagination. Ex: @@ -9,7 +9,6 @@ import { Long, DeepPartial } from "../../../../helpers"; * PageRequest pagination = 2; * } */ - export interface PageRequest { /** * key is a value returned in PageResponse.next_key to begin @@ -22,30 +21,30 @@ export interface PageRequest { * It is less efficient than using key. Only one of offset or key should * be set. */ - - offset: Long; + offset: bigint; /** * limit is the total number of results to be returned in the result page. * If left empty it will default to a value to be set by each app. */ - - limit: Long; + limit: bigint; /** * count_total is set to true to indicate that the result set should include * a count of the total number of items available for pagination in UIs. * count_total is only respected when offset is used. It is ignored when key * is set. */ - countTotal: boolean; /** * reverse is set to true if results are to be returned in the descending order. * * Since: cosmos-sdk 0.43 */ - reverse: boolean; } +export interface PageRequestProtoMsg { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest"; + value: Uint8Array; +} /** * PageRequest is to be embedded in gRPC request messages for efficient * pagination. Ex: @@ -55,41 +54,56 @@ export interface PageRequest { * PageRequest pagination = 2; * } */ - -export interface PageRequestSDKType { +export interface PageRequestAmino { /** * key is a value returned in PageResponse.next_key to begin * querying the next page most efficiently. Only one of offset or key * should be set. */ - key: Uint8Array; + key?: string; /** * offset is a numeric offset that can be used when key is unavailable. * It is less efficient than using key. Only one of offset or key should * be set. */ - - offset: Long; + offset?: string; /** * limit is the total number of results to be returned in the result page. * If left empty it will default to a value to be set by each app. */ - - limit: Long; + limit?: string; /** * count_total is set to true to indicate that the result set should include * a count of the total number of items available for pagination in UIs. * count_total is only respected when offset is used. It is ignored when key * is set. */ - - count_total: boolean; + count_total?: boolean; /** * reverse is set to true if results are to be returned in the descending order. * * Since: cosmos-sdk 0.43 */ - + reverse?: boolean; +} +export interface PageRequestAminoMsg { + type: "cosmos-sdk/PageRequest"; + value: PageRequestAmino; +} +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequestSDKType { + key: Uint8Array; + offset: bigint; + limit: bigint; + count_total: boolean; reverse: boolean; } /** @@ -101,7 +115,6 @@ export interface PageRequestSDKType { * PageResponse page = 2; * } */ - export interface PageResponse { /** * next_key is the key to be passed to PageRequest.key to @@ -113,8 +126,11 @@ export interface PageResponse { * total is total number of results available if PageRequest.count_total * was set, its value is undefined otherwise */ - - total: Long; + total: bigint; +} +export interface PageResponseProtoMsg { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse"; + value: Uint8Array; } /** * PageResponse is to be embedded in gRPC response messages where the @@ -125,158 +141,231 @@ export interface PageResponse { * PageResponse page = 2; * } */ - -export interface PageResponseSDKType { +export interface PageResponseAmino { /** * next_key is the key to be passed to PageRequest.key to * query the next page most efficiently. It will be empty if * there are no more results. */ - next_key: Uint8Array; + next_key?: string; /** * total is total number of results available if PageRequest.count_total * was set, its value is undefined otherwise */ - - total: Long; + total?: string; +} +export interface PageResponseAminoMsg { + type: "cosmos-sdk/PageResponse"; + value: PageResponseAmino; +} +/** + * 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 PageResponseSDKType { + next_key: Uint8Array; + total: bigint; } - function createBasePageRequest(): PageRequest { return { key: new Uint8Array(), - offset: Long.UZERO, - limit: Long.UZERO, + offset: BigInt(0), + limit: BigInt(0), countTotal: false, reverse: false }; } - export const PageRequest = { - encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest", + encode(message: PageRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - - if (!message.offset.isZero()) { + if (message.offset !== BigInt(0)) { writer.uint32(16).uint64(message.offset); } - - if (!message.limit.isZero()) { + if (message.limit !== BigInt(0)) { writer.uint32(24).uint64(message.limit); } - if (message.countTotal === true) { writer.uint32(32).bool(message.countTotal); } - if (message.reverse === true) { writer.uint32(40).bool(message.reverse); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: - message.offset = (reader.uint64() as Long); + message.offset = reader.uint64(); break; - case 3: - message.limit = (reader.uint64() as Long); + message.limit = reader.uint64(); break; - case 4: message.countTotal = reader.bool(); break; - case 5: message.reverse = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PageRequest { + fromPartial(object: Partial): PageRequest { const message = createBasePageRequest(); message.key = object.key ?? new Uint8Array(); - message.offset = object.offset !== undefined && object.offset !== null ? Long.fromValue(object.offset) : Long.UZERO; - message.limit = object.limit !== undefined && object.limit !== null ? Long.fromValue(object.limit) : Long.UZERO; + message.offset = object.offset !== undefined && object.offset !== null ? BigInt(object.offset.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); message.countTotal = object.countTotal ?? false; message.reverse = object.reverse ?? false; return message; + }, + fromAmino(object: PageRequestAmino): PageRequest { + const message = createBasePageRequest(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.offset !== undefined && object.offset !== null) { + message.offset = BigInt(object.offset); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + if (object.count_total !== undefined && object.count_total !== null) { + message.countTotal = object.count_total; + } + if (object.reverse !== undefined && object.reverse !== null) { + message.reverse = object.reverse; + } + return message; + }, + toAmino(message: PageRequest): PageRequestAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.offset = message.offset ? message.offset.toString() : undefined; + obj.limit = message.limit ? message.limit.toString() : undefined; + obj.count_total = message.countTotal; + obj.reverse = message.reverse; + return obj; + }, + fromAminoMsg(object: PageRequestAminoMsg): PageRequest { + return PageRequest.fromAmino(object.value); + }, + toAminoMsg(message: PageRequest): PageRequestAminoMsg { + return { + type: "cosmos-sdk/PageRequest", + value: PageRequest.toAmino(message) + }; + }, + fromProtoMsg(message: PageRequestProtoMsg): PageRequest { + return PageRequest.decode(message.value); + }, + toProto(message: PageRequest): Uint8Array { + return PageRequest.encode(message).finish(); + }, + toProtoMsg(message: PageRequest): PageRequestProtoMsg { + return { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest", + value: PageRequest.encode(message).finish() + }; } - }; - function createBasePageResponse(): PageResponse { return { nextKey: new Uint8Array(), - total: Long.UZERO + total: BigInt(0) }; } - export const PageResponse = { - encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse", + encode(message: PageResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); } - - if (!message.total.isZero()) { + if (message.total !== BigInt(0)) { writer.uint32(16).uint64(message.total); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePageResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.nextKey = reader.bytes(); break; - case 2: - message.total = (reader.uint64() as Long); + message.total = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PageResponse { + fromPartial(object: Partial): PageResponse { const message = createBasePageResponse(); message.nextKey = object.nextKey ?? new Uint8Array(); - message.total = object.total !== undefined && object.total !== null ? Long.fromValue(object.total) : Long.UZERO; + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PageResponseAmino): PageResponse { + const message = createBasePageResponse(); + if (object.next_key !== undefined && object.next_key !== null) { + message.nextKey = bytesFromBase64(object.next_key); + } + if (object.total !== undefined && object.total !== null) { + message.total = BigInt(object.total); + } return message; + }, + toAmino(message: PageResponse): PageResponseAmino { + const obj: any = {}; + obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; + obj.total = message.total ? message.total.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PageResponseAminoMsg): PageResponse { + return PageResponse.fromAmino(object.value); + }, + toAminoMsg(message: PageResponse): PageResponseAminoMsg { + return { + type: "cosmos-sdk/PageResponse", + value: PageResponse.toAmino(message) + }; + }, + fromProtoMsg(message: PageResponseProtoMsg): PageResponse { + return PageResponse.decode(message.value); + }, + toProto(message: PageResponse): Uint8Array { + return PageResponse.encode(message).finish(); + }, + toProtoMsg(message: PageResponse): PageResponseProtoMsg { + return { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse", + value: PageResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/reflection/v1beta1/reflection.ts b/src/codegen/cosmos/base/reflection/v1beta1/reflection.ts index a65780a..9928b33 100644 --- a/src/codegen/cosmos/base/reflection/v1beta1/reflection.ts +++ b/src/codegen/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,223 +1,364 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ - export interface ListAllInterfacesRequest {} +export interface ListAllInterfacesRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesRequest"; + value: Uint8Array; +} +/** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ +export interface ListAllInterfacesRequestAmino {} +export interface ListAllInterfacesRequestAminoMsg { + type: "cosmos-sdk/ListAllInterfacesRequest"; + value: ListAllInterfacesRequestAmino; +} /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ - export interface ListAllInterfacesRequestSDKType {} /** ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. */ - export interface ListAllInterfacesResponse { /** interface_names is an array of all the registered interfaces. */ interfaceNames: string[]; } +export interface ListAllInterfacesResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse"; + value: Uint8Array; +} /** ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. */ - -export interface ListAllInterfacesResponseSDKType { +export interface ListAllInterfacesResponseAmino { /** interface_names is an array of all the registered interfaces. */ + interface_names?: string[]; +} +export interface ListAllInterfacesResponseAminoMsg { + type: "cosmos-sdk/ListAllInterfacesResponse"; + value: ListAllInterfacesResponseAmino; +} +/** ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. */ +export interface ListAllInterfacesResponseSDKType { interface_names: string[]; } /** * ListImplementationsRequest is the request type of the ListImplementations * RPC. */ - export interface ListImplementationsRequest { /** interface_name defines the interface to query the implementations for. */ interfaceName: string; } +export interface ListImplementationsRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsRequest"; + value: Uint8Array; +} /** * ListImplementationsRequest is the request type of the ListImplementations * RPC. */ - -export interface ListImplementationsRequestSDKType { +export interface ListImplementationsRequestAmino { /** interface_name defines the interface to query the implementations for. */ + interface_name?: string; +} +export interface ListImplementationsRequestAminoMsg { + type: "cosmos-sdk/ListImplementationsRequest"; + value: ListImplementationsRequestAmino; +} +/** + * ListImplementationsRequest is the request type of the ListImplementations + * RPC. + */ +export interface ListImplementationsRequestSDKType { interface_name: string; } /** * ListImplementationsResponse is the response type of the ListImplementations * RPC. */ - export interface ListImplementationsResponse { implementationMessageNames: string[]; } +export interface ListImplementationsResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsResponse"; + value: Uint8Array; +} +/** + * ListImplementationsResponse is the response type of the ListImplementations + * RPC. + */ +export interface ListImplementationsResponseAmino { + implementation_message_names?: string[]; +} +export interface ListImplementationsResponseAminoMsg { + type: "cosmos-sdk/ListImplementationsResponse"; + value: ListImplementationsResponseAmino; +} /** * ListImplementationsResponse is the response type of the ListImplementations * RPC. */ - export interface ListImplementationsResponseSDKType { implementation_message_names: string[]; } - function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { return {}; } - export const ListAllInterfacesRequest = { - encode(_: ListAllInterfacesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesRequest", + encode(_: ListAllInterfacesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ListAllInterfacesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): ListAllInterfacesRequest { + fromPartial(_: Partial): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, + fromAmino(_: ListAllInterfacesRequestAmino): ListAllInterfacesRequest { const message = createBaseListAllInterfacesRequest(); return message; + }, + toAmino(_: ListAllInterfacesRequest): ListAllInterfacesRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ListAllInterfacesRequestAminoMsg): ListAllInterfacesRequest { + return ListAllInterfacesRequest.fromAmino(object.value); + }, + toAminoMsg(message: ListAllInterfacesRequest): ListAllInterfacesRequestAminoMsg { + return { + type: "cosmos-sdk/ListAllInterfacesRequest", + value: ListAllInterfacesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: ListAllInterfacesRequestProtoMsg): ListAllInterfacesRequest { + return ListAllInterfacesRequest.decode(message.value); + }, + toProto(message: ListAllInterfacesRequest): Uint8Array { + return ListAllInterfacesRequest.encode(message).finish(); + }, + toProtoMsg(message: ListAllInterfacesRequest): ListAllInterfacesRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesRequest", + value: ListAllInterfacesRequest.encode(message).finish() + }; } - }; - function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { return { interfaceNames: [] }; } - export const ListAllInterfacesResponse = { - encode(message: ListAllInterfacesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse", + encode(message: ListAllInterfacesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.interfaceNames) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ListAllInterfacesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.interfaceNames.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ListAllInterfacesResponse { + fromPartial(object: Partial): ListAllInterfacesResponse { const message = createBaseListAllInterfacesResponse(); message.interfaceNames = object.interfaceNames?.map(e => e) || []; return message; + }, + fromAmino(object: ListAllInterfacesResponseAmino): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interfaceNames = object.interface_names?.map(e => e) || []; + return message; + }, + toAmino(message: ListAllInterfacesResponse): ListAllInterfacesResponseAmino { + const obj: any = {}; + if (message.interfaceNames) { + obj.interface_names = message.interfaceNames.map(e => e); + } else { + obj.interface_names = []; + } + return obj; + }, + fromAminoMsg(object: ListAllInterfacesResponseAminoMsg): ListAllInterfacesResponse { + return ListAllInterfacesResponse.fromAmino(object.value); + }, + toAminoMsg(message: ListAllInterfacesResponse): ListAllInterfacesResponseAminoMsg { + return { + type: "cosmos-sdk/ListAllInterfacesResponse", + value: ListAllInterfacesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: ListAllInterfacesResponseProtoMsg): ListAllInterfacesResponse { + return ListAllInterfacesResponse.decode(message.value); + }, + toProto(message: ListAllInterfacesResponse): Uint8Array { + return ListAllInterfacesResponse.encode(message).finish(); + }, + toProtoMsg(message: ListAllInterfacesResponse): ListAllInterfacesResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse", + value: ListAllInterfacesResponse.encode(message).finish() + }; } - }; - function createBaseListImplementationsRequest(): ListImplementationsRequest { return { interfaceName: "" }; } - export const ListImplementationsRequest = { - encode(message: ListImplementationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsRequest", + encode(message: ListImplementationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.interfaceName !== "") { writer.uint32(10).string(message.interfaceName); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ListImplementationsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.interfaceName = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ListImplementationsRequest { + fromPartial(object: Partial): ListImplementationsRequest { const message = createBaseListImplementationsRequest(); message.interfaceName = object.interfaceName ?? ""; return message; + }, + fromAmino(object: ListImplementationsRequestAmino): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + if (object.interface_name !== undefined && object.interface_name !== null) { + message.interfaceName = object.interface_name; + } + return message; + }, + toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { + const obj: any = {}; + obj.interface_name = message.interfaceName; + return obj; + }, + fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { + return ListImplementationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: ListImplementationsRequest): ListImplementationsRequestAminoMsg { + return { + type: "cosmos-sdk/ListImplementationsRequest", + value: ListImplementationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: ListImplementationsRequestProtoMsg): ListImplementationsRequest { + return ListImplementationsRequest.decode(message.value); + }, + toProto(message: ListImplementationsRequest): Uint8Array { + return ListImplementationsRequest.encode(message).finish(); + }, + toProtoMsg(message: ListImplementationsRequest): ListImplementationsRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsRequest", + value: ListImplementationsRequest.encode(message).finish() + }; } - }; - function createBaseListImplementationsResponse(): ListImplementationsResponse { return { implementationMessageNames: [] }; } - export const ListImplementationsResponse = { - encode(message: ListImplementationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsResponse", + encode(message: ListImplementationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.implementationMessageNames) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ListImplementationsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.implementationMessageNames.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ListImplementationsResponse { + fromPartial(object: Partial): ListImplementationsResponse { const message = createBaseListImplementationsResponse(); message.implementationMessageNames = object.implementationMessageNames?.map(e => e) || []; return message; + }, + fromAmino(object: ListImplementationsResponseAmino): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementationMessageNames = object.implementation_message_names?.map(e => e) || []; + return message; + }, + toAmino(message: ListImplementationsResponse): ListImplementationsResponseAmino { + const obj: any = {}; + if (message.implementationMessageNames) { + obj.implementation_message_names = message.implementationMessageNames.map(e => e); + } else { + obj.implementation_message_names = []; + } + return obj; + }, + fromAminoMsg(object: ListImplementationsResponseAminoMsg): ListImplementationsResponse { + return ListImplementationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: ListImplementationsResponse): ListImplementationsResponseAminoMsg { + return { + type: "cosmos-sdk/ListImplementationsResponse", + value: ListImplementationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: ListImplementationsResponseProtoMsg): ListImplementationsResponse { + return ListImplementationsResponse.decode(message.value); + }, + toProto(message: ListImplementationsResponse): Uint8Array { + return ListImplementationsResponse.encode(message).finish(); + }, + toProtoMsg(message: ListImplementationsResponse): ListImplementationsResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsResponse", + value: ListImplementationsResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/reflection/v2alpha1/reflection.ts b/src/codegen/cosmos/base/reflection/v2alpha1/reflection.ts index be08bec..5437561 100644 --- a/src/codegen/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/src/codegen/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,7 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** AppDescriptor describes a cosmos-sdk based application */ - export interface AppDescriptor { /** * AuthnDescriptor provides information on how to authenticate transactions on the application @@ -9,47 +7,52 @@ export interface AppDescriptor { */ authn?: AuthnDescriptor; /** chain provides the chain descriptor */ - chain?: ChainDescriptor; /** codec provides metadata information regarding codec related types */ - codec?: CodecDescriptor; /** configuration provides metadata information regarding the sdk.Config type */ - configuration?: ConfigurationDescriptor; /** query_services provides metadata information regarding the available queriable endpoints */ - queryServices?: QueryServicesDescriptor; /** tx provides metadata information regarding how to send transactions to the given application */ - tx?: TxDescriptor; } +export interface AppDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor"; + value: Uint8Array; +} /** AppDescriptor describes a cosmos-sdk based application */ - -export interface AppDescriptorSDKType { +export interface AppDescriptorAmino { /** * AuthnDescriptor provides information on how to authenticate transactions on the application * NOTE: experimental and subject to change in future releases. */ - authn?: AuthnDescriptorSDKType; + authn?: AuthnDescriptorAmino; /** chain provides the chain descriptor */ - - chain?: ChainDescriptorSDKType; + chain?: ChainDescriptorAmino; /** codec provides metadata information regarding codec related types */ - - codec?: CodecDescriptorSDKType; + codec?: CodecDescriptorAmino; /** configuration provides metadata information regarding the sdk.Config type */ - - configuration?: ConfigurationDescriptorSDKType; + configuration?: ConfigurationDescriptorAmino; /** query_services provides metadata information regarding the available queriable endpoints */ - - query_services?: QueryServicesDescriptorSDKType; + query_services?: QueryServicesDescriptorAmino; /** tx provides metadata information regarding how to send transactions to the given application */ - + tx?: TxDescriptorAmino; +} +export interface AppDescriptorAminoMsg { + type: "cosmos-sdk/AppDescriptor"; + value: AppDescriptorAmino; +} +/** AppDescriptor describes a cosmos-sdk based application */ +export interface AppDescriptorSDKType { + authn?: AuthnDescriptorSDKType; + chain?: ChainDescriptorSDKType; + codec?: CodecDescriptorSDKType; + configuration?: ConfigurationDescriptorSDKType; + query_services?: QueryServicesDescriptorSDKType; tx?: TxDescriptorSDKType; } /** 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) @@ -58,38 +61,61 @@ export interface TxDescriptor { */ fullname: string; /** msgs lists the accepted application messages (sdk.Msg) */ - msgs: MsgDescriptor[]; } +export interface TxDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor"; + value: Uint8Array; +} /** TxDescriptor describes the accepted transaction type */ - -export interface TxDescriptorSDKType { +export interface TxDescriptorAmino { /** * 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; + fullname?: string; /** msgs lists the accepted application messages (sdk.Msg) */ - + msgs?: MsgDescriptorAmino[]; +} +export interface TxDescriptorAminoMsg { + type: "cosmos-sdk/TxDescriptor"; + value: TxDescriptorAmino; +} +/** TxDescriptor describes the accepted transaction type */ +export interface TxDescriptorSDKType { + fullname: string; msgs: MsgDescriptorSDKType[]; } /** * 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[]; } +export interface AuthnDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor"; + value: Uint8Array; +} /** * AuthnDescriptor provides information on how to sign transactions without relying * on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures */ - -export interface AuthnDescriptorSDKType { +export interface AuthnDescriptorAmino { /** sign_modes defines the supported signature algorithm */ + sign_modes?: SigningModeDescriptorAmino[]; +} +export interface AuthnDescriptorAminoMsg { + type: "cosmos-sdk/AuthnDescriptor"; + value: AuthnDescriptorAmino; +} +/** + * AuthnDescriptor provides information on how to sign transactions without relying + * on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures + */ +export interface AuthnDescriptorSDKType { sign_modes: SigningModeDescriptorSDKType[]; } /** @@ -98,66 +124,98 @@ export interface AuthnDescriptorSDKType { * 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; } +export interface SigningModeDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor"; + value: Uint8Array; +} /** * 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 SigningModeDescriptorSDKType { +export interface SigningModeDescriptorAmino { /** name defines the unique name of the signing mode */ - name: string; + name?: string; /** number is the unique int32 identifier for the sign_mode enum */ - - number: number; + number?: number; /** * authn_info_provider_method_fullname defines the fullname of the method to call to get * the metadata required to authenticate using the provided sign_modes */ - + authn_info_provider_method_fullname?: string; +} +export interface SigningModeDescriptorAminoMsg { + type: "cosmos-sdk/SigningModeDescriptor"; + value: SigningModeDescriptorAmino; +} +/** + * 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 SigningModeDescriptorSDKType { + name: string; + number: number; authn_info_provider_method_fullname: string; } /** ChainDescriptor describes chain information of the application */ - export interface ChainDescriptor { /** id is the chain id */ id: string; } +export interface ChainDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor"; + value: Uint8Array; +} /** ChainDescriptor describes chain information of the application */ - -export interface ChainDescriptorSDKType { +export interface ChainDescriptorAmino { /** id is the chain id */ + id?: string; +} +export interface ChainDescriptorAminoMsg { + type: "cosmos-sdk/ChainDescriptor"; + value: ChainDescriptorAmino; +} +/** ChainDescriptor describes chain information of the application */ +export interface ChainDescriptorSDKType { 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[]; } +export interface CodecDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor"; + value: Uint8Array; +} /** CodecDescriptor describes the registered interfaces and provides metadata information on the types */ - -export interface CodecDescriptorSDKType { +export interface CodecDescriptorAmino { /** interfaces is a list of the registerted interfaces descriptors */ + interfaces?: InterfaceDescriptorAmino[]; +} +export interface CodecDescriptorAminoMsg { + type: "cosmos-sdk/CodecDescriptor"; + value: CodecDescriptorAmino; +} +/** CodecDescriptor describes the registered interfaces and provides metadata information on the types */ +export interface CodecDescriptorSDKType { interfaces: InterfaceDescriptorSDKType[]; } /** InterfaceDescriptor describes the implementation of an interface */ - export interface InterfaceDescriptor { /** fullname is the name of the interface */ fullname: string; @@ -165,29 +223,37 @@ export interface InterfaceDescriptor { * 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[]; } +export interface InterfaceDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor"; + value: Uint8Array; +} /** InterfaceDescriptor describes the implementation of an interface */ - -export interface InterfaceDescriptorSDKType { +export interface InterfaceDescriptorAmino { /** fullname is the name of the interface */ - fullname: string; + fullname?: string; /** * interface_accepting_messages contains information regarding the proto messages which contain the interface as * google.protobuf.Any field */ - - interface_accepting_messages: InterfaceAcceptingMessageDescriptorSDKType[]; + interface_accepting_messages?: InterfaceAcceptingMessageDescriptorAmino[]; /** interface_implementers is a list of the descriptors of the interface implementers */ - + interface_implementers?: InterfaceImplementerDescriptorAmino[]; +} +export interface InterfaceDescriptorAminoMsg { + type: "cosmos-sdk/InterfaceDescriptor"; + value: InterfaceDescriptorAmino; +} +/** InterfaceDescriptor describes the implementation of an interface */ +export interface InterfaceDescriptorSDKType { + fullname: string; + interface_accepting_messages: InterfaceAcceptingMessageDescriptorSDKType[]; interface_implementers: InterfaceImplementerDescriptorSDKType[]; } /** InterfaceImplementerDescriptor describes an interface implementer */ - export interface InterfaceImplementerDescriptor { /** fullname is the protobuf queryable name of the interface implementer */ fullname: string; @@ -197,28 +263,37 @@ export interface InterfaceImplementerDescriptor { * unmarshalling, making sure that we don't accept just 'any' type * in our interface fields */ - typeUrl: string; } +export interface InterfaceImplementerDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor"; + value: Uint8Array; +} /** InterfaceImplementerDescriptor describes an interface implementer */ - -export interface InterfaceImplementerDescriptorSDKType { +export interface InterfaceImplementerDescriptorAmino { /** fullname is the protobuf queryable name of the interface implementer */ - fullname: string; + fullname?: string; /** * type_url defines the type URL used when marshalling the type as any * this is required so we can provide type safe google.protobuf.Any marshalling and * unmarshalling, making sure that we don't accept just 'any' type * in our interface fields */ - + type_url?: string; +} +export interface InterfaceImplementerDescriptorAminoMsg { + type: "cosmos-sdk/InterfaceImplementerDescriptor"; + value: InterfaceImplementerDescriptorAmino; +} +/** InterfaceImplementerDescriptor describes an interface implementer */ +export interface InterfaceImplementerDescriptorSDKType { + fullname: string; type_url: string; } /** * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains * an interface represented as a google.protobuf.Any */ - export interface InterfaceAcceptingMessageDescriptor { /** fullname is the protobuf fullname of the type containing the interface */ fullname: string; @@ -227,147 +302,277 @@ export interface InterfaceAcceptingMessageDescriptor { * 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[]; } +export interface InterfaceAcceptingMessageDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor"; + value: Uint8Array; +} /** * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains * an interface represented as a google.protobuf.Any */ - -export interface InterfaceAcceptingMessageDescriptorSDKType { +export interface InterfaceAcceptingMessageDescriptorAmino { /** fullname is the protobuf fullname of the type containing the interface */ - fullname: string; + fullname?: string; /** * field_descriptor_names is a list of the protobuf name (not fullname) of the field * which contains the interface as google.protobuf.Any (the interface is the same, but * it can be in multiple fields of the same proto message) */ - + field_descriptor_names?: string[]; +} +export interface InterfaceAcceptingMessageDescriptorAminoMsg { + type: "cosmos-sdk/InterfaceAcceptingMessageDescriptor"; + value: InterfaceAcceptingMessageDescriptorAmino; +} +/** + * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains + * an interface represented as a google.protobuf.Any + */ +export interface InterfaceAcceptingMessageDescriptorSDKType { + fullname: string; field_descriptor_names: string[]; } /** ConfigurationDescriptor contains metadata information on the sdk.Config */ - export interface ConfigurationDescriptor { /** bech32_account_address_prefix is the account address prefix */ bech32AccountAddressPrefix: string; } +export interface ConfigurationDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor"; + value: Uint8Array; +} /** ConfigurationDescriptor contains metadata information on the sdk.Config */ - -export interface ConfigurationDescriptorSDKType { +export interface ConfigurationDescriptorAmino { /** bech32_account_address_prefix is the account address prefix */ + bech32_account_address_prefix?: string; +} +export interface ConfigurationDescriptorAminoMsg { + type: "cosmos-sdk/ConfigurationDescriptor"; + value: ConfigurationDescriptorAmino; +} +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptorSDKType { bech32_account_address_prefix: string; } /** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */ - export interface MsgDescriptor { /** msg_type_url contains the TypeURL of a sdk.Msg. */ msgTypeUrl: string; } +export interface MsgDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor"; + value: Uint8Array; +} /** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */ - -export interface MsgDescriptorSDKType { +export interface MsgDescriptorAmino { /** msg_type_url contains the TypeURL of a sdk.Msg. */ + msg_type_url?: string; +} +export interface MsgDescriptorAminoMsg { + type: "cosmos-sdk/MsgDescriptor"; + value: MsgDescriptorAmino; +} +/** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */ +export interface MsgDescriptorSDKType { msg_type_url: string; } /** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */ - export interface GetAuthnDescriptorRequest {} +export interface GetAuthnDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest"; + value: Uint8Array; +} +/** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorRequestAmino {} +export interface GetAuthnDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetAuthnDescriptorRequest"; + value: GetAuthnDescriptorRequestAmino; +} /** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */ - export interface GetAuthnDescriptorRequestSDKType {} /** 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; } +export interface GetAuthnDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse"; + value: Uint8Array; +} /** GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC */ - -export interface GetAuthnDescriptorResponseSDKType { +export interface GetAuthnDescriptorResponseAmino { /** authn describes how to authenticate to the application when sending transactions */ + authn?: AuthnDescriptorAmino; +} +export interface GetAuthnDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetAuthnDescriptorResponse"; + value: GetAuthnDescriptorResponseAmino; +} +/** GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorResponseSDKType { authn?: AuthnDescriptorSDKType; } /** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */ - export interface GetChainDescriptorRequest {} +export interface GetChainDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest"; + value: Uint8Array; +} +/** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */ +export interface GetChainDescriptorRequestAmino {} +export interface GetChainDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetChainDescriptorRequest"; + value: GetChainDescriptorRequestAmino; +} /** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */ - export interface GetChainDescriptorRequestSDKType {} /** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */ - export interface GetChainDescriptorResponse { /** chain describes application chain information */ chain?: ChainDescriptor; } +export interface GetChainDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse"; + value: Uint8Array; +} /** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */ - -export interface GetChainDescriptorResponseSDKType { +export interface GetChainDescriptorResponseAmino { /** chain describes application chain information */ + chain?: ChainDescriptorAmino; +} +export interface GetChainDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetChainDescriptorResponse"; + value: GetChainDescriptorResponseAmino; +} +/** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */ +export interface GetChainDescriptorResponseSDKType { chain?: ChainDescriptorSDKType; } /** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */ - export interface GetCodecDescriptorRequest {} +export interface GetCodecDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest"; + value: Uint8Array; +} +/** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorRequestAmino {} +export interface GetCodecDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetCodecDescriptorRequest"; + value: GetCodecDescriptorRequestAmino; +} /** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */ - export interface GetCodecDescriptorRequestSDKType {} /** 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; } +export interface GetCodecDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse"; + value: Uint8Array; +} /** GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC */ - -export interface GetCodecDescriptorResponseSDKType { +export interface GetCodecDescriptorResponseAmino { /** codec describes the application codec such as registered interfaces and implementations */ + codec?: CodecDescriptorAmino; +} +export interface GetCodecDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetCodecDescriptorResponse"; + value: GetCodecDescriptorResponseAmino; +} +/** GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorResponseSDKType { codec?: CodecDescriptorSDKType; } /** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */ - export interface GetConfigurationDescriptorRequest {} +export interface GetConfigurationDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest"; + value: Uint8Array; +} +/** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorRequestAmino {} +export interface GetConfigurationDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetConfigurationDescriptorRequest"; + value: GetConfigurationDescriptorRequestAmino; +} /** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */ - export interface GetConfigurationDescriptorRequestSDKType {} /** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */ - export interface GetConfigurationDescriptorResponse { /** config describes the application's sdk.Config */ config?: ConfigurationDescriptor; } +export interface GetConfigurationDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse"; + value: Uint8Array; +} /** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */ - -export interface GetConfigurationDescriptorResponseSDKType { +export interface GetConfigurationDescriptorResponseAmino { /** config describes the application's sdk.Config */ + config?: ConfigurationDescriptorAmino; +} +export interface GetConfigurationDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetConfigurationDescriptorResponse"; + value: GetConfigurationDescriptorResponseAmino; +} +/** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorResponseSDKType { config?: ConfigurationDescriptorSDKType; } /** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */ - export interface GetQueryServicesDescriptorRequest {} +export interface GetQueryServicesDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest"; + value: Uint8Array; +} +/** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorRequestAmino {} +export interface GetQueryServicesDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetQueryServicesDescriptorRequest"; + value: GetQueryServicesDescriptorRequestAmino; +} /** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */ - export interface GetQueryServicesDescriptorRequestSDKType {} /** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */ - export interface GetQueryServicesDescriptorResponse { /** queries provides information on the available queryable services */ queries?: QueryServicesDescriptor; } +export interface GetQueryServicesDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse"; + value: Uint8Array; +} /** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */ - -export interface GetQueryServicesDescriptorResponseSDKType { +export interface GetQueryServicesDescriptorResponseAmino { /** queries provides information on the available queryable services */ + queries?: QueryServicesDescriptorAmino; +} +export interface GetQueryServicesDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetQueryServicesDescriptorResponse"; + value: GetQueryServicesDescriptorResponseAmino; +} +/** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorResponseSDKType { queries?: QueryServicesDescriptorSDKType; } /** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */ - export interface GetTxDescriptorRequest {} +export interface GetTxDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest"; + value: Uint8Array; +} +/** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */ +export interface GetTxDescriptorRequestAmino {} +export interface GetTxDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetTxDescriptorRequest"; + value: GetTxDescriptorRequestAmino; +} /** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */ - export interface GetTxDescriptorRequestSDKType {} /** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */ - export interface GetTxDescriptorResponse { /** * tx provides information on msgs that can be forwarded to the application @@ -375,49 +580,78 @@ export interface GetTxDescriptorResponse { */ tx?: TxDescriptor; } +export interface GetTxDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse"; + value: Uint8Array; +} /** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */ - -export interface GetTxDescriptorResponseSDKType { +export interface GetTxDescriptorResponseAmino { /** * tx provides information on msgs that can be forwarded to the application * alongside the accepted transaction protobuf type */ + tx?: TxDescriptorAmino; +} +export interface GetTxDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetTxDescriptorResponse"; + value: GetTxDescriptorResponseAmino; +} +/** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */ +export interface GetTxDescriptorResponseSDKType { tx?: TxDescriptorSDKType; } /** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ - export interface QueryServicesDescriptor { /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ queryServices: QueryServiceDescriptor[]; } +export interface QueryServicesDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor"; + value: Uint8Array; +} /** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ - -export interface QueryServicesDescriptorSDKType { +export interface QueryServicesDescriptorAmino { /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + query_services?: QueryServiceDescriptorAmino[]; +} +export interface QueryServicesDescriptorAminoMsg { + type: "cosmos-sdk/QueryServicesDescriptor"; + value: QueryServicesDescriptorAmino; +} +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptorSDKType { query_services: QueryServiceDescriptorSDKType[]; } /** 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[]; } +export interface QueryServiceDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor"; + value: Uint8Array; +} /** QueryServiceDescriptor describes a cosmos-sdk queryable service */ - -export interface QueryServiceDescriptorSDKType { +export interface QueryServiceDescriptorAmino { /** fullname is the protobuf fullname of the service descriptor */ - fullname: string; + fullname?: string; /** is_module describes if this service is actually exposed by an application's module */ - - is_module: boolean; + is_module?: boolean; /** methods provides a list of query service methods */ - + methods?: QueryMethodDescriptorAmino[]; +} +export interface QueryServiceDescriptorAminoMsg { + type: "cosmos-sdk/QueryServiceDescriptor"; + value: QueryServiceDescriptorAmino; +} +/** QueryServiceDescriptor describes a cosmos-sdk queryable service */ +export interface QueryServiceDescriptorSDKType { + fullname: string; + is_module: boolean; methods: QueryMethodDescriptorSDKType[]; } /** @@ -425,7 +659,6 @@ export interface QueryServiceDescriptorSDKType { * 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; @@ -433,26 +666,39 @@ export interface QueryMethodDescriptor { * full_query_path is the path that can be used to query * this method via tendermint abci.Query */ - fullQueryPath: string; } +export interface QueryMethodDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor"; + value: Uint8Array; +} /** * 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 QueryMethodDescriptorSDKType { +export interface QueryMethodDescriptorAmino { /** name is the protobuf name (not fullname) of the method */ - name: string; + name?: string; /** * full_query_path is the path that can be used to query * this method via tendermint abci.Query */ - + full_query_path?: string; +} +export interface QueryMethodDescriptorAminoMsg { + type: "cosmos-sdk/QueryMethodDescriptor"; + value: QueryMethodDescriptorAmino; +} +/** + * 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 QueryMethodDescriptorSDKType { + name: string; full_query_path: string; } - function createBaseAppDescriptor(): AppDescriptor { return { authn: undefined, @@ -463,79 +709,62 @@ function createBaseAppDescriptor(): AppDescriptor { tx: undefined }; } - export const AppDescriptor = { - encode(message: AppDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor", + encode(message: AppDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authn !== undefined) { AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); } - if (message.chain !== undefined) { ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).ldelim(); } - if (message.codec !== undefined) { CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).ldelim(); } - if (message.configuration !== undefined) { ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).ldelim(); } - if (message.queryServices !== undefined) { QueryServicesDescriptor.encode(message.queryServices, writer.uint32(42).fork()).ldelim(); } - if (message.tx !== undefined) { TxDescriptor.encode(message.tx, writer.uint32(50).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AppDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.authn = AuthnDescriptor.decode(reader, reader.uint32()); break; - case 2: message.chain = ChainDescriptor.decode(reader, reader.uint32()); break; - case 3: message.codec = CodecDescriptor.decode(reader, reader.uint32()); break; - case 4: message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); break; - case 5: message.queryServices = QueryServicesDescriptor.decode(reader, reader.uint32()); break; - case 6: message.tx = TxDescriptor.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AppDescriptor { + fromPartial(object: Partial): 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; @@ -544,110 +773,215 @@ export const AppDescriptor = { 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; + }, + fromAmino(object: AppDescriptorAmino): AppDescriptor { + const message = createBaseAppDescriptor(); + if (object.authn !== undefined && object.authn !== null) { + message.authn = AuthnDescriptor.fromAmino(object.authn); + } + if (object.chain !== undefined && object.chain !== null) { + message.chain = ChainDescriptor.fromAmino(object.chain); + } + if (object.codec !== undefined && object.codec !== null) { + message.codec = CodecDescriptor.fromAmino(object.codec); + } + if (object.configuration !== undefined && object.configuration !== null) { + message.configuration = ConfigurationDescriptor.fromAmino(object.configuration); + } + if (object.query_services !== undefined && object.query_services !== null) { + message.queryServices = QueryServicesDescriptor.fromAmino(object.query_services); + } + if (object.tx !== undefined && object.tx !== null) { + message.tx = TxDescriptor.fromAmino(object.tx); + } + return message; + }, + toAmino(message: AppDescriptor): AppDescriptorAmino { + const obj: any = {}; + obj.authn = message.authn ? AuthnDescriptor.toAmino(message.authn) : undefined; + obj.chain = message.chain ? ChainDescriptor.toAmino(message.chain) : undefined; + obj.codec = message.codec ? CodecDescriptor.toAmino(message.codec) : undefined; + obj.configuration = message.configuration ? ConfigurationDescriptor.toAmino(message.configuration) : undefined; + obj.query_services = message.queryServices ? QueryServicesDescriptor.toAmino(message.queryServices) : undefined; + obj.tx = message.tx ? TxDescriptor.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: AppDescriptorAminoMsg): AppDescriptor { + return AppDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: AppDescriptor): AppDescriptorAminoMsg { + return { + type: "cosmos-sdk/AppDescriptor", + value: AppDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: AppDescriptorProtoMsg): AppDescriptor { + return AppDescriptor.decode(message.value); + }, + toProto(message: AppDescriptor): Uint8Array { + return AppDescriptor.encode(message).finish(); + }, + toProtoMsg(message: AppDescriptor): AppDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor", + value: AppDescriptor.encode(message).finish() + }; } - }; - function createBaseTxDescriptor(): TxDescriptor { return { fullname: "", msgs: [] }; } - export const TxDescriptor = { - encode(message: TxDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor", + encode(message: TxDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); } - for (const v of message.msgs) { MsgDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TxDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.fullname = reader.string(); break; - case 2: message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TxDescriptor { + fromPartial(object: Partial): TxDescriptor { const message = createBaseTxDescriptor(); message.fullname = object.fullname ?? ""; message.msgs = object.msgs?.map(e => MsgDescriptor.fromPartial(e)) || []; return message; + }, + fromAmino(object: TxDescriptorAmino): TxDescriptor { + const message = createBaseTxDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + message.msgs = object.msgs?.map(e => MsgDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxDescriptor): TxDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname; + if (message.msgs) { + obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); + } else { + obj.msgs = []; + } + return obj; + }, + fromAminoMsg(object: TxDescriptorAminoMsg): TxDescriptor { + return TxDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: TxDescriptor): TxDescriptorAminoMsg { + return { + type: "cosmos-sdk/TxDescriptor", + value: TxDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: TxDescriptorProtoMsg): TxDescriptor { + return TxDescriptor.decode(message.value); + }, + toProto(message: TxDescriptor): Uint8Array { + return TxDescriptor.encode(message).finish(); + }, + toProtoMsg(message: TxDescriptor): TxDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor", + value: TxDescriptor.encode(message).finish() + }; } - }; - function createBaseAuthnDescriptor(): AuthnDescriptor { return { signModes: [] }; } - export const AuthnDescriptor = { - encode(message: AuthnDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor", + encode(message: AuthnDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signModes) { SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AuthnDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.signModes.push(SigningModeDescriptor.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AuthnDescriptor { + fromPartial(object: Partial): AuthnDescriptor { const message = createBaseAuthnDescriptor(); message.signModes = object.signModes?.map(e => SigningModeDescriptor.fromPartial(e)) || []; return message; + }, + fromAmino(object: AuthnDescriptorAmino): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.signModes = object.sign_modes?.map(e => SigningModeDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: AuthnDescriptor): AuthnDescriptorAmino { + const obj: any = {}; + if (message.signModes) { + obj.sign_modes = message.signModes.map(e => e ? SigningModeDescriptor.toAmino(e) : undefined); + } else { + obj.sign_modes = []; + } + return obj; + }, + fromAminoMsg(object: AuthnDescriptorAminoMsg): AuthnDescriptor { + return AuthnDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: AuthnDescriptor): AuthnDescriptorAminoMsg { + return { + type: "cosmos-sdk/AuthnDescriptor", + value: AuthnDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: AuthnDescriptorProtoMsg): AuthnDescriptor { + return AuthnDescriptor.decode(message.value); + }, + toProto(message: AuthnDescriptor): Uint8Array { + return AuthnDescriptor.encode(message).finish(); + }, + toProtoMsg(message: AuthnDescriptor): AuthnDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor", + value: AuthnDescriptor.encode(message).finish() + }; } - }; - function createBaseSigningModeDescriptor(): SigningModeDescriptor { return { name: "", @@ -655,154 +989,232 @@ function createBaseSigningModeDescriptor(): SigningModeDescriptor { authnInfoProviderMethodFullname: "" }; } - export const SigningModeDescriptor = { - encode(message: SigningModeDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor", + encode(message: SigningModeDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { writer.uint32(16).int32(message.number); } - if (message.authnInfoProviderMethodFullname !== "") { writer.uint32(26).string(message.authnInfoProviderMethodFullname); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SigningModeDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - case 2: message.number = reader.int32(); break; - case 3: message.authnInfoProviderMethodFullname = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SigningModeDescriptor { + fromPartial(object: Partial): SigningModeDescriptor { const message = createBaseSigningModeDescriptor(); message.name = object.name ?? ""; message.number = object.number ?? 0; message.authnInfoProviderMethodFullname = object.authnInfoProviderMethodFullname ?? ""; return message; + }, + fromAmino(object: SigningModeDescriptorAmino): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.authn_info_provider_method_fullname !== undefined && object.authn_info_provider_method_fullname !== null) { + message.authnInfoProviderMethodFullname = object.authn_info_provider_method_fullname; + } + return message; + }, + toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { + const obj: any = {}; + obj.name = message.name; + obj.number = message.number; + obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname; + return obj; + }, + fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { + return SigningModeDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: SigningModeDescriptor): SigningModeDescriptorAminoMsg { + return { + type: "cosmos-sdk/SigningModeDescriptor", + value: SigningModeDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: SigningModeDescriptorProtoMsg): SigningModeDescriptor { + return SigningModeDescriptor.decode(message.value); + }, + toProto(message: SigningModeDescriptor): Uint8Array { + return SigningModeDescriptor.encode(message).finish(); + }, + toProtoMsg(message: SigningModeDescriptor): SigningModeDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor", + value: SigningModeDescriptor.encode(message).finish() + }; } - }; - function createBaseChainDescriptor(): ChainDescriptor { return { id: "" }; } - export const ChainDescriptor = { - encode(message: ChainDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor", + encode(message: ChainDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ChainDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.id = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ChainDescriptor { + fromPartial(object: Partial): ChainDescriptor { const message = createBaseChainDescriptor(); message.id = object.id ?? ""; return message; + }, + fromAmino(object: ChainDescriptorAmino): ChainDescriptor { + const message = createBaseChainDescriptor(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + return message; + }, + toAmino(message: ChainDescriptor): ChainDescriptorAmino { + const obj: any = {}; + obj.id = message.id; + return obj; + }, + fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { + return ChainDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: ChainDescriptor): ChainDescriptorAminoMsg { + return { + type: "cosmos-sdk/ChainDescriptor", + value: ChainDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: ChainDescriptorProtoMsg): ChainDescriptor { + return ChainDescriptor.decode(message.value); + }, + toProto(message: ChainDescriptor): Uint8Array { + return ChainDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ChainDescriptor): ChainDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor", + value: ChainDescriptor.encode(message).finish() + }; } - }; - function createBaseCodecDescriptor(): CodecDescriptor { return { interfaces: [] }; } - export const CodecDescriptor = { - encode(message: CodecDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor", + encode(message: CodecDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.interfaces) { InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CodecDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CodecDescriptor { + fromPartial(object: Partial): CodecDescriptor { const message = createBaseCodecDescriptor(); message.interfaces = object.interfaces?.map(e => InterfaceDescriptor.fromPartial(e)) || []; return message; + }, + fromAmino(object: CodecDescriptorAmino): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map(e => InterfaceDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: CodecDescriptor): CodecDescriptorAmino { + const obj: any = {}; + if (message.interfaces) { + obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toAmino(e) : undefined); + } else { + obj.interfaces = []; + } + return obj; + }, + fromAminoMsg(object: CodecDescriptorAminoMsg): CodecDescriptor { + return CodecDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: CodecDescriptor): CodecDescriptorAminoMsg { + return { + type: "cosmos-sdk/CodecDescriptor", + value: CodecDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: CodecDescriptorProtoMsg): CodecDescriptor { + return CodecDescriptor.decode(message.value); + }, + toProto(message: CodecDescriptor): Uint8Array { + return CodecDescriptor.encode(message).finish(); + }, + toProtoMsg(message: CodecDescriptor): CodecDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor", + value: CodecDescriptor.encode(message).finish() + }; } - }; - function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { fullname: "", @@ -810,783 +1222,1219 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { interfaceImplementers: [] }; } - export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor", + encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); } - for (const v of message.interfaceAcceptingMessages) { InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.interfaceImplementers) { InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterfaceDescriptor(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.fullname = reader.string(); break; - case 2: message.interfaceAcceptingMessages.push(InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32())); break; - case 3: message.interfaceImplementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): InterfaceDescriptor { + fromPartial(object: Partial): 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; + }, + fromAmino(object: InterfaceDescriptorAmino): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + message.interfaceAcceptingMessages = object.interface_accepting_messages?.map(e => InterfaceAcceptingMessageDescriptor.fromAmino(e)) || []; + message.interfaceImplementers = object.interface_implementers?.map(e => InterfaceImplementerDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname; + if (message.interfaceAcceptingMessages) { + obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); + } else { + obj.interface_accepting_messages = []; + } + if (message.interfaceImplementers) { + obj.interface_implementers = message.interfaceImplementers.map(e => e ? InterfaceImplementerDescriptor.toAmino(e) : undefined); + } else { + obj.interface_implementers = []; + } + return obj; + }, + fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { + return InterfaceDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: InterfaceDescriptor): InterfaceDescriptorAminoMsg { + return { + type: "cosmos-sdk/InterfaceDescriptor", + value: InterfaceDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: InterfaceDescriptorProtoMsg): InterfaceDescriptor { + return InterfaceDescriptor.decode(message.value); + }, + toProto(message: InterfaceDescriptor): Uint8Array { + return InterfaceDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceDescriptor): InterfaceDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor", + value: InterfaceDescriptor.encode(message).finish() + }; } - }; - function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { return { fullname: "", typeUrl: "" }; } - export const InterfaceImplementerDescriptor = { - encode(message: InterfaceImplementerDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", + encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); } - if (message.typeUrl !== "") { writer.uint32(18).string(message.typeUrl); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceImplementerDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.fullname = reader.string(); break; - case 2: message.typeUrl = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): InterfaceImplementerDescriptor { + fromPartial(object: Partial): InterfaceImplementerDescriptor { const message = createBaseInterfaceImplementerDescriptor(); message.fullname = object.fullname ?? ""; message.typeUrl = object.typeUrl ?? ""; return message; + }, + fromAmino(object: InterfaceImplementerDescriptorAmino): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + if (object.type_url !== undefined && object.type_url !== null) { + message.typeUrl = object.type_url; + } + return message; + }, + toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname; + obj.type_url = message.typeUrl; + return obj; + }, + fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAminoMsg { + return { + type: "cosmos-sdk/InterfaceImplementerDescriptor", + value: InterfaceImplementerDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: InterfaceImplementerDescriptorProtoMsg): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.decode(message.value); + }, + toProto(message: InterfaceImplementerDescriptor): Uint8Array { + return InterfaceImplementerDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", + value: InterfaceImplementerDescriptor.encode(message).finish() + }; } - }; - function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { return { fullname: "", fieldDescriptorNames: [] }; } - export const InterfaceAcceptingMessageDescriptor = { - encode(message: InterfaceAcceptingMessageDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", + encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.fullname = reader.string(); break; - case 2: message.fieldDescriptorNames.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): InterfaceAcceptingMessageDescriptor { + fromPartial(object: Partial): InterfaceAcceptingMessageDescriptor { const message = createBaseInterfaceAcceptingMessageDescriptor(); message.fullname = object.fullname ?? ""; message.fieldDescriptorNames = object.fieldDescriptorNames?.map(e => e) || []; return message; + }, + fromAmino(object: InterfaceAcceptingMessageDescriptorAmino): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + message.fieldDescriptorNames = object.field_descriptor_names?.map(e => e) || []; + return message; + }, + toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname; + if (message.fieldDescriptorNames) { + obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); + } else { + obj.field_descriptor_names = []; + } + return obj; + }, + fromAminoMsg(object: InterfaceAcceptingMessageDescriptorAminoMsg): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAminoMsg { + return { + type: "cosmos-sdk/InterfaceAcceptingMessageDescriptor", + value: InterfaceAcceptingMessageDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: InterfaceAcceptingMessageDescriptorProtoMsg): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.decode(message.value); + }, + toProto(message: InterfaceAcceptingMessageDescriptor): Uint8Array { + return InterfaceAcceptingMessageDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", + value: InterfaceAcceptingMessageDescriptor.encode(message).finish() + }; } - }; - function createBaseConfigurationDescriptor(): ConfigurationDescriptor { return { bech32AccountAddressPrefix: "" }; } - export const ConfigurationDescriptor = { - encode(message: ConfigurationDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", + encode(message: ConfigurationDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bech32AccountAddressPrefix !== "") { writer.uint32(10).string(message.bech32AccountAddressPrefix); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConfigurationDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.bech32AccountAddressPrefix = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConfigurationDescriptor { + fromPartial(object: Partial): ConfigurationDescriptor { const message = createBaseConfigurationDescriptor(); message.bech32AccountAddressPrefix = object.bech32AccountAddressPrefix ?? ""; return message; + }, + fromAmino(object: ConfigurationDescriptorAmino): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + if (object.bech32_account_address_prefix !== undefined && object.bech32_account_address_prefix !== null) { + message.bech32AccountAddressPrefix = object.bech32_account_address_prefix; + } + return message; + }, + toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { + const obj: any = {}; + obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix; + return obj; + }, + fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { + return ConfigurationDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: ConfigurationDescriptor): ConfigurationDescriptorAminoMsg { + return { + type: "cosmos-sdk/ConfigurationDescriptor", + value: ConfigurationDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: ConfigurationDescriptorProtoMsg): ConfigurationDescriptor { + return ConfigurationDescriptor.decode(message.value); + }, + toProto(message: ConfigurationDescriptor): Uint8Array { + return ConfigurationDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ConfigurationDescriptor): ConfigurationDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", + value: ConfigurationDescriptor.encode(message).finish() + }; } - }; - function createBaseMsgDescriptor(): MsgDescriptor { return { msgTypeUrl: "" }; } - export const MsgDescriptor = { - encode(message: MsgDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor", + encode(message: MsgDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgTypeUrl !== "") { writer.uint32(10).string(message.msgTypeUrl); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.msgTypeUrl = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgDescriptor { + fromPartial(object: Partial): MsgDescriptor { const message = createBaseMsgDescriptor(); message.msgTypeUrl = object.msgTypeUrl ?? ""; return message; + }, + fromAmino(object: MsgDescriptorAmino): MsgDescriptor { + const message = createBaseMsgDescriptor(); + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + return message; + }, + toAmino(message: MsgDescriptor): MsgDescriptorAmino { + const obj: any = {}; + obj.msg_type_url = message.msgTypeUrl; + return obj; + }, + fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { + return MsgDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: MsgDescriptor): MsgDescriptorAminoMsg { + return { + type: "cosmos-sdk/MsgDescriptor", + value: MsgDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDescriptorProtoMsg): MsgDescriptor { + return MsgDescriptor.decode(message.value); + }, + toProto(message: MsgDescriptor): Uint8Array { + return MsgDescriptor.encode(message).finish(); + }, + toProtoMsg(message: MsgDescriptor): MsgDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor", + value: MsgDescriptor.encode(message).finish() + }; } - }; - function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { return {}; } - export const GetAuthnDescriptorRequest = { - encode(_: GetAuthnDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", + encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthnDescriptorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetAuthnDescriptorRequest { + fromPartial(_: Partial): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, + fromAmino(_: GetAuthnDescriptorRequestAmino): GetAuthnDescriptorRequest { const message = createBaseGetAuthnDescriptorRequest(); return message; + }, + toAmino(_: GetAuthnDescriptorRequest): GetAuthnDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetAuthnDescriptorRequestAminoMsg): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetAuthnDescriptorRequest): GetAuthnDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetAuthnDescriptorRequest", + value: GetAuthnDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetAuthnDescriptorRequestProtoMsg): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.decode(message.value); + }, + toProto(message: GetAuthnDescriptorRequest): Uint8Array { + return GetAuthnDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetAuthnDescriptorRequest): GetAuthnDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", + value: GetAuthnDescriptorRequest.encode(message).finish() + }; } - }; - function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { return { authn: undefined }; } - export const GetAuthnDescriptorResponse = { - encode(message: GetAuthnDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", + encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authn !== undefined) { AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthnDescriptorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.authn = AuthnDescriptor.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetAuthnDescriptorResponse { + fromPartial(object: Partial): GetAuthnDescriptorResponse { const message = createBaseGetAuthnDescriptorResponse(); message.authn = object.authn !== undefined && object.authn !== null ? AuthnDescriptor.fromPartial(object.authn) : undefined; return message; + }, + fromAmino(object: GetAuthnDescriptorResponseAmino): GetAuthnDescriptorResponse { + const message = createBaseGetAuthnDescriptorResponse(); + if (object.authn !== undefined && object.authn !== null) { + message.authn = AuthnDescriptor.fromAmino(object.authn); + } + return message; + }, + toAmino(message: GetAuthnDescriptorResponse): GetAuthnDescriptorResponseAmino { + const obj: any = {}; + obj.authn = message.authn ? AuthnDescriptor.toAmino(message.authn) : undefined; + return obj; + }, + fromAminoMsg(object: GetAuthnDescriptorResponseAminoMsg): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetAuthnDescriptorResponse): GetAuthnDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetAuthnDescriptorResponse", + value: GetAuthnDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetAuthnDescriptorResponseProtoMsg): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.decode(message.value); + }, + toProto(message: GetAuthnDescriptorResponse): Uint8Array { + return GetAuthnDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetAuthnDescriptorResponse): GetAuthnDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", + value: GetAuthnDescriptorResponse.encode(message).finish() + }; } - }; - function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { return {}; } - export const GetChainDescriptorRequest = { - encode(_: GetChainDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", + encode(_: GetChainDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetChainDescriptorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetChainDescriptorRequest { + fromPartial(_: Partial): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, + fromAmino(_: GetChainDescriptorRequestAmino): GetChainDescriptorRequest { const message = createBaseGetChainDescriptorRequest(); return message; + }, + toAmino(_: GetChainDescriptorRequest): GetChainDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetChainDescriptorRequestAminoMsg): GetChainDescriptorRequest { + return GetChainDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetChainDescriptorRequest): GetChainDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetChainDescriptorRequest", + value: GetChainDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetChainDescriptorRequestProtoMsg): GetChainDescriptorRequest { + return GetChainDescriptorRequest.decode(message.value); + }, + toProto(message: GetChainDescriptorRequest): Uint8Array { + return GetChainDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetChainDescriptorRequest): GetChainDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", + value: GetChainDescriptorRequest.encode(message).finish() + }; } - }; - function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { return { chain: undefined }; } - export const GetChainDescriptorResponse = { - encode(message: GetChainDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", + encode(message: GetChainDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chain !== undefined) { ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetChainDescriptorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.chain = ChainDescriptor.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetChainDescriptorResponse { + fromPartial(object: Partial): GetChainDescriptorResponse { const message = createBaseGetChainDescriptorResponse(); message.chain = object.chain !== undefined && object.chain !== null ? ChainDescriptor.fromPartial(object.chain) : undefined; return message; + }, + fromAmino(object: GetChainDescriptorResponseAmino): GetChainDescriptorResponse { + const message = createBaseGetChainDescriptorResponse(); + if (object.chain !== undefined && object.chain !== null) { + message.chain = ChainDescriptor.fromAmino(object.chain); + } + return message; + }, + toAmino(message: GetChainDescriptorResponse): GetChainDescriptorResponseAmino { + const obj: any = {}; + obj.chain = message.chain ? ChainDescriptor.toAmino(message.chain) : undefined; + return obj; + }, + fromAminoMsg(object: GetChainDescriptorResponseAminoMsg): GetChainDescriptorResponse { + return GetChainDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetChainDescriptorResponse): GetChainDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetChainDescriptorResponse", + value: GetChainDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetChainDescriptorResponseProtoMsg): GetChainDescriptorResponse { + return GetChainDescriptorResponse.decode(message.value); + }, + toProto(message: GetChainDescriptorResponse): Uint8Array { + return GetChainDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetChainDescriptorResponse): GetChainDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", + value: GetChainDescriptorResponse.encode(message).finish() + }; } - }; - function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { return {}; } - export const GetCodecDescriptorRequest = { - encode(_: GetCodecDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", + encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetCodecDescriptorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetCodecDescriptorRequest { + fromPartial(_: Partial): GetCodecDescriptorRequest { const message = createBaseGetCodecDescriptorRequest(); return message; + }, + fromAmino(_: GetCodecDescriptorRequestAmino): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, + toAmino(_: GetCodecDescriptorRequest): GetCodecDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetCodecDescriptorRequestAminoMsg): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetCodecDescriptorRequest): GetCodecDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetCodecDescriptorRequest", + value: GetCodecDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetCodecDescriptorRequestProtoMsg): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.decode(message.value); + }, + toProto(message: GetCodecDescriptorRequest): Uint8Array { + return GetCodecDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetCodecDescriptorRequest): GetCodecDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", + value: GetCodecDescriptorRequest.encode(message).finish() + }; } - }; - function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { return { codec: undefined }; } - export const GetCodecDescriptorResponse = { - encode(message: GetCodecDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", + encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codec !== undefined) { CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetCodecDescriptorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.codec = CodecDescriptor.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetCodecDescriptorResponse { + fromPartial(object: Partial): GetCodecDescriptorResponse { const message = createBaseGetCodecDescriptorResponse(); message.codec = object.codec !== undefined && object.codec !== null ? CodecDescriptor.fromPartial(object.codec) : undefined; return message; + }, + fromAmino(object: GetCodecDescriptorResponseAmino): GetCodecDescriptorResponse { + const message = createBaseGetCodecDescriptorResponse(); + if (object.codec !== undefined && object.codec !== null) { + message.codec = CodecDescriptor.fromAmino(object.codec); + } + return message; + }, + toAmino(message: GetCodecDescriptorResponse): GetCodecDescriptorResponseAmino { + const obj: any = {}; + obj.codec = message.codec ? CodecDescriptor.toAmino(message.codec) : undefined; + return obj; + }, + fromAminoMsg(object: GetCodecDescriptorResponseAminoMsg): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetCodecDescriptorResponse): GetCodecDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetCodecDescriptorResponse", + value: GetCodecDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetCodecDescriptorResponseProtoMsg): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.decode(message.value); + }, + toProto(message: GetCodecDescriptorResponse): Uint8Array { + return GetCodecDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetCodecDescriptorResponse): GetCodecDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", + value: GetCodecDescriptorResponse.encode(message).finish() + }; } - }; - function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescriptorRequest { return {}; } - export const GetConfigurationDescriptorRequest = { - encode(_: GetConfigurationDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", + encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetConfigurationDescriptorRequest { + fromPartial(_: Partial): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, + fromAmino(_: GetConfigurationDescriptorRequestAmino): GetConfigurationDescriptorRequest { const message = createBaseGetConfigurationDescriptorRequest(); return message; + }, + toAmino(_: GetConfigurationDescriptorRequest): GetConfigurationDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetConfigurationDescriptorRequestAminoMsg): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetConfigurationDescriptorRequest): GetConfigurationDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetConfigurationDescriptorRequest", + value: GetConfigurationDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetConfigurationDescriptorRequestProtoMsg): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.decode(message.value); + }, + toProto(message: GetConfigurationDescriptorRequest): Uint8Array { + return GetConfigurationDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetConfigurationDescriptorRequest): GetConfigurationDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", + value: GetConfigurationDescriptorRequest.encode(message).finish() + }; } - }; - function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { return { config: undefined }; } - export const GetConfigurationDescriptorResponse = { - encode(message: GetConfigurationDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", + encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.config !== undefined) { ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetConfigurationDescriptorResponse { + fromPartial(object: Partial): GetConfigurationDescriptorResponse { const message = createBaseGetConfigurationDescriptorResponse(); message.config = object.config !== undefined && object.config !== null ? ConfigurationDescriptor.fromPartial(object.config) : undefined; return message; + }, + fromAmino(object: GetConfigurationDescriptorResponseAmino): GetConfigurationDescriptorResponse { + const message = createBaseGetConfigurationDescriptorResponse(); + if (object.config !== undefined && object.config !== null) { + message.config = ConfigurationDescriptor.fromAmino(object.config); + } + return message; + }, + toAmino(message: GetConfigurationDescriptorResponse): GetConfigurationDescriptorResponseAmino { + const obj: any = {}; + obj.config = message.config ? ConfigurationDescriptor.toAmino(message.config) : undefined; + return obj; + }, + fromAminoMsg(object: GetConfigurationDescriptorResponseAminoMsg): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetConfigurationDescriptorResponse): GetConfigurationDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetConfigurationDescriptorResponse", + value: GetConfigurationDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetConfigurationDescriptorResponseProtoMsg): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.decode(message.value); + }, + toProto(message: GetConfigurationDescriptorResponse): Uint8Array { + return GetConfigurationDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetConfigurationDescriptorResponse): GetConfigurationDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", + value: GetConfigurationDescriptorResponse.encode(message).finish() + }; } - }; - function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescriptorRequest { return {}; } - export const GetQueryServicesDescriptorRequest = { - encode(_: GetQueryServicesDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", + encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetQueryServicesDescriptorRequest { + fromPartial(_: Partial): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, + fromAmino(_: GetQueryServicesDescriptorRequestAmino): GetQueryServicesDescriptorRequest { const message = createBaseGetQueryServicesDescriptorRequest(); return message; + }, + toAmino(_: GetQueryServicesDescriptorRequest): GetQueryServicesDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetQueryServicesDescriptorRequestAminoMsg): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetQueryServicesDescriptorRequest): GetQueryServicesDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetQueryServicesDescriptorRequest", + value: GetQueryServicesDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetQueryServicesDescriptorRequestProtoMsg): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.decode(message.value); + }, + toProto(message: GetQueryServicesDescriptorRequest): Uint8Array { + return GetQueryServicesDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetQueryServicesDescriptorRequest): GetQueryServicesDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", + value: GetQueryServicesDescriptorRequest.encode(message).finish() + }; } - }; - function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { return { queries: undefined }; } - export const GetQueryServicesDescriptorResponse = { - encode(message: GetQueryServicesDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", + encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.queries !== undefined) { QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetQueryServicesDescriptorResponse { + fromPartial(object: Partial): GetQueryServicesDescriptorResponse { const message = createBaseGetQueryServicesDescriptorResponse(); message.queries = object.queries !== undefined && object.queries !== null ? QueryServicesDescriptor.fromPartial(object.queries) : undefined; return message; + }, + fromAmino(object: GetQueryServicesDescriptorResponseAmino): GetQueryServicesDescriptorResponse { + const message = createBaseGetQueryServicesDescriptorResponse(); + if (object.queries !== undefined && object.queries !== null) { + message.queries = QueryServicesDescriptor.fromAmino(object.queries); + } + return message; + }, + toAmino(message: GetQueryServicesDescriptorResponse): GetQueryServicesDescriptorResponseAmino { + const obj: any = {}; + obj.queries = message.queries ? QueryServicesDescriptor.toAmino(message.queries) : undefined; + return obj; + }, + fromAminoMsg(object: GetQueryServicesDescriptorResponseAminoMsg): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetQueryServicesDescriptorResponse): GetQueryServicesDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetQueryServicesDescriptorResponse", + value: GetQueryServicesDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetQueryServicesDescriptorResponseProtoMsg): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.decode(message.value); + }, + toProto(message: GetQueryServicesDescriptorResponse): Uint8Array { + return GetQueryServicesDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetQueryServicesDescriptorResponse): GetQueryServicesDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", + value: GetQueryServicesDescriptorResponse.encode(message).finish() + }; } - }; - function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { return {}; } - export const GetTxDescriptorRequest = { - encode(_: GetTxDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", + encode(_: GetTxDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetTxDescriptorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetTxDescriptorRequest { + fromPartial(_: Partial): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, + fromAmino(_: GetTxDescriptorRequestAmino): GetTxDescriptorRequest { const message = createBaseGetTxDescriptorRequest(); return message; + }, + toAmino(_: GetTxDescriptorRequest): GetTxDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetTxDescriptorRequestAminoMsg): GetTxDescriptorRequest { + return GetTxDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetTxDescriptorRequest): GetTxDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetTxDescriptorRequest", + value: GetTxDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxDescriptorRequestProtoMsg): GetTxDescriptorRequest { + return GetTxDescriptorRequest.decode(message.value); + }, + toProto(message: GetTxDescriptorRequest): Uint8Array { + return GetTxDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetTxDescriptorRequest): GetTxDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", + value: GetTxDescriptorRequest.encode(message).finish() + }; } - }; - function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { return { tx: undefined }; } - export const GetTxDescriptorResponse = { - encode(message: GetTxDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", + encode(message: GetTxDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { TxDescriptor.encode(message.tx, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetTxDescriptorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.tx = TxDescriptor.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetTxDescriptorResponse { + fromPartial(object: Partial): GetTxDescriptorResponse { const message = createBaseGetTxDescriptorResponse(); message.tx = object.tx !== undefined && object.tx !== null ? TxDescriptor.fromPartial(object.tx) : undefined; return message; + }, + fromAmino(object: GetTxDescriptorResponseAmino): GetTxDescriptorResponse { + const message = createBaseGetTxDescriptorResponse(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = TxDescriptor.fromAmino(object.tx); + } + return message; + }, + toAmino(message: GetTxDescriptorResponse): GetTxDescriptorResponseAmino { + const obj: any = {}; + obj.tx = message.tx ? TxDescriptor.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: GetTxDescriptorResponseAminoMsg): GetTxDescriptorResponse { + return GetTxDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetTxDescriptorResponse): GetTxDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetTxDescriptorResponse", + value: GetTxDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxDescriptorResponseProtoMsg): GetTxDescriptorResponse { + return GetTxDescriptorResponse.decode(message.value); + }, + toProto(message: GetTxDescriptorResponse): Uint8Array { + return GetTxDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetTxDescriptorResponse): GetTxDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", + value: GetTxDescriptorResponse.encode(message).finish() + }; } - }; - function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { return { queryServices: [] }; } - export const QueryServicesDescriptor = { - encode(message: QueryServicesDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", + encode(message: QueryServicesDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.queryServices) { QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryServicesDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.queryServices.push(QueryServiceDescriptor.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryServicesDescriptor { + fromPartial(object: Partial): QueryServicesDescriptor { const message = createBaseQueryServicesDescriptor(); message.queryServices = object.queryServices?.map(e => QueryServiceDescriptor.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryServicesDescriptorAmino): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.queryServices = object.query_services?.map(e => QueryServiceDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryServicesDescriptor): QueryServicesDescriptorAmino { + const obj: any = {}; + if (message.queryServices) { + obj.query_services = message.queryServices.map(e => e ? QueryServiceDescriptor.toAmino(e) : undefined); + } else { + obj.query_services = []; + } + return obj; + }, + fromAminoMsg(object: QueryServicesDescriptorAminoMsg): QueryServicesDescriptor { + return QueryServicesDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: QueryServicesDescriptor): QueryServicesDescriptorAminoMsg { + return { + type: "cosmos-sdk/QueryServicesDescriptor", + value: QueryServicesDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: QueryServicesDescriptorProtoMsg): QueryServicesDescriptor { + return QueryServicesDescriptor.decode(message.value); + }, + toProto(message: QueryServicesDescriptor): Uint8Array { + return QueryServicesDescriptor.encode(message).finish(); + }, + toProtoMsg(message: QueryServicesDescriptor): QueryServicesDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", + value: QueryServicesDescriptor.encode(message).finish() + }; } - }; - function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { return { fullname: "", @@ -1594,115 +2442,172 @@ function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { methods: [] }; } - export const QueryServiceDescriptor = { - encode(message: QueryServiceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", + encode(message: QueryServiceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); } - if (message.isModule === true) { writer.uint32(16).bool(message.isModule); } - for (const v of message.methods) { QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryServiceDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.fullname = reader.string(); break; - case 2: message.isModule = reader.bool(); break; - case 3: message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryServiceDescriptor { + fromPartial(object: Partial): QueryServiceDescriptor { const message = createBaseQueryServiceDescriptor(); message.fullname = object.fullname ?? ""; message.isModule = object.isModule ?? false; message.methods = object.methods?.map(e => QueryMethodDescriptor.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryServiceDescriptorAmino): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + if (object.is_module !== undefined && object.is_module !== null) { + message.isModule = object.is_module; + } + message.methods = object.methods?.map(e => QueryMethodDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname; + obj.is_module = message.isModule; + if (message.methods) { + obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); + } else { + obj.methods = []; + } + return obj; + }, + fromAminoMsg(object: QueryServiceDescriptorAminoMsg): QueryServiceDescriptor { + return QueryServiceDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: QueryServiceDescriptor): QueryServiceDescriptorAminoMsg { + return { + type: "cosmos-sdk/QueryServiceDescriptor", + value: QueryServiceDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: QueryServiceDescriptorProtoMsg): QueryServiceDescriptor { + return QueryServiceDescriptor.decode(message.value); + }, + toProto(message: QueryServiceDescriptor): Uint8Array { + return QueryServiceDescriptor.encode(message).finish(); + }, + toProtoMsg(message: QueryServiceDescriptor): QueryServiceDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", + value: QueryServiceDescriptor.encode(message).finish() + }; } - }; - function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { return { name: "", fullQueryPath: "" }; } - export const QueryMethodDescriptor = { - encode(message: QueryMethodDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", + encode(message: QueryMethodDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.fullQueryPath !== "") { writer.uint32(18).string(message.fullQueryPath); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryMethodDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - case 2: message.fullQueryPath = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryMethodDescriptor { + fromPartial(object: Partial): QueryMethodDescriptor { const message = createBaseQueryMethodDescriptor(); message.name = object.name ?? ""; message.fullQueryPath = object.fullQueryPath ?? ""; return message; + }, + fromAmino(object: QueryMethodDescriptorAmino): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.full_query_path !== undefined && object.full_query_path !== null) { + message.fullQueryPath = object.full_query_path; + } + return message; + }, + toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { + const obj: any = {}; + obj.name = message.name; + obj.full_query_path = message.fullQueryPath; + return obj; + }, + fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { + return QueryMethodDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: QueryMethodDescriptor): QueryMethodDescriptorAminoMsg { + return { + type: "cosmos-sdk/QueryMethodDescriptor", + value: QueryMethodDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: QueryMethodDescriptorProtoMsg): QueryMethodDescriptor { + return QueryMethodDescriptor.decode(message.value); + }, + toProto(message: QueryMethodDescriptor): Uint8Array { + return QueryMethodDescriptor.encode(message).finish(); + }, + toProtoMsg(message: QueryMethodDescriptor): QueryMethodDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", + value: QueryMethodDescriptor.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/snapshots/v1beta1/snapshot.ts b/src/codegen/cosmos/base/snapshots/v1beta1/snapshot.ts index 7bb3491..02d9a26 100644 --- a/src/codegen/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/src/codegen/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -1,37 +1,60 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** Snapshot contains Tendermint state sync snapshot info. */ - export interface Snapshot { - height: Long; + height: bigint; format: number; chunks: number; hash: Uint8Array; - metadata?: Metadata; + metadata: Metadata; +} +export interface SnapshotProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.Snapshot"; + value: Uint8Array; +} +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface SnapshotAmino { + height?: string; + format?: number; + chunks?: number; + hash?: string; + metadata?: MetadataAmino; +} +export interface SnapshotAminoMsg { + type: "cosmos-sdk/Snapshot"; + value: SnapshotAmino; } /** Snapshot contains Tendermint state sync snapshot info. */ - export interface SnapshotSDKType { - height: Long; + height: bigint; format: number; chunks: number; hash: Uint8Array; - metadata?: MetadataSDKType; + metadata: MetadataSDKType; } /** Metadata contains SDK-specific snapshot metadata. */ - export interface Metadata { /** SHA-256 chunk hashes */ chunkHashes: Uint8Array[]; } +export interface MetadataProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.Metadata"; + value: Uint8Array; +} /** Metadata contains SDK-specific snapshot metadata. */ - -export interface MetadataSDKType { +export interface MetadataAmino { /** SHA-256 chunk hashes */ + chunk_hashes?: string[]; +} +export interface MetadataAminoMsg { + type: "cosmos-sdk/Metadata"; + value: MetadataAmino; +} +/** Metadata contains SDK-specific snapshot metadata. */ +export interface MetadataSDKType { chunk_hashes: Uint8Array[]; } /** SnapshotItem is an item contained in a rootmulti.Store snapshot. */ - export interface SnapshotItem { store?: SnapshotStoreItem; iavl?: SnapshotIAVLItem; @@ -40,8 +63,24 @@ export interface SnapshotItem { kv?: SnapshotKVItem; schema?: SnapshotSchema; } +export interface SnapshotItemProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotItem"; + value: Uint8Array; +} +/** SnapshotItem is an item contained in a rootmulti.Store snapshot. */ +export interface SnapshotItemAmino { + store?: SnapshotStoreItemAmino; + iavl?: SnapshotIAVLItemAmino; + extension?: SnapshotExtensionMetaAmino; + extension_payload?: SnapshotExtensionPayloadAmino; + kv?: SnapshotKVItemAmino; + schema?: SnapshotSchemaAmino; +} +export interface SnapshotItemAminoMsg { + type: "cosmos-sdk/SnapshotItem"; + value: SnapshotItemAmino; +} /** SnapshotItem is an item contained in a rootmulti.Store snapshot. */ - export interface SnapshotItemSDKType { store?: SnapshotStoreItemSDKType; iavl?: SnapshotIAVLItemSDKType; @@ -51,214 +90,332 @@ export interface SnapshotItemSDKType { schema?: SnapshotSchemaSDKType; } /** SnapshotStoreItem contains metadata about a snapshotted store. */ - export interface SnapshotStoreItem { name: string; } +export interface SnapshotStoreItemProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotStoreItem"; + value: Uint8Array; +} +/** SnapshotStoreItem contains metadata about a snapshotted store. */ +export interface SnapshotStoreItemAmino { + name?: string; +} +export interface SnapshotStoreItemAminoMsg { + type: "cosmos-sdk/SnapshotStoreItem"; + value: SnapshotStoreItemAmino; +} /** SnapshotStoreItem contains metadata about a snapshotted store. */ - export interface SnapshotStoreItemSDKType { name: string; } /** SnapshotIAVLItem is an exported IAVL node. */ - export interface SnapshotIAVLItem { key: Uint8Array; value: Uint8Array; /** version is block height */ - - version: Long; + version: bigint; /** height is depth of the tree. */ - height: number; } +export interface SnapshotIAVLItemProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem"; + value: Uint8Array; +} +/** SnapshotIAVLItem is an exported IAVL node. */ +export interface SnapshotIAVLItemAmino { + key?: string; + value?: string; + /** version is block height */ + version?: string; + /** height is depth of the tree. */ + height?: number; +} +export interface SnapshotIAVLItemAminoMsg { + type: "cosmos-sdk/SnapshotIAVLItem"; + value: SnapshotIAVLItemAmino; +} /** SnapshotIAVLItem is an exported IAVL node. */ - export interface SnapshotIAVLItemSDKType { key: Uint8Array; value: Uint8Array; - /** version is block height */ - - version: Long; - /** height is depth of the tree. */ - + version: bigint; height: number; } /** SnapshotExtensionMeta contains metadata about an external snapshotter. */ - export interface SnapshotExtensionMeta { name: string; format: number; } +export interface SnapshotExtensionMetaProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta"; + value: Uint8Array; +} +/** SnapshotExtensionMeta contains metadata about an external snapshotter. */ +export interface SnapshotExtensionMetaAmino { + name?: string; + format?: number; +} +export interface SnapshotExtensionMetaAminoMsg { + type: "cosmos-sdk/SnapshotExtensionMeta"; + value: SnapshotExtensionMetaAmino; +} /** SnapshotExtensionMeta contains metadata about an external snapshotter. */ - export interface SnapshotExtensionMetaSDKType { name: string; format: number; } /** SnapshotExtensionPayload contains payloads of an external snapshotter. */ - export interface SnapshotExtensionPayload { payload: Uint8Array; } +export interface SnapshotExtensionPayloadProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload"; + value: Uint8Array; +} +/** SnapshotExtensionPayload contains payloads of an external snapshotter. */ +export interface SnapshotExtensionPayloadAmino { + payload?: string; +} +export interface SnapshotExtensionPayloadAminoMsg { + type: "cosmos-sdk/SnapshotExtensionPayload"; + value: SnapshotExtensionPayloadAmino; +} /** SnapshotExtensionPayload contains payloads of an external snapshotter. */ - export interface SnapshotExtensionPayloadSDKType { payload: Uint8Array; } /** SnapshotKVItem is an exported Key/Value Pair */ - export interface SnapshotKVItem { key: Uint8Array; value: Uint8Array; } +export interface SnapshotKVItemProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotKVItem"; + value: Uint8Array; +} +/** SnapshotKVItem is an exported Key/Value Pair */ +export interface SnapshotKVItemAmino { + key?: string; + value?: string; +} +export interface SnapshotKVItemAminoMsg { + type: "cosmos-sdk/SnapshotKVItem"; + value: SnapshotKVItemAmino; +} /** SnapshotKVItem is an exported Key/Value Pair */ - export interface SnapshotKVItemSDKType { key: Uint8Array; value: Uint8Array; } /** SnapshotSchema is an exported schema of smt store */ - export interface SnapshotSchema { keys: Uint8Array[]; } +export interface SnapshotSchemaProtoMsg { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotSchema"; + value: Uint8Array; +} +/** SnapshotSchema is an exported schema of smt store */ +export interface SnapshotSchemaAmino { + keys?: string[]; +} +export interface SnapshotSchemaAminoMsg { + type: "cosmos-sdk/SnapshotSchema"; + value: SnapshotSchemaAmino; +} /** SnapshotSchema is an exported schema of smt store */ - export interface SnapshotSchemaSDKType { keys: Uint8Array[]; } - function createBaseSnapshot(): Snapshot { return { - height: Long.UZERO, + height: BigInt(0), format: 0, chunks: 0, hash: new Uint8Array(), - metadata: undefined + metadata: Metadata.fromPartial({}) }; } - export const Snapshot = { - encode(message: Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/cosmos.base.snapshots.v1beta1.Snapshot", + encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); } - if (message.format !== 0) { writer.uint32(16).uint32(message.format); } - if (message.chunks !== 0) { writer.uint32(24).uint32(message.chunks); } - if (message.hash.length !== 0) { writer.uint32(34).bytes(message.hash); } - if (message.metadata !== undefined) { Metadata.encode(message.metadata, writer.uint32(42).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSnapshot(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.uint64() as Long); + message.height = reader.uint64(); break; - case 2: message.format = reader.uint32(); break; - case 3: message.chunks = reader.uint32(); break; - case 4: message.hash = reader.bytes(); break; - case 5: message.metadata = Metadata.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Snapshot { + fromPartial(object: Partial): Snapshot { const message = createBaseSnapshot(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.UZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.format = object.format ?? 0; message.chunks = object.chunks ?? 0; message.hash = object.hash ?? new Uint8Array(); message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; return message; + }, + fromAmino(object: SnapshotAmino): Snapshot { + const message = createBaseSnapshot(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunks !== undefined && object.chunks !== null) { + message.chunks = object.chunks; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Metadata.fromAmino(object.metadata); + } + return message; + }, + toAmino(message: Snapshot): SnapshotAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.format = message.format; + obj.chunks = message.chunks; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotAminoMsg): Snapshot { + return Snapshot.fromAmino(object.value); + }, + toAminoMsg(message: Snapshot): SnapshotAminoMsg { + return { + type: "cosmos-sdk/Snapshot", + value: Snapshot.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotProtoMsg): Snapshot { + return Snapshot.decode(message.value); + }, + toProto(message: Snapshot): Uint8Array { + return Snapshot.encode(message).finish(); + }, + toProtoMsg(message: Snapshot): SnapshotProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.Snapshot", + value: Snapshot.encode(message).finish() + }; } - }; - function createBaseMetadata(): Metadata { return { chunkHashes: [] }; } - export const Metadata = { - encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.snapshots.v1beta1.Metadata", + encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.chunkHashes) { writer.uint32(10).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMetadata(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.chunkHashes.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Metadata { + fromPartial(object: Partial): Metadata { const message = createBaseMetadata(); message.chunkHashes = object.chunkHashes?.map(e => e) || []; return message; + }, + fromAmino(object: MetadataAmino): Metadata { + const message = createBaseMetadata(); + message.chunkHashes = object.chunk_hashes?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Metadata): MetadataAmino { + const obj: any = {}; + if (message.chunkHashes) { + obj.chunk_hashes = message.chunkHashes.map(e => base64FromBytes(e)); + } else { + obj.chunk_hashes = []; + } + return obj; + }, + fromAminoMsg(object: MetadataAminoMsg): Metadata { + return Metadata.fromAmino(object.value); + }, + toAminoMsg(message: Metadata): MetadataAminoMsg { + return { + type: "cosmos-sdk/Metadata", + value: Metadata.toAmino(message) + }; + }, + fromProtoMsg(message: MetadataProtoMsg): Metadata { + return Metadata.decode(message.value); + }, + toProto(message: Metadata): Uint8Array { + return Metadata.encode(message).finish(); + }, + toProtoMsg(message: Metadata): MetadataProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.Metadata", + value: Metadata.encode(message).finish() + }; } - }; - function createBaseSnapshotItem(): SnapshotItem { return { store: undefined, @@ -269,79 +426,62 @@ function createBaseSnapshotItem(): SnapshotItem { schema: undefined }; } - export const SnapshotItem = { - encode(message: SnapshotItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotItem", + encode(message: SnapshotItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.store !== undefined) { SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).ldelim(); } - if (message.iavl !== undefined) { SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).ldelim(); } - if (message.extension !== undefined) { SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).ldelim(); } - if (message.extensionPayload !== undefined) { SnapshotExtensionPayload.encode(message.extensionPayload, writer.uint32(34).fork()).ldelim(); } - if (message.kv !== undefined) { SnapshotKVItem.encode(message.kv, writer.uint32(42).fork()).ldelim(); } - if (message.schema !== undefined) { SnapshotSchema.encode(message.schema, writer.uint32(50).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotItem { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.store = SnapshotStoreItem.decode(reader, reader.uint32()); break; - case 2: message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); break; - case 3: message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); break; - case 4: message.extensionPayload = SnapshotExtensionPayload.decode(reader, reader.uint32()); break; - case 5: message.kv = SnapshotKVItem.decode(reader, reader.uint32()); break; - case 6: message.schema = SnapshotSchema.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SnapshotItem { + fromPartial(object: Partial): 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; @@ -350,326 +490,534 @@ export const SnapshotItem = { message.kv = object.kv !== undefined && object.kv !== null ? SnapshotKVItem.fromPartial(object.kv) : undefined; message.schema = object.schema !== undefined && object.schema !== null ? SnapshotSchema.fromPartial(object.schema) : undefined; return message; + }, + fromAmino(object: SnapshotItemAmino): SnapshotItem { + const message = createBaseSnapshotItem(); + if (object.store !== undefined && object.store !== null) { + message.store = SnapshotStoreItem.fromAmino(object.store); + } + if (object.iavl !== undefined && object.iavl !== null) { + message.iavl = SnapshotIAVLItem.fromAmino(object.iavl); + } + if (object.extension !== undefined && object.extension !== null) { + message.extension = SnapshotExtensionMeta.fromAmino(object.extension); + } + if (object.extension_payload !== undefined && object.extension_payload !== null) { + message.extensionPayload = SnapshotExtensionPayload.fromAmino(object.extension_payload); + } + if (object.kv !== undefined && object.kv !== null) { + message.kv = SnapshotKVItem.fromAmino(object.kv); + } + if (object.schema !== undefined && object.schema !== null) { + message.schema = SnapshotSchema.fromAmino(object.schema); + } + return message; + }, + toAmino(message: SnapshotItem): SnapshotItemAmino { + const obj: any = {}; + obj.store = message.store ? SnapshotStoreItem.toAmino(message.store) : undefined; + obj.iavl = message.iavl ? SnapshotIAVLItem.toAmino(message.iavl) : undefined; + obj.extension = message.extension ? SnapshotExtensionMeta.toAmino(message.extension) : undefined; + obj.extension_payload = message.extensionPayload ? SnapshotExtensionPayload.toAmino(message.extensionPayload) : undefined; + obj.kv = message.kv ? SnapshotKVItem.toAmino(message.kv) : undefined; + obj.schema = message.schema ? SnapshotSchema.toAmino(message.schema) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotItemAminoMsg): SnapshotItem { + return SnapshotItem.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotItem): SnapshotItemAminoMsg { + return { + type: "cosmos-sdk/SnapshotItem", + value: SnapshotItem.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotItemProtoMsg): SnapshotItem { + return SnapshotItem.decode(message.value); + }, + toProto(message: SnapshotItem): Uint8Array { + return SnapshotItem.encode(message).finish(); + }, + toProtoMsg(message: SnapshotItem): SnapshotItemProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotItem", + value: SnapshotItem.encode(message).finish() + }; } - }; - function createBaseSnapshotStoreItem(): SnapshotStoreItem { return { name: "" }; } - export const SnapshotStoreItem = { - encode(message: SnapshotStoreItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotStoreItem", + encode(message: SnapshotStoreItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotStoreItem { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SnapshotStoreItem { + fromPartial(object: Partial): SnapshotStoreItem { const message = createBaseSnapshotStoreItem(); message.name = object.name ?? ""; return message; + }, + fromAmino(object: SnapshotStoreItemAmino): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + return message; + }, + toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { + const obj: any = {}; + obj.name = message.name; + return obj; + }, + fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { + return SnapshotStoreItem.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotStoreItem): SnapshotStoreItemAminoMsg { + return { + type: "cosmos-sdk/SnapshotStoreItem", + value: SnapshotStoreItem.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotStoreItemProtoMsg): SnapshotStoreItem { + return SnapshotStoreItem.decode(message.value); + }, + toProto(message: SnapshotStoreItem): Uint8Array { + return SnapshotStoreItem.encode(message).finish(); + }, + toProtoMsg(message: SnapshotStoreItem): SnapshotStoreItemProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotStoreItem", + value: SnapshotStoreItem.encode(message).finish() + }; } - }; - function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { return { key: new Uint8Array(), value: new Uint8Array(), - version: Long.ZERO, + version: BigInt(0), height: 0 }; } - export const SnapshotIAVLItem = { - encode(message: SnapshotIAVLItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", + encode(message: SnapshotIAVLItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - - if (!message.version.isZero()) { + if (message.version !== BigInt(0)) { writer.uint32(24).int64(message.version); } - if (message.height !== 0) { writer.uint32(32).int32(message.height); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotIAVLItem { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.key = reader.bytes(); break; - case 2: message.value = reader.bytes(); break; - case 3: - message.version = (reader.int64() as Long); + message.version = reader.int64(); break; - case 4: message.height = reader.int32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SnapshotIAVLItem { + fromPartial(object: Partial): SnapshotIAVLItem { const message = createBaseSnapshotIAVLItem(); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); - message.version = object.version !== undefined && object.version !== null ? Long.fromValue(object.version) : Long.ZERO; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); message.height = object.height ?? 0; return message; + }, + fromAmino(object: SnapshotIAVLItemAmino): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.height !== undefined && object.height !== null) { + message.height = object.height; + } + return message; + }, + toAmino(message: SnapshotIAVLItem): SnapshotIAVLItemAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.version = message.version ? message.version.toString() : undefined; + obj.height = message.height; + return obj; + }, + fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { + return SnapshotIAVLItem.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotIAVLItem): SnapshotIAVLItemAminoMsg { + return { + type: "cosmos-sdk/SnapshotIAVLItem", + value: SnapshotIAVLItem.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotIAVLItemProtoMsg): SnapshotIAVLItem { + return SnapshotIAVLItem.decode(message.value); + }, + toProto(message: SnapshotIAVLItem): Uint8Array { + return SnapshotIAVLItem.encode(message).finish(); + }, + toProtoMsg(message: SnapshotIAVLItem): SnapshotIAVLItemProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", + value: SnapshotIAVLItem.encode(message).finish() + }; } - }; - function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { return { name: "", format: 0 }; } - export const SnapshotExtensionMeta = { - encode(message: SnapshotExtensionMeta, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta", + encode(message: SnapshotExtensionMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.format !== 0) { writer.uint32(16).uint32(message.format); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotExtensionMeta { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - case 2: message.format = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SnapshotExtensionMeta { + fromPartial(object: Partial): SnapshotExtensionMeta { const message = createBaseSnapshotExtensionMeta(); message.name = object.name ?? ""; message.format = object.format ?? 0; return message; + }, + fromAmino(object: SnapshotExtensionMetaAmino): SnapshotExtensionMeta { + const message = createBaseSnapshotExtensionMeta(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + return message; + }, + toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { + const obj: any = {}; + obj.name = message.name; + obj.format = message.format; + return obj; + }, + fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { + return SnapshotExtensionMeta.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotExtensionMeta): SnapshotExtensionMetaAminoMsg { + return { + type: "cosmos-sdk/SnapshotExtensionMeta", + value: SnapshotExtensionMeta.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotExtensionMetaProtoMsg): SnapshotExtensionMeta { + return SnapshotExtensionMeta.decode(message.value); + }, + toProto(message: SnapshotExtensionMeta): Uint8Array { + return SnapshotExtensionMeta.encode(message).finish(); + }, + toProtoMsg(message: SnapshotExtensionMeta): SnapshotExtensionMetaProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta", + value: SnapshotExtensionMeta.encode(message).finish() + }; } - }; - function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { return { payload: new Uint8Array() }; } - export const SnapshotExtensionPayload = { - encode(message: SnapshotExtensionPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload", + encode(message: SnapshotExtensionPayload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.payload.length !== 0) { writer.uint32(10).bytes(message.payload); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotExtensionPayload { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.payload = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SnapshotExtensionPayload { + fromPartial(object: Partial): SnapshotExtensionPayload { const message = createBaseSnapshotExtensionPayload(); message.payload = object.payload ?? new Uint8Array(); return message; + }, + fromAmino(object: SnapshotExtensionPayloadAmino): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + if (object.payload !== undefined && object.payload !== null) { + message.payload = bytesFromBase64(object.payload); + } + return message; + }, + toAmino(message: SnapshotExtensionPayload): SnapshotExtensionPayloadAmino { + const obj: any = {}; + obj.payload = message.payload ? base64FromBytes(message.payload) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotExtensionPayloadAminoMsg): SnapshotExtensionPayload { + return SnapshotExtensionPayload.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotExtensionPayload): SnapshotExtensionPayloadAminoMsg { + return { + type: "cosmos-sdk/SnapshotExtensionPayload", + value: SnapshotExtensionPayload.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotExtensionPayloadProtoMsg): SnapshotExtensionPayload { + return SnapshotExtensionPayload.decode(message.value); + }, + toProto(message: SnapshotExtensionPayload): Uint8Array { + return SnapshotExtensionPayload.encode(message).finish(); + }, + toProtoMsg(message: SnapshotExtensionPayload): SnapshotExtensionPayloadProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload", + value: SnapshotExtensionPayload.encode(message).finish() + }; } - }; - function createBaseSnapshotKVItem(): SnapshotKVItem { return { key: new Uint8Array(), value: new Uint8Array() }; } - export const SnapshotKVItem = { - encode(message: SnapshotKVItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotKVItem", + encode(message: SnapshotKVItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotKVItem { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotKVItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSnapshotKVItem(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: message.value = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SnapshotKVItem { + fromPartial(object: Partial): SnapshotKVItem { const message = createBaseSnapshotKVItem(); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); return message; + }, + fromAmino(object: SnapshotKVItemAmino): SnapshotKVItem { + const message = createBaseSnapshotKVItem(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: SnapshotKVItem): SnapshotKVItemAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotKVItemAminoMsg): SnapshotKVItem { + return SnapshotKVItem.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotKVItem): SnapshotKVItemAminoMsg { + return { + type: "cosmos-sdk/SnapshotKVItem", + value: SnapshotKVItem.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotKVItemProtoMsg): SnapshotKVItem { + return SnapshotKVItem.decode(message.value); + }, + toProto(message: SnapshotKVItem): Uint8Array { + return SnapshotKVItem.encode(message).finish(); + }, + toProtoMsg(message: SnapshotKVItem): SnapshotKVItemProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotKVItem", + value: SnapshotKVItem.encode(message).finish() + }; } - }; - function createBaseSnapshotSchema(): SnapshotSchema { return { keys: [] }; } - export const SnapshotSchema = { - encode(message: SnapshotSchema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotSchema", + encode(message: SnapshotSchema, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.keys) { writer.uint32(10).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotSchema { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotSchema { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSnapshotSchema(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.keys.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SnapshotSchema { + fromPartial(object: Partial): SnapshotSchema { const message = createBaseSnapshotSchema(); message.keys = object.keys?.map(e => e) || []; return message; + }, + fromAmino(object: SnapshotSchemaAmino): SnapshotSchema { + const message = createBaseSnapshotSchema(); + message.keys = object.keys?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: SnapshotSchema): SnapshotSchemaAmino { + const obj: any = {}; + if (message.keys) { + obj.keys = message.keys.map(e => base64FromBytes(e)); + } else { + obj.keys = []; + } + return obj; + }, + fromAminoMsg(object: SnapshotSchemaAminoMsg): SnapshotSchema { + return SnapshotSchema.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotSchema): SnapshotSchemaAminoMsg { + return { + type: "cosmos-sdk/SnapshotSchema", + value: SnapshotSchema.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotSchemaProtoMsg): SnapshotSchema { + return SnapshotSchema.decode(message.value); + }, + toProto(message: SnapshotSchema): Uint8Array { + return SnapshotSchema.encode(message).finish(); + }, + toProtoMsg(message: SnapshotSchema): SnapshotSchemaProtoMsg { + return { + typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotSchema", + value: SnapshotSchema.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/store/v1beta1/commit_info.ts b/src/codegen/cosmos/base/store/v1beta1/commit_info.ts index 3d83bb4..9fd3f79 100644 --- a/src/codegen/cosmos/base/store/v1beta1/commit_info.ts +++ b/src/codegen/cosmos/base/store/v1beta1/commit_info.ts @@ -1,221 +1,343 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * CommitInfo defines commit information used by the multi-store when committing * a version/height. */ - export interface CommitInfo { - version: Long; + version: bigint; storeInfos: StoreInfo[]; } +export interface CommitInfoProtoMsg { + typeUrl: "/cosmos.base.store.v1beta1.CommitInfo"; + value: Uint8Array; +} +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfoAmino { + version?: string; + store_infos?: StoreInfoAmino[]; +} +export interface CommitInfoAminoMsg { + type: "cosmos-sdk/CommitInfo"; + value: CommitInfoAmino; +} /** * CommitInfo defines commit information used by the multi-store when committing * a version/height. */ - export interface CommitInfoSDKType { - version: Long; + version: bigint; store_infos: StoreInfoSDKType[]; } /** * 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; + commitId: CommitID; +} +export interface StoreInfoProtoMsg { + typeUrl: "/cosmos.base.store.v1beta1.StoreInfo"; + value: Uint8Array; +} +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfoAmino { + name?: string; + commit_id?: CommitIDAmino; +} +export interface StoreInfoAminoMsg { + type: "cosmos-sdk/StoreInfo"; + value: StoreInfoAmino; } /** * StoreInfo defines store-specific commit information. It contains a reference * between a store name and the commit ID. */ - export interface StoreInfoSDKType { name: string; - commit_id?: CommitIDSDKType; + commit_id: CommitIDSDKType; } /** * CommitID defines the committment information when a specific store is * committed. */ - export interface CommitID { - version: Long; + version: bigint; hash: Uint8Array; } +export interface CommitIDProtoMsg { + typeUrl: "/cosmos.base.store.v1beta1.CommitID"; + value: Uint8Array; +} +/** + * CommitID defines the committment information when a specific store is + * committed. + */ +export interface CommitIDAmino { + version?: string; + hash?: string; +} +export interface CommitIDAminoMsg { + type: "cosmos-sdk/CommitID"; + value: CommitIDAmino; +} /** * CommitID defines the committment information when a specific store is * committed. */ - export interface CommitIDSDKType { - version: Long; + version: bigint; hash: Uint8Array; } - function createBaseCommitInfo(): CommitInfo { return { - version: Long.ZERO, + version: BigInt(0), storeInfos: [] }; } - export const CommitInfo = { - encode(message: CommitInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.version.isZero()) { + typeUrl: "/cosmos.base.store.v1beta1.CommitInfo", + encode(message: CommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== BigInt(0)) { writer.uint32(8).int64(message.version); } - for (const v of message.storeInfos) { StoreInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CommitInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommitInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.version = (reader.int64() as Long); + message.version = reader.int64(); break; - case 2: message.storeInfos.push(StoreInfo.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CommitInfo { + fromPartial(object: Partial): CommitInfo { const message = createBaseCommitInfo(); - message.version = object.version !== undefined && object.version !== null ? Long.fromValue(object.version) : Long.ZERO; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); message.storeInfos = object.storeInfos?.map(e => StoreInfo.fromPartial(e)) || []; return message; + }, + fromAmino(object: CommitInfoAmino): CommitInfo { + const message = createBaseCommitInfo(); + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + message.storeInfos = object.store_infos?.map(e => StoreInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: CommitInfo): CommitInfoAmino { + const obj: any = {}; + obj.version = message.version ? message.version.toString() : undefined; + if (message.storeInfos) { + obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); + } else { + obj.store_infos = []; + } + return obj; + }, + fromAminoMsg(object: CommitInfoAminoMsg): CommitInfo { + return CommitInfo.fromAmino(object.value); + }, + toAminoMsg(message: CommitInfo): CommitInfoAminoMsg { + return { + type: "cosmos-sdk/CommitInfo", + value: CommitInfo.toAmino(message) + }; + }, + fromProtoMsg(message: CommitInfoProtoMsg): CommitInfo { + return CommitInfo.decode(message.value); + }, + toProto(message: CommitInfo): Uint8Array { + return CommitInfo.encode(message).finish(); + }, + toProtoMsg(message: CommitInfo): CommitInfoProtoMsg { + return { + typeUrl: "/cosmos.base.store.v1beta1.CommitInfo", + value: CommitInfo.encode(message).finish() + }; } - }; - function createBaseStoreInfo(): StoreInfo { return { name: "", - commitId: undefined + commitId: CommitID.fromPartial({}) }; } - export const StoreInfo = { - encode(message: StoreInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.store.v1beta1.StoreInfo", + encode(message: StoreInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.commitId !== undefined) { CommitID.encode(message.commitId, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StoreInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - case 2: message.commitId = CommitID.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): StoreInfo { + fromPartial(object: Partial): StoreInfo { const message = createBaseStoreInfo(); message.name = object.name ?? ""; message.commitId = object.commitId !== undefined && object.commitId !== null ? CommitID.fromPartial(object.commitId) : undefined; return message; + }, + fromAmino(object: StoreInfoAmino): StoreInfo { + const message = createBaseStoreInfo(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.commit_id !== undefined && object.commit_id !== null) { + message.commitId = CommitID.fromAmino(object.commit_id); + } + return message; + }, + toAmino(message: StoreInfo): StoreInfoAmino { + const obj: any = {}; + obj.name = message.name; + obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; + return obj; + }, + fromAminoMsg(object: StoreInfoAminoMsg): StoreInfo { + return StoreInfo.fromAmino(object.value); + }, + toAminoMsg(message: StoreInfo): StoreInfoAminoMsg { + return { + type: "cosmos-sdk/StoreInfo", + value: StoreInfo.toAmino(message) + }; + }, + fromProtoMsg(message: StoreInfoProtoMsg): StoreInfo { + return StoreInfo.decode(message.value); + }, + toProto(message: StoreInfo): Uint8Array { + return StoreInfo.encode(message).finish(); + }, + toProtoMsg(message: StoreInfo): StoreInfoProtoMsg { + return { + typeUrl: "/cosmos.base.store.v1beta1.StoreInfo", + value: StoreInfo.encode(message).finish() + }; } - }; - function createBaseCommitID(): CommitID { return { - version: Long.ZERO, + version: BigInt(0), hash: new Uint8Array() }; } - export const CommitID = { - encode(message: CommitID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.version.isZero()) { + typeUrl: "/cosmos.base.store.v1beta1.CommitID", + encode(message: CommitID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== BigInt(0)) { writer.uint32(8).int64(message.version); } - if (message.hash.length !== 0) { writer.uint32(18).bytes(message.hash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CommitID { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.version = (reader.int64() as Long); + message.version = reader.int64(); break; - case 2: message.hash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CommitID { + fromPartial(object: Partial): CommitID { const message = createBaseCommitID(); - message.version = object.version !== undefined && object.version !== null ? Long.fromValue(object.version) : Long.ZERO; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); message.hash = object.hash ?? new Uint8Array(); return message; + }, + fromAmino(object: CommitIDAmino): CommitID { + const message = createBaseCommitID(); + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: CommitID): CommitIDAmino { + const obj: any = {}; + obj.version = message.version ? message.version.toString() : undefined; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: CommitIDAminoMsg): CommitID { + return CommitID.fromAmino(object.value); + }, + toAminoMsg(message: CommitID): CommitIDAminoMsg { + return { + type: "cosmos-sdk/CommitID", + value: CommitID.toAmino(message) + }; + }, + fromProtoMsg(message: CommitIDProtoMsg): CommitID { + return CommitID.decode(message.value); + }, + toProto(message: CommitID): Uint8Array { + return CommitID.encode(message).finish(); + }, + toProtoMsg(message: CommitID): CommitIDProtoMsg { + return { + typeUrl: "/cosmos.base.store.v1beta1.CommitID", + value: CommitID.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/store/v1beta1/listening.ts b/src/codegen/cosmos/base/store/v1beta1/listening.ts index 8023f66..ae70e0f 100644 --- a/src/codegen/cosmos/base/store/v1beta1/listening.ts +++ b/src/codegen/cosmos/base/store/v1beta1/listening.ts @@ -1,5 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * 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 @@ -7,16 +7,18 @@ import { DeepPartial } from "../../../../helpers"; * * 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; } +export interface StoreKVPairProtoMsg { + typeUrl: "/cosmos.base.store.v1beta1.StoreKVPair"; + value: Uint8Array; +} /** * 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 @@ -24,17 +26,31 @@ export interface StoreKVPair { * * Since: cosmos-sdk 0.43 */ - -export interface StoreKVPairSDKType { +export interface StoreKVPairAmino { /** the store key for the KVStore this pair originates from */ - store_key: string; + store_key?: string; /** true indicates a delete operation, false indicates a set operation */ - + delete?: boolean; + key?: string; + value?: string; +} +export interface StoreKVPairAminoMsg { + type: "cosmos-sdk/StoreKVPair"; + value: StoreKVPairAmino; +} +/** + * 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 StoreKVPairSDKType { + store_key: string; delete: boolean; key: Uint8Array; value: Uint8Array; } - function createBaseStoreKVPair(): StoreKVPair { return { storeKey: "", @@ -43,69 +59,100 @@ function createBaseStoreKVPair(): StoreKVPair { value: new Uint8Array() }; } - export const StoreKVPair = { - encode(message: StoreKVPair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.store.v1beta1.StoreKVPair", + encode(message: StoreKVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.storeKey !== "") { writer.uint32(10).string(message.storeKey); } - if (message.delete === true) { writer.uint32(16).bool(message.delete); } - if (message.key.length !== 0) { writer.uint32(26).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(34).bytes(message.value); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StoreKVPair { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.storeKey = reader.string(); break; - case 2: message.delete = reader.bool(); break; - case 3: message.key = reader.bytes(); break; - case 4: message.value = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): StoreKVPair { + fromPartial(object: Partial): StoreKVPair { const message = createBaseStoreKVPair(); message.storeKey = object.storeKey ?? ""; message.delete = object.delete ?? false; message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); return message; + }, + fromAmino(object: StoreKVPairAmino): StoreKVPair { + const message = createBaseStoreKVPair(); + if (object.store_key !== undefined && object.store_key !== null) { + message.storeKey = object.store_key; + } + if (object.delete !== undefined && object.delete !== null) { + message.delete = object.delete; + } + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: StoreKVPair): StoreKVPairAmino { + const obj: any = {}; + obj.store_key = message.storeKey; + obj.delete = message.delete; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: StoreKVPairAminoMsg): StoreKVPair { + return StoreKVPair.fromAmino(object.value); + }, + toAminoMsg(message: StoreKVPair): StoreKVPairAminoMsg { + return { + type: "cosmos-sdk/StoreKVPair", + value: StoreKVPair.toAmino(message) + }; + }, + fromProtoMsg(message: StoreKVPairProtoMsg): StoreKVPair { + return StoreKVPair.decode(message.value); + }, + toProto(message: StoreKVPair): Uint8Array { + return StoreKVPair.encode(message).finish(); + }, + toProtoMsg(message: StoreKVPair): StoreKVPairProtoMsg { + return { + typeUrl: "/cosmos.base.store.v1beta1.StoreKVPair", + value: StoreKVPair.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/tendermint/v1beta1/query.lcd.ts b/src/codegen/cosmos/base/tendermint/v1beta1/query.lcd.ts index 831fcf2..1a19acb 100644 --- a/src/codegen/cosmos/base/tendermint/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/base/tendermint/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { GetNodeInfoRequest, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -18,64 +17,47 @@ export class LCDQueryClient { this.getValidatorSetByHeight = this.getValidatorSetByHeight.bind(this); } /* GetNodeInfo queries the current node info. */ - - async getNodeInfo(_params: GetNodeInfoRequest = {}): Promise { const endpoint = `cosmos/base/tendermint/v1beta1/node_info`; return await this.req.get(endpoint); } /* GetSyncing queries node syncing. */ - - async getSyncing(_params: GetSyncingRequest = {}): Promise { const endpoint = `cosmos/base/tendermint/v1beta1/syncing`; return await this.req.get(endpoint); } /* GetLatestBlock returns the latest block. */ - - async getLatestBlock(_params: GetLatestBlockRequest = {}): Promise { const endpoint = `cosmos/base/tendermint/v1beta1/blocks/latest`; return await this.req.get(endpoint); } /* GetBlockByHeight queries block for given height. */ - - async getBlockByHeight(params: GetBlockByHeightRequest): Promise { const endpoint = `cosmos/base/tendermint/v1beta1/blocks/${params.height}`; return await this.req.get(endpoint); } /* GetLatestValidatorSet queries latest validator-set. */ - - async getLatestValidatorSet(params: GetLatestValidatorSetRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/base/tendermint/v1beta1/validatorsets/latest`; return await this.req.get(endpoint, options); } /* GetValidatorSetByHeight queries validator-set at a given height. */ - - async getValidatorSetByHeight(params: GetValidatorSetByHeightRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/base/tendermint/v1beta1/validatorsets/${params.height}`; return await this.req.get(endpoint, options); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts b/src/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts index ce8c918..a19d825 100644 --- a/src/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts +++ b/src/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts @@ -1,31 +1,24 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { GetNodeInfoRequest, GetNodeInfoResponse, GetSyncingRequest, GetSyncingResponse, GetLatestBlockRequest, GetLatestBlockResponse, GetBlockByHeightRequest, GetBlockByHeightResponse, GetLatestValidatorSetRequest, GetLatestValidatorSetResponse, GetValidatorSetByHeightRequest, GetValidatorSetByHeightResponse } from "./query"; /** Service defines the gRPC querier service for tendermint queries. */ - export interface Service { /** GetNodeInfo queries the current node info. */ getNodeInfo(request?: GetNodeInfoRequest): Promise; /** GetSyncing queries node syncing. */ - getSyncing(request?: GetSyncingRequest): Promise; /** GetLatestBlock returns the latest block. */ - getLatestBlock(request?: GetLatestBlockRequest): Promise; /** GetBlockByHeight queries block for given height. */ - getBlockByHeight(request: GetBlockByHeightRequest): Promise; /** GetLatestValidatorSet queries latest validator-set. */ - getLatestValidatorSet(request?: GetLatestValidatorSetRequest): Promise; /** GetValidatorSetByHeight queries validator-set at a given height. */ - getValidatorSetByHeight(request: GetValidatorSetByHeightRequest): Promise; } export class ServiceClientImpl implements Service { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.getNodeInfo = this.getNodeInfo.bind(this); @@ -35,45 +28,38 @@ export class ServiceClientImpl implements Service { this.getLatestValidatorSet = this.getLatestValidatorSet.bind(this); this.getValidatorSetByHeight = this.getValidatorSetByHeight.bind(this); } - getNodeInfo(request: GetNodeInfoRequest = {}): Promise { const data = GetNodeInfoRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetNodeInfo", data); - return promise.then(data => GetNodeInfoResponse.decode(new _m0.Reader(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("cosmos.base.tendermint.v1beta1.Service", "GetSyncing", data); - return promise.then(data => GetSyncingResponse.decode(new _m0.Reader(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("cosmos.base.tendermint.v1beta1.Service", "GetLatestBlock", data); - return promise.then(data => GetLatestBlockResponse.decode(new _m0.Reader(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("cosmos.base.tendermint.v1beta1.Service", "GetBlockByHeight", data); - return promise.then(data => GetBlockByHeightResponse.decode(new _m0.Reader(data))); + return promise.then(data => GetBlockByHeightResponse.decode(new BinaryReader(data))); } - getLatestValidatorSet(request: GetLatestValidatorSetRequest = { pagination: undefined }): Promise { const data = GetLatestValidatorSetRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetLatestValidatorSet", data); - return promise.then(data => GetLatestValidatorSetResponse.decode(new _m0.Reader(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("cosmos.base.tendermint.v1beta1.Service", "GetValidatorSetByHeight", data); - return promise.then(data => GetValidatorSetByHeightResponse.decode(new _m0.Reader(data))); + return promise.then(data => GetValidatorSetByHeightResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -82,26 +68,20 @@ export const createRpcQueryExtension = (base: QueryClient) => { getNodeInfo(request?: GetNodeInfoRequest): Promise { return queryService.getNodeInfo(request); }, - getSyncing(request?: GetSyncingRequest): Promise { return queryService.getSyncing(request); }, - getLatestBlock(request?: GetLatestBlockRequest): Promise { return queryService.getLatestBlock(request); }, - getBlockByHeight(request: GetBlockByHeightRequest): Promise { return queryService.getBlockByHeight(request); }, - getLatestValidatorSet(request?: GetLatestValidatorSetRequest): Promise { return queryService.getLatestValidatorSet(request); }, - getValidatorSetByHeight(request: GetValidatorSetByHeightRequest): Promise { return queryService.getValidatorSetByHeight(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/tendermint/v1beta1/query.ts b/src/codegen/cosmos/base/tendermint/v1beta1/query.ts index 36021b0..341f430 100644 --- a/src/codegen/cosmos/base/tendermint/v1beta1/query.ts +++ b/src/codegen/cosmos/base/tendermint/v1beta1/query.ts @@ -1,166 +1,293 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; -import { Block, BlockSDKType } from "../../../../tendermint/types/block"; -import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../query/v1beta1/pagination"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../../tendermint/types/types"; +import { Block, BlockAmino, BlockSDKType } from "../../../../tendermint/types/block"; +import { NodeInfo, NodeInfoAmino, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ - export interface GetValidatorSetByHeightRequest { - height: Long; + height: bigint; /** pagination defines an pagination for the request. */ - pagination?: PageRequest; } +export interface GetValidatorSetByHeightRequestProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest"; + value: Uint8Array; +} /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ - -export interface GetValidatorSetByHeightRequestSDKType { - height: Long; +export interface GetValidatorSetByHeightRequestAmino { + height?: string; /** pagination defines an pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface GetValidatorSetByHeightRequestAminoMsg { + type: "cosmos-sdk/GetValidatorSetByHeightRequest"; + value: GetValidatorSetByHeightRequestAmino; +} +/** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightRequestSDKType { + height: bigint; pagination?: PageRequestSDKType; } /** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ - export interface GetValidatorSetByHeightResponse { - blockHeight: Long; + blockHeight: bigint; validators: Validator[]; /** pagination defines an pagination for the response. */ - pagination?: PageResponse; } +export interface GetValidatorSetByHeightResponseProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse"; + value: Uint8Array; +} +/** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightResponseAmino { + block_height?: string; + validators?: ValidatorAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface GetValidatorSetByHeightResponseAminoMsg { + type: "cosmos-sdk/GetValidatorSetByHeightResponse"; + value: GetValidatorSetByHeightResponseAmino; +} /** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ - export interface GetValidatorSetByHeightResponseSDKType { - block_height: Long; + block_height: bigint; validators: ValidatorSDKType[]; - /** pagination defines an pagination for the response. */ - pagination?: PageResponseSDKType; } /** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ - export interface GetLatestValidatorSetRequest { /** pagination defines an pagination for the request. */ pagination?: PageRequest; } +export interface GetLatestValidatorSetRequestProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest"; + value: Uint8Array; +} /** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ - -export interface GetLatestValidatorSetRequestSDKType { +export interface GetLatestValidatorSetRequestAmino { /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface GetLatestValidatorSetRequestAminoMsg { + type: "cosmos-sdk/GetLatestValidatorSetRequest"; + value: GetLatestValidatorSetRequestAmino; +} +/** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetRequestSDKType { pagination?: PageRequestSDKType; } /** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ - export interface GetLatestValidatorSetResponse { - blockHeight: Long; + blockHeight: bigint; validators: Validator[]; /** pagination defines an pagination for the response. */ - pagination?: PageResponse; } +export interface GetLatestValidatorSetResponseProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse"; + value: Uint8Array; +} +/** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetResponseAmino { + block_height?: string; + validators?: ValidatorAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface GetLatestValidatorSetResponseAminoMsg { + type: "cosmos-sdk/GetLatestValidatorSetResponse"; + value: GetLatestValidatorSetResponseAmino; +} /** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ - export interface GetLatestValidatorSetResponseSDKType { - block_height: Long; + block_height: bigint; validators: ValidatorSDKType[]; - /** pagination defines an pagination for the response. */ - pagination?: PageResponseSDKType; } /** Validator is the type for the validator-set. */ - export interface Validator { address: string; pubKey?: Any; - votingPower: Long; - proposerPriority: Long; + votingPower: bigint; + proposerPriority: bigint; +} +export interface ValidatorProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.Validator"; + value: Uint8Array; +} +/** Validator is the type for the validator-set. */ +export interface ValidatorAmino { + address?: string; + pub_key?: AnyAmino; + voting_power?: string; + proposer_priority?: string; +} +export interface ValidatorAminoMsg { + type: "cosmos-sdk/Validator"; + value: ValidatorAmino; } /** Validator is the type for the validator-set. */ - export interface ValidatorSDKType { address: string; pub_key?: AnySDKType; - voting_power: Long; - proposer_priority: Long; + voting_power: bigint; + proposer_priority: bigint; } /** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ - export interface GetBlockByHeightRequest { - height: Long; + height: bigint; +} +export interface GetBlockByHeightRequestProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest"; + value: Uint8Array; +} +/** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightRequestAmino { + height?: string; +} +export interface GetBlockByHeightRequestAminoMsg { + type: "cosmos-sdk/GetBlockByHeightRequest"; + value: GetBlockByHeightRequestAmino; } /** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ - export interface GetBlockByHeightRequestSDKType { - height: Long; + height: bigint; } /** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ - export interface GetBlockByHeightResponse { blockId?: BlockID; block?: Block; } +export interface GetBlockByHeightResponseProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse"; + value: Uint8Array; +} +/** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightResponseAmino { + block_id?: BlockIDAmino; + block?: BlockAmino; +} +export interface GetBlockByHeightResponseAminoMsg { + type: "cosmos-sdk/GetBlockByHeightResponse"; + value: GetBlockByHeightResponseAmino; +} /** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ - export interface GetBlockByHeightResponseSDKType { block_id?: BlockIDSDKType; block?: BlockSDKType; } /** GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method. */ - export interface GetLatestBlockRequest {} +export interface GetLatestBlockRequestProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest"; + value: Uint8Array; +} +/** GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method. */ +export interface GetLatestBlockRequestAmino {} +export interface GetLatestBlockRequestAminoMsg { + type: "cosmos-sdk/GetLatestBlockRequest"; + value: GetLatestBlockRequestAmino; +} /** GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method. */ - export interface GetLatestBlockRequestSDKType {} /** GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. */ - export interface GetLatestBlockResponse { blockId?: BlockID; block?: Block; } +export interface GetLatestBlockResponseProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse"; + value: Uint8Array; +} +/** GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. */ +export interface GetLatestBlockResponseAmino { + block_id?: BlockIDAmino; + block?: BlockAmino; +} +export interface GetLatestBlockResponseAminoMsg { + type: "cosmos-sdk/GetLatestBlockResponse"; + value: GetLatestBlockResponseAmino; +} /** GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. */ - export interface GetLatestBlockResponseSDKType { block_id?: BlockIDSDKType; block?: BlockSDKType; } /** GetSyncingRequest is the request type for the Query/GetSyncing RPC method. */ - export interface GetSyncingRequest {} +export interface GetSyncingRequestProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest"; + value: Uint8Array; +} +/** GetSyncingRequest is the request type for the Query/GetSyncing RPC method. */ +export interface GetSyncingRequestAmino {} +export interface GetSyncingRequestAminoMsg { + type: "cosmos-sdk/GetSyncingRequest"; + value: GetSyncingRequestAmino; +} /** GetSyncingRequest is the request type for the Query/GetSyncing RPC method. */ - export interface GetSyncingRequestSDKType {} /** GetSyncingResponse is the response type for the Query/GetSyncing RPC method. */ - export interface GetSyncingResponse { syncing: boolean; } +export interface GetSyncingResponseProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse"; + value: Uint8Array; +} +/** GetSyncingResponse is the response type for the Query/GetSyncing RPC method. */ +export interface GetSyncingResponseAmino { + syncing?: boolean; +} +export interface GetSyncingResponseAminoMsg { + type: "cosmos-sdk/GetSyncingResponse"; + value: GetSyncingResponseAmino; +} /** GetSyncingResponse is the response type for the Query/GetSyncing RPC method. */ - export interface GetSyncingResponseSDKType { syncing: boolean; } /** GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method. */ - export interface GetNodeInfoRequest {} +export interface GetNodeInfoRequestProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest"; + value: Uint8Array; +} +/** GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method. */ +export interface GetNodeInfoRequestAmino {} +export interface GetNodeInfoRequestAminoMsg { + type: "cosmos-sdk/GetNodeInfoRequest"; + value: GetNodeInfoRequestAmino; +} /** GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method. */ - export interface GetNodeInfoRequestSDKType {} /** GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC method. */ - export interface GetNodeInfoResponse { nodeInfo?: NodeInfo; applicationVersion?: VersionInfo; } +export interface GetNodeInfoResponseProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse"; + value: Uint8Array; +} +/** GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC method. */ +export interface GetNodeInfoResponseAmino { + node_info?: NodeInfoAmino; + application_version?: VersionInfoAmino; +} +export interface GetNodeInfoResponseAminoMsg { + type: "cosmos-sdk/GetNodeInfoResponse"; + value: GetNodeInfoResponseAmino; +} /** GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC method. */ - export interface GetNodeInfoResponseSDKType { node_info?: NodeInfoSDKType; application_version?: VersionInfoSDKType; } /** VersionInfo is the type for the GetNodeInfoResponse message. */ - export interface VersionInfo { name: string; appName: string; @@ -170,11 +297,29 @@ export interface VersionInfo { goVersion: string; buildDeps: Module[]; /** Since: cosmos-sdk 0.43 */ - cosmosSdkVersion: string; } +export interface VersionInfoProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo"; + value: Uint8Array; +} +/** VersionInfo is the type for the GetNodeInfoResponse message. */ +export interface VersionInfoAmino { + name?: string; + app_name?: string; + version?: string; + git_commit?: string; + build_tags?: string; + go_version?: string; + build_deps?: ModuleAmino[]; + /** Since: cosmos-sdk 0.43 */ + cosmos_sdk_version?: string; +} +export interface VersionInfoAminoMsg { + type: "cosmos-sdk/VersionInfo"; + value: VersionInfoAmino; +} /** VersionInfo is the type for the GetNodeInfoResponse message. */ - export interface VersionInfoSDKType { name: string; app_name: string; @@ -183,697 +328,1034 @@ export interface VersionInfoSDKType { build_tags: string; go_version: string; build_deps: ModuleSDKType[]; - /** Since: cosmos-sdk 0.43 */ - cosmos_sdk_version: string; } /** Module is the type for VersionInfo */ - export interface Module { /** module path */ path: string; /** module version */ - version: string; /** checksum */ - sum: string; } +export interface ModuleProtoMsg { + typeUrl: "/cosmos.base.tendermint.v1beta1.Module"; + value: Uint8Array; +} /** Module is the type for VersionInfo */ - -export interface ModuleSDKType { +export interface ModuleAmino { /** module path */ - path: string; + path?: string; /** module version */ - - version: string; + version?: string; /** checksum */ - + sum?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the type for VersionInfo */ +export interface ModuleSDKType { + path: string; + version: string; sum: string; } - function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { return { - height: Long.ZERO, + height: BigInt(0), pagination: undefined }; } - export const GetValidatorSetByHeightRequest = { - encode(message: GetValidatorSetByHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", + encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetValidatorSetByHeightRequest { + fromPartial(object: Partial): GetValidatorSetByHeightRequest { const message = createBaseGetValidatorSetByHeightRequest(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: GetValidatorSetByHeightRequestAmino): GetValidatorSetByHeightRequest { + const message = createBaseGetValidatorSetByHeightRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetValidatorSetByHeightRequestAminoMsg): GetValidatorSetByHeightRequest { + return GetValidatorSetByHeightRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAminoMsg { + return { + type: "cosmos-sdk/GetValidatorSetByHeightRequest", + value: GetValidatorSetByHeightRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetValidatorSetByHeightRequestProtoMsg): GetValidatorSetByHeightRequest { + return GetValidatorSetByHeightRequest.decode(message.value); + }, + toProto(message: GetValidatorSetByHeightRequest): Uint8Array { + return GetValidatorSetByHeightRequest.encode(message).finish(); + }, + toProtoMsg(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", + value: GetValidatorSetByHeightRequest.encode(message).finish() + }; } - }; - function createBaseGetValidatorSetByHeightResponse(): GetValidatorSetByHeightResponse { return { - blockHeight: Long.ZERO, + blockHeight: BigInt(0), validators: [], pagination: undefined }; } - export const GetValidatorSetByHeightResponse = { - encode(message: GetValidatorSetByHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.blockHeight.isZero()) { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", + encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockHeight !== BigInt(0)) { writer.uint32(8).int64(message.blockHeight); } - for (const v of message.validators) { Validator.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.blockHeight = (reader.int64() as Long); + message.blockHeight = reader.int64(); break; - case 2: message.validators.push(Validator.decode(reader, reader.uint32())); break; - case 3: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetValidatorSetByHeightResponse { + fromPartial(object: Partial): GetValidatorSetByHeightResponse { const message = createBaseGetValidatorSetByHeightResponse(); - message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? Long.fromValue(object.blockHeight) : Long.ZERO; + message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? BigInt(object.blockHeight.toString()) : BigInt(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; + }, + fromAmino(object: GetValidatorSetByHeightResponseAmino): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + if (object.block_height !== undefined && object.block_height !== null) { + message.blockHeight = BigInt(object.block_height); + } + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { + const obj: any = {}; + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetValidatorSetByHeightResponseAminoMsg): GetValidatorSetByHeightResponse { + return GetValidatorSetByHeightResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAminoMsg { + return { + type: "cosmos-sdk/GetValidatorSetByHeightResponse", + value: GetValidatorSetByHeightResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetValidatorSetByHeightResponseProtoMsg): GetValidatorSetByHeightResponse { + return GetValidatorSetByHeightResponse.decode(message.value); + }, + toProto(message: GetValidatorSetByHeightResponse): Uint8Array { + return GetValidatorSetByHeightResponse.encode(message).finish(); + }, + toProtoMsg(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", + value: GetValidatorSetByHeightResponse.encode(message).finish() + }; } - }; - function createBaseGetLatestValidatorSetRequest(): GetLatestValidatorSetRequest { return { pagination: undefined }; } - export const GetLatestValidatorSetRequest = { - encode(message: GetLatestValidatorSetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", + encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestValidatorSetRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetLatestValidatorSetRequest { + fromPartial(object: Partial): GetLatestValidatorSetRequest { const message = createBaseGetLatestValidatorSetRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: GetLatestValidatorSetRequestAmino): GetLatestValidatorSetRequest { + const message = createBaseGetLatestValidatorSetRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetLatestValidatorSetRequest): GetLatestValidatorSetRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetLatestValidatorSetRequestAminoMsg): GetLatestValidatorSetRequest { + return GetLatestValidatorSetRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetLatestValidatorSetRequest): GetLatestValidatorSetRequestAminoMsg { + return { + type: "cosmos-sdk/GetLatestValidatorSetRequest", + value: GetLatestValidatorSetRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetLatestValidatorSetRequestProtoMsg): GetLatestValidatorSetRequest { + return GetLatestValidatorSetRequest.decode(message.value); + }, + toProto(message: GetLatestValidatorSetRequest): Uint8Array { + return GetLatestValidatorSetRequest.encode(message).finish(); + }, + toProtoMsg(message: GetLatestValidatorSetRequest): GetLatestValidatorSetRequestProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", + value: GetLatestValidatorSetRequest.encode(message).finish() + }; } - }; - function createBaseGetLatestValidatorSetResponse(): GetLatestValidatorSetResponse { return { - blockHeight: Long.ZERO, + blockHeight: BigInt(0), validators: [], pagination: undefined }; } - export const GetLatestValidatorSetResponse = { - encode(message: GetLatestValidatorSetResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.blockHeight.isZero()) { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", + encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockHeight !== BigInt(0)) { writer.uint32(8).int64(message.blockHeight); } - for (const v of message.validators) { Validator.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestValidatorSetResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.blockHeight = (reader.int64() as Long); + message.blockHeight = reader.int64(); break; - case 2: message.validators.push(Validator.decode(reader, reader.uint32())); break; - case 3: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetLatestValidatorSetResponse { + fromPartial(object: Partial): GetLatestValidatorSetResponse { const message = createBaseGetLatestValidatorSetResponse(); - message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? Long.fromValue(object.blockHeight) : Long.ZERO; + message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? BigInt(object.blockHeight.toString()) : BigInt(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; + }, + fromAmino(object: GetLatestValidatorSetResponseAmino): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + if (object.block_height !== undefined && object.block_height !== null) { + message.blockHeight = BigInt(object.block_height); + } + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { + const obj: any = {}; + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetLatestValidatorSetResponseAminoMsg): GetLatestValidatorSetResponse { + return GetLatestValidatorSetResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAminoMsg { + return { + type: "cosmos-sdk/GetLatestValidatorSetResponse", + value: GetLatestValidatorSetResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetLatestValidatorSetResponseProtoMsg): GetLatestValidatorSetResponse { + return GetLatestValidatorSetResponse.decode(message.value); + }, + toProto(message: GetLatestValidatorSetResponse): Uint8Array { + return GetLatestValidatorSetResponse.encode(message).finish(); + }, + toProtoMsg(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", + value: GetLatestValidatorSetResponse.encode(message).finish() + }; } - }; - function createBaseValidator(): Validator { return { address: "", pubKey: undefined, - votingPower: Long.ZERO, - proposerPriority: Long.ZERO + votingPower: BigInt(0), + proposerPriority: BigInt(0) }; } - export const Validator = { - encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.Validator", + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.pubKey !== undefined) { Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); } - - if (!message.votingPower.isZero()) { + if (message.votingPower !== BigInt(0)) { writer.uint32(24).int64(message.votingPower); } - - if (!message.proposerPriority.isZero()) { + if (message.proposerPriority !== BigInt(0)) { writer.uint32(32).int64(message.proposerPriority); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Validator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidator(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.pubKey = Any.decode(reader, reader.uint32()); break; - case 3: - message.votingPower = (reader.int64() as Long); + message.votingPower = reader.int64(); break; - case 4: - message.proposerPriority = (reader.int64() as Long); + message.proposerPriority = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Validator { + fromPartial(object: Partial): 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 !== undefined && object.votingPower !== null ? Long.fromValue(object.votingPower) : Long.ZERO; - message.proposerPriority = object.proposerPriority !== undefined && object.proposerPriority !== null ? Long.fromValue(object.proposerPriority) : Long.ZERO; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); + message.proposerPriority = object.proposerPriority !== undefined && object.proposerPriority !== null ? BigInt(object.proposerPriority.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = Any.fromAmino(object.pub_key); + } + if (object.voting_power !== undefined && object.voting_power !== null) { + message.votingPower = BigInt(object.voting_power); + } + if (object.proposer_priority !== undefined && object.proposer_priority !== null) { + message.proposerPriority = BigInt(object.proposer_priority); + } return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address; + obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + toAminoMsg(message: Validator): ValidatorAminoMsg { + return { + type: "cosmos-sdk/Validator", + value: Validator.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.Validator", + value: Validator.encode(message).finish() + }; } - }; - function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { return { - height: Long.ZERO + height: BigInt(0) }; } - export const GetBlockByHeightRequest = { - encode(message: GetBlockByHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", + encode(message: GetBlockByHeightRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockByHeightRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetBlockByHeightRequest { + fromPartial(object: Partial): GetBlockByHeightRequest { const message = createBaseGetBlockByHeightRequest(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GetBlockByHeightRequestAmino): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } return message; + }, + toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { + return GetBlockByHeightRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetBlockByHeightRequest): GetBlockByHeightRequestAminoMsg { + return { + type: "cosmos-sdk/GetBlockByHeightRequest", + value: GetBlockByHeightRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetBlockByHeightRequestProtoMsg): GetBlockByHeightRequest { + return GetBlockByHeightRequest.decode(message.value); + }, + toProto(message: GetBlockByHeightRequest): Uint8Array { + return GetBlockByHeightRequest.encode(message).finish(); + }, + toProtoMsg(message: GetBlockByHeightRequest): GetBlockByHeightRequestProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", + value: GetBlockByHeightRequest.encode(message).finish() + }; } - }; - function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { return { blockId: undefined, block: undefined }; } - export const GetBlockByHeightResponse = { - encode(message: GetBlockByHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", + encode(message: GetBlockByHeightResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); } - if (message.block !== undefined) { Block.encode(message.block, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockByHeightResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.blockId = BlockID.decode(reader, reader.uint32()); break; - case 2: message.block = Block.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetBlockByHeightResponse { + fromPartial(object: Partial): 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; return message; + }, + fromAmino(object: GetBlockByHeightResponseAmino): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.block !== undefined && object.block !== null) { + message.block = Block.fromAmino(object.block); + } + return message; + }, + toAmino(message: GetBlockByHeightResponse): GetBlockByHeightResponseAmino { + const obj: any = {}; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.block = message.block ? Block.toAmino(message.block) : undefined; + return obj; + }, + fromAminoMsg(object: GetBlockByHeightResponseAminoMsg): GetBlockByHeightResponse { + return GetBlockByHeightResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetBlockByHeightResponse): GetBlockByHeightResponseAminoMsg { + return { + type: "cosmos-sdk/GetBlockByHeightResponse", + value: GetBlockByHeightResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetBlockByHeightResponseProtoMsg): GetBlockByHeightResponse { + return GetBlockByHeightResponse.decode(message.value); + }, + toProto(message: GetBlockByHeightResponse): Uint8Array { + return GetBlockByHeightResponse.encode(message).finish(); + }, + toProtoMsg(message: GetBlockByHeightResponse): GetBlockByHeightResponseProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", + value: GetBlockByHeightResponse.encode(message).finish() + }; } - }; - function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { return {}; } - export const GetLatestBlockRequest = { - encode(_: GetLatestBlockRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", + encode(_: GetLatestBlockRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestBlockRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetLatestBlockRequest { + fromPartial(_: Partial): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, + fromAmino(_: GetLatestBlockRequestAmino): GetLatestBlockRequest { const message = createBaseGetLatestBlockRequest(); return message; + }, + toAmino(_: GetLatestBlockRequest): GetLatestBlockRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetLatestBlockRequestAminoMsg): GetLatestBlockRequest { + return GetLatestBlockRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetLatestBlockRequest): GetLatestBlockRequestAminoMsg { + return { + type: "cosmos-sdk/GetLatestBlockRequest", + value: GetLatestBlockRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetLatestBlockRequestProtoMsg): GetLatestBlockRequest { + return GetLatestBlockRequest.decode(message.value); + }, + toProto(message: GetLatestBlockRequest): Uint8Array { + return GetLatestBlockRequest.encode(message).finish(); + }, + toProtoMsg(message: GetLatestBlockRequest): GetLatestBlockRequestProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", + value: GetLatestBlockRequest.encode(message).finish() + }; } - }; - function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { return { blockId: undefined, block: undefined }; } - export const GetLatestBlockResponse = { - encode(message: GetLatestBlockResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", + encode(message: GetLatestBlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); } - if (message.block !== undefined) { Block.encode(message.block, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestBlockResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.blockId = BlockID.decode(reader, reader.uint32()); break; - case 2: message.block = Block.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetLatestBlockResponse { + fromPartial(object: Partial): 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; return message; + }, + fromAmino(object: GetLatestBlockResponseAmino): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.block !== undefined && object.block !== null) { + message.block = Block.fromAmino(object.block); + } + return message; + }, + toAmino(message: GetLatestBlockResponse): GetLatestBlockResponseAmino { + const obj: any = {}; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.block = message.block ? Block.toAmino(message.block) : undefined; + return obj; + }, + fromAminoMsg(object: GetLatestBlockResponseAminoMsg): GetLatestBlockResponse { + return GetLatestBlockResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetLatestBlockResponse): GetLatestBlockResponseAminoMsg { + return { + type: "cosmos-sdk/GetLatestBlockResponse", + value: GetLatestBlockResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetLatestBlockResponseProtoMsg): GetLatestBlockResponse { + return GetLatestBlockResponse.decode(message.value); + }, + toProto(message: GetLatestBlockResponse): Uint8Array { + return GetLatestBlockResponse.encode(message).finish(); + }, + toProtoMsg(message: GetLatestBlockResponse): GetLatestBlockResponseProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", + value: GetLatestBlockResponse.encode(message).finish() + }; } - }; - function createBaseGetSyncingRequest(): GetSyncingRequest { return {}; } - export const GetSyncingRequest = { - encode(_: GetSyncingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest", + encode(_: GetSyncingRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetSyncingRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetSyncingRequest { + fromPartial(_: Partial): GetSyncingRequest { const message = createBaseGetSyncingRequest(); return message; + }, + fromAmino(_: GetSyncingRequestAmino): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, + toAmino(_: GetSyncingRequest): GetSyncingRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetSyncingRequestAminoMsg): GetSyncingRequest { + return GetSyncingRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetSyncingRequest): GetSyncingRequestAminoMsg { + return { + type: "cosmos-sdk/GetSyncingRequest", + value: GetSyncingRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetSyncingRequestProtoMsg): GetSyncingRequest { + return GetSyncingRequest.decode(message.value); + }, + toProto(message: GetSyncingRequest): Uint8Array { + return GetSyncingRequest.encode(message).finish(); + }, + toProtoMsg(message: GetSyncingRequest): GetSyncingRequestProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest", + value: GetSyncingRequest.encode(message).finish() + }; } - }; - function createBaseGetSyncingResponse(): GetSyncingResponse { return { syncing: false }; } - export const GetSyncingResponse = { - encode(message: GetSyncingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse", + encode(message: GetSyncingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.syncing === true) { writer.uint32(8).bool(message.syncing); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetSyncingResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.syncing = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetSyncingResponse { + fromPartial(object: Partial): GetSyncingResponse { const message = createBaseGetSyncingResponse(); message.syncing = object.syncing ?? false; return message; + }, + fromAmino(object: GetSyncingResponseAmino): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + if (object.syncing !== undefined && object.syncing !== null) { + message.syncing = object.syncing; + } + return message; + }, + toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { + const obj: any = {}; + obj.syncing = message.syncing; + return obj; + }, + fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { + return GetSyncingResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetSyncingResponse): GetSyncingResponseAminoMsg { + return { + type: "cosmos-sdk/GetSyncingResponse", + value: GetSyncingResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetSyncingResponseProtoMsg): GetSyncingResponse { + return GetSyncingResponse.decode(message.value); + }, + toProto(message: GetSyncingResponse): Uint8Array { + return GetSyncingResponse.encode(message).finish(); + }, + toProtoMsg(message: GetSyncingResponse): GetSyncingResponseProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse", + value: GetSyncingResponse.encode(message).finish() + }; } - }; - function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { return {}; } - export const GetNodeInfoRequest = { - encode(_: GetNodeInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", + encode(_: GetNodeInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetNodeInfoRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): GetNodeInfoRequest { + fromPartial(_: Partial): GetNodeInfoRequest { const message = createBaseGetNodeInfoRequest(); return message; + }, + fromAmino(_: GetNodeInfoRequestAmino): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, + toAmino(_: GetNodeInfoRequest): GetNodeInfoRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetNodeInfoRequestAminoMsg): GetNodeInfoRequest { + return GetNodeInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetNodeInfoRequest): GetNodeInfoRequestAminoMsg { + return { + type: "cosmos-sdk/GetNodeInfoRequest", + value: GetNodeInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetNodeInfoRequestProtoMsg): GetNodeInfoRequest { + return GetNodeInfoRequest.decode(message.value); + }, + toProto(message: GetNodeInfoRequest): Uint8Array { + return GetNodeInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: GetNodeInfoRequest): GetNodeInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", + value: GetNodeInfoRequest.encode(message).finish() + }; } - }; - function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { return { nodeInfo: undefined, applicationVersion: undefined }; } - export const GetNodeInfoResponse = { - encode(message: GetNodeInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", + encode(message: GetNodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nodeInfo !== undefined) { NodeInfo.encode(message.nodeInfo, writer.uint32(10).fork()).ldelim(); } - if (message.applicationVersion !== undefined) { VersionInfo.encode(message.applicationVersion, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetNodeInfoResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.nodeInfo = NodeInfo.decode(reader, reader.uint32()); break; - case 2: message.applicationVersion = VersionInfo.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetNodeInfoResponse { + fromPartial(object: Partial): GetNodeInfoResponse { const message = createBaseGetNodeInfoResponse(); message.nodeInfo = object.nodeInfo !== undefined && object.nodeInfo !== null ? NodeInfo.fromPartial(object.nodeInfo) : undefined; message.applicationVersion = object.applicationVersion !== undefined && object.applicationVersion !== null ? VersionInfo.fromPartial(object.applicationVersion) : undefined; return message; + }, + fromAmino(object: GetNodeInfoResponseAmino): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + if (object.node_info !== undefined && object.node_info !== null) { + message.nodeInfo = NodeInfo.fromAmino(object.node_info); + } + if (object.application_version !== undefined && object.application_version !== null) { + message.applicationVersion = VersionInfo.fromAmino(object.application_version); + } + return message; + }, + toAmino(message: GetNodeInfoResponse): GetNodeInfoResponseAmino { + const obj: any = {}; + obj.node_info = message.nodeInfo ? NodeInfo.toAmino(message.nodeInfo) : undefined; + obj.application_version = message.applicationVersion ? VersionInfo.toAmino(message.applicationVersion) : undefined; + return obj; + }, + fromAminoMsg(object: GetNodeInfoResponseAminoMsg): GetNodeInfoResponse { + return GetNodeInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetNodeInfoResponse): GetNodeInfoResponseAminoMsg { + return { + type: "cosmos-sdk/GetNodeInfoResponse", + value: GetNodeInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetNodeInfoResponseProtoMsg): GetNodeInfoResponse { + return GetNodeInfoResponse.decode(message.value); + }, + toProto(message: GetNodeInfoResponse): Uint8Array { + return GetNodeInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: GetNodeInfoResponse): GetNodeInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", + value: GetNodeInfoResponse.encode(message).finish() + }; } - }; - function createBaseVersionInfo(): VersionInfo { return { name: "", @@ -886,95 +1368,74 @@ function createBaseVersionInfo(): VersionInfo { cosmosSdkVersion: "" }; } - export const VersionInfo = { - encode(message: VersionInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo", + encode(message: VersionInfo, writer: BinaryWriter = BinaryWriter.create()): 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()).ldelim(); } - if (message.cosmosSdkVersion !== "") { writer.uint32(66).string(message.cosmosSdkVersion); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VersionInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - case 2: message.appName = reader.string(); break; - case 3: message.version = reader.string(); break; - case 4: message.gitCommit = reader.string(); break; - case 5: message.buildTags = reader.string(); break; - case 6: message.goVersion = reader.string(); break; - case 7: message.buildDeps.push(Module.decode(reader, reader.uint32())); break; - case 8: message.cosmosSdkVersion = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): VersionInfo { + fromPartial(object: Partial): VersionInfo { const message = createBaseVersionInfo(); message.name = object.name ?? ""; message.appName = object.appName ?? ""; @@ -985,10 +1446,71 @@ export const VersionInfo = { message.buildDeps = object.buildDeps?.map(e => Module.fromPartial(e)) || []; message.cosmosSdkVersion = object.cosmosSdkVersion ?? ""; return message; + }, + fromAmino(object: VersionInfoAmino): VersionInfo { + const message = createBaseVersionInfo(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.app_name !== undefined && object.app_name !== null) { + message.appName = object.app_name; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.git_commit !== undefined && object.git_commit !== null) { + message.gitCommit = object.git_commit; + } + if (object.build_tags !== undefined && object.build_tags !== null) { + message.buildTags = object.build_tags; + } + if (object.go_version !== undefined && object.go_version !== null) { + message.goVersion = object.go_version; + } + message.buildDeps = object.build_deps?.map(e => Module.fromAmino(e)) || []; + if (object.cosmos_sdk_version !== undefined && object.cosmos_sdk_version !== null) { + message.cosmosSdkVersion = object.cosmos_sdk_version; + } + return message; + }, + toAmino(message: VersionInfo): VersionInfoAmino { + const obj: any = {}; + obj.name = message.name; + obj.app_name = message.appName; + obj.version = message.version; + obj.git_commit = message.gitCommit; + obj.build_tags = message.buildTags; + obj.go_version = message.goVersion; + if (message.buildDeps) { + obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); + } else { + obj.build_deps = []; + } + obj.cosmos_sdk_version = message.cosmosSdkVersion; + return obj; + }, + fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { + return VersionInfo.fromAmino(object.value); + }, + toAminoMsg(message: VersionInfo): VersionInfoAminoMsg { + return { + type: "cosmos-sdk/VersionInfo", + value: VersionInfo.toAmino(message) + }; + }, + fromProtoMsg(message: VersionInfoProtoMsg): VersionInfo { + return VersionInfo.decode(message.value); + }, + toProto(message: VersionInfo): Uint8Array { + return VersionInfo.encode(message).finish(); + }, + toProtoMsg(message: VersionInfo): VersionInfoProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo", + value: VersionInfo.encode(message).finish() + }; } - }; - function createBaseModule(): Module { return { path: "", @@ -996,60 +1518,89 @@ function createBaseModule(): Module { sum: "" }; } - export const Module = { - encode(message: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.tendermint.v1beta1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): Module { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.string(); break; - case 2: message.version = reader.string(); break; - case 3: message.sum = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Module { + fromPartial(object: Partial): Module { const message = createBaseModule(); message.path = object.path ?? ""; message.version = object.version ?? ""; message.sum = object.sum ?? ""; return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.sum !== undefined && object.sum !== null) { + message.sum = object.sum; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.path = message.path; + obj.version = message.version; + obj.sum = message.sum; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.base.tendermint.v1beta1.Module", + value: Module.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/base/v1beta1/coin.ts b/src/codegen/cosmos/base/v1beta1/coin.ts index 53aa3bc..dd86ae1 100644 --- a/src/codegen/cosmos/base/v1beta1/coin.ts +++ b/src/codegen/cosmos/base/v1beta1/coin.ts @@ -1,23 +1,38 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * Coin defines a token with a denomination and an amount. * * NOTE: The amount field is an Int which implements the custom method * signatures required by gogoproto. */ - export interface Coin { denom: string; amount: string; } +export interface CoinProtoMsg { + typeUrl: "/cosmos.base.v1beta1.Coin"; + value: Uint8Array; +} +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface CoinAmino { + denom?: string; + amount?: string; +} +export interface CoinAminoMsg { + type: "cosmos-sdk/Coin"; + value: CoinAmino; +} /** * 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 CoinSDKType { denom: string; amount: string; @@ -28,239 +43,375 @@ export interface CoinSDKType { * NOTE: The amount field is an Dec which implements the custom method * signatures required by gogoproto. */ - export interface DecCoin { denom: string; amount: string; } +export interface DecCoinProtoMsg { + typeUrl: "/cosmos.base.v1beta1.DecCoin"; + value: Uint8Array; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoinAmino { + denom?: string; + amount?: string; +} +export interface DecCoinAminoMsg { + type: "cosmos-sdk/DecCoin"; + value: DecCoinAmino; +} /** * 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 DecCoinSDKType { denom: string; amount: string; } /** IntProto defines a Protobuf wrapper around an Int object. */ - export interface IntProto { int: string; } +export interface IntProtoProtoMsg { + typeUrl: "/cosmos.base.v1beta1.IntProto"; + value: Uint8Array; +} +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProtoAmino { + int?: string; +} +export interface IntProtoAminoMsg { + type: "cosmos-sdk/IntProto"; + value: IntProtoAmino; +} /** IntProto defines a Protobuf wrapper around an Int object. */ - export interface IntProtoSDKType { int: string; } /** DecProto defines a Protobuf wrapper around a Dec object. */ - export interface DecProto { dec: string; } +export interface DecProtoProtoMsg { + typeUrl: "/cosmos.base.v1beta1.DecProto"; + value: Uint8Array; +} +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProtoAmino { + dec?: string; +} +export interface DecProtoAminoMsg { + type: "cosmos-sdk/DecProto"; + value: DecProtoAmino; +} /** DecProto defines a Protobuf wrapper around a Dec object. */ - export interface DecProtoSDKType { dec: string; } - function createBaseCoin(): Coin { return { denom: "", amount: "" }; } - export const Coin = { - encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.v1beta1.Coin", + encode(message: Coin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.amount !== "") { writer.uint32(18).string(message.amount); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: message.amount = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Coin { + fromPartial(object: Partial): Coin { const message = createBaseCoin(); message.denom = object.denom ?? ""; message.amount = object.amount ?? ""; return message; + }, + fromAmino(object: CoinAmino): Coin { + const message = createBaseCoin(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + return message; + }, + toAmino(message: Coin): CoinAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.amount = message.amount; + return obj; + }, + fromAminoMsg(object: CoinAminoMsg): Coin { + return Coin.fromAmino(object.value); + }, + toAminoMsg(message: Coin): CoinAminoMsg { + return { + type: "cosmos-sdk/Coin", + value: Coin.toAmino(message) + }; + }, + fromProtoMsg(message: CoinProtoMsg): Coin { + return Coin.decode(message.value); + }, + toProto(message: Coin): Uint8Array { + return Coin.encode(message).finish(); + }, + toProtoMsg(message: Coin): CoinProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.Coin", + value: Coin.encode(message).finish() + }; } - }; - function createBaseDecCoin(): DecCoin { return { denom: "", amount: "" }; } - export const DecCoin = { - encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.v1beta1.DecCoin", + encode(message: DecCoin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.amount !== "") { writer.uint32(18).string(message.amount); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: message.amount = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DecCoin { + fromPartial(object: Partial): DecCoin { const message = createBaseDecCoin(); message.denom = object.denom ?? ""; message.amount = object.amount ?? ""; return message; + }, + fromAmino(object: DecCoinAmino): DecCoin { + const message = createBaseDecCoin(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + return message; + }, + toAmino(message: DecCoin): DecCoinAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.amount = message.amount; + return obj; + }, + fromAminoMsg(object: DecCoinAminoMsg): DecCoin { + return DecCoin.fromAmino(object.value); + }, + toAminoMsg(message: DecCoin): DecCoinAminoMsg { + return { + type: "cosmos-sdk/DecCoin", + value: DecCoin.toAmino(message) + }; + }, + fromProtoMsg(message: DecCoinProtoMsg): DecCoin { + return DecCoin.decode(message.value); + }, + toProto(message: DecCoin): Uint8Array { + return DecCoin.encode(message).finish(); + }, + toProtoMsg(message: DecCoin): DecCoinProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.DecCoin", + value: DecCoin.encode(message).finish() + }; } - }; - function createBaseIntProto(): IntProto { return { int: "" }; } - export const IntProto = { - encode(message: IntProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.v1beta1.IntProto", + encode(message: IntProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.int !== "") { writer.uint32(10).string(message.int); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseIntProto(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.int = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): IntProto { + fromPartial(object: Partial): IntProto { const message = createBaseIntProto(); message.int = object.int ?? ""; return message; + }, + fromAmino(object: IntProtoAmino): IntProto { + const message = createBaseIntProto(); + if (object.int !== undefined && object.int !== null) { + message.int = object.int; + } + return message; + }, + toAmino(message: IntProto): IntProtoAmino { + const obj: any = {}; + obj.int = message.int; + return obj; + }, + fromAminoMsg(object: IntProtoAminoMsg): IntProto { + return IntProto.fromAmino(object.value); + }, + toAminoMsg(message: IntProto): IntProtoAminoMsg { + return { + type: "cosmos-sdk/IntProto", + value: IntProto.toAmino(message) + }; + }, + fromProtoMsg(message: IntProtoProtoMsg): IntProto { + return IntProto.decode(message.value); + }, + toProto(message: IntProto): Uint8Array { + return IntProto.encode(message).finish(); + }, + toProtoMsg(message: IntProto): IntProtoProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.IntProto", + value: IntProto.encode(message).finish() + }; } - }; - function createBaseDecProto(): DecProto { return { dec: "" }; } - export const DecProto = { - encode(message: DecProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.base.v1beta1.DecProto", + encode(message: DecProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.dec !== "") { writer.uint32(10).string(message.dec); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecProto(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.dec = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DecProto { + fromPartial(object: Partial): DecProto { const message = createBaseDecProto(); message.dec = object.dec ?? ""; return message; + }, + fromAmino(object: DecProtoAmino): DecProto { + const message = createBaseDecProto(); + if (object.dec !== undefined && object.dec !== null) { + message.dec = object.dec; + } + return message; + }, + toAmino(message: DecProto): DecProtoAmino { + const obj: any = {}; + obj.dec = message.dec; + return obj; + }, + fromAminoMsg(object: DecProtoAminoMsg): DecProto { + return DecProto.fromAmino(object.value); + }, + toAminoMsg(message: DecProto): DecProtoAminoMsg { + return { + type: "cosmos-sdk/DecProto", + value: DecProto.toAmino(message) + }; + }, + fromProtoMsg(message: DecProtoProtoMsg): DecProto { + return DecProto.decode(message.value); + }, + toProto(message: DecProto): Uint8Array { + return DecProto.encode(message).finish(); + }, + toProtoMsg(message: DecProto): DecProtoProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.DecProto", + value: DecProto.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/bundle.ts b/src/codegen/cosmos/bundle.ts index 8f947ef..ef86e63 100644 --- a/src/codegen/cosmos/bundle.ts +++ b/src/codegen/cosmos/bundle.ts @@ -90,366 +90,407 @@ import * as _90 from "./upgrade/v1beta1/tx"; import * as _91 from "./upgrade/v1beta1/upgrade"; import * as _92 from "./vesting/v1beta1/tx"; import * as _93 from "./vesting/v1beta1/vesting"; -import * as _148 from "./authz/v1beta1/tx.amino"; -import * as _149 from "./bank/v1beta1/tx.amino"; -import * as _150 from "./crisis/v1beta1/tx.amino"; -import * as _151 from "./distribution/v1beta1/tx.amino"; -import * as _152 from "./evidence/v1beta1/tx.amino"; -import * as _153 from "./feegrant/v1beta1/tx.amino"; -import * as _154 from "./gov/v1/tx.amino"; -import * as _155 from "./gov/v1beta1/tx.amino"; -import * as _156 from "./group/v1/tx.amino"; -import * as _157 from "./nft/v1beta1/tx.amino"; -import * as _158 from "./slashing/v1beta1/tx.amino"; -import * as _159 from "./staking/v1beta1/tx.amino"; -import * as _160 from "./upgrade/v1beta1/tx.amino"; -import * as _161 from "./vesting/v1beta1/tx.amino"; -import * as _162 from "./authz/v1beta1/tx.registry"; -import * as _163 from "./bank/v1beta1/tx.registry"; -import * as _164 from "./crisis/v1beta1/tx.registry"; -import * as _165 from "./distribution/v1beta1/tx.registry"; -import * as _166 from "./evidence/v1beta1/tx.registry"; -import * as _167 from "./feegrant/v1beta1/tx.registry"; -import * as _168 from "./gov/v1/tx.registry"; -import * as _169 from "./gov/v1beta1/tx.registry"; -import * as _170 from "./group/v1/tx.registry"; -import * as _171 from "./nft/v1beta1/tx.registry"; -import * as _172 from "./slashing/v1beta1/tx.registry"; -import * as _173 from "./staking/v1beta1/tx.registry"; -import * as _174 from "./upgrade/v1beta1/tx.registry"; -import * as _175 from "./vesting/v1beta1/tx.registry"; -import * as _176 from "./auth/v1beta1/query.lcd"; -import * as _177 from "./authz/v1beta1/query.lcd"; -import * as _178 from "./bank/v1beta1/query.lcd"; -import * as _179 from "./base/tendermint/v1beta1/query.lcd"; -import * as _180 from "./distribution/v1beta1/query.lcd"; -import * as _181 from "./evidence/v1beta1/query.lcd"; -import * as _182 from "./feegrant/v1beta1/query.lcd"; -import * as _183 from "./gov/v1/query.lcd"; -import * as _184 from "./gov/v1beta1/query.lcd"; -import * as _185 from "./group/v1/query.lcd"; -import * as _186 from "./mint/v1beta1/query.lcd"; -import * as _187 from "./nft/v1beta1/query.lcd"; -import * as _188 from "./params/v1beta1/query.lcd"; -import * as _189 from "./slashing/v1beta1/query.lcd"; -import * as _190 from "./staking/v1beta1/query.lcd"; -import * as _191 from "./tx/v1beta1/service.lcd"; -import * as _192 from "./upgrade/v1beta1/query.lcd"; -import * as _193 from "./app/v1alpha1/query.rpc.Query"; -import * as _194 from "./auth/v1beta1/query.rpc.Query"; -import * as _195 from "./authz/v1beta1/query.rpc.Query"; -import * as _196 from "./bank/v1beta1/query.rpc.Query"; -import * as _197 from "./base/tendermint/v1beta1/query.rpc.Service"; -import * as _198 from "./distribution/v1beta1/query.rpc.Query"; -import * as _199 from "./evidence/v1beta1/query.rpc.Query"; -import * as _200 from "./feegrant/v1beta1/query.rpc.Query"; -import * as _201 from "./gov/v1/query.rpc.Query"; -import * as _202 from "./gov/v1beta1/query.rpc.Query"; -import * as _203 from "./group/v1/query.rpc.Query"; -import * as _204 from "./mint/v1beta1/query.rpc.Query"; -import * as _205 from "./nft/v1beta1/query.rpc.Query"; -import * as _206 from "./params/v1beta1/query.rpc.Query"; -import * as _207 from "./slashing/v1beta1/query.rpc.Query"; -import * as _208 from "./staking/v1beta1/query.rpc.Query"; -import * as _209 from "./tx/v1beta1/service.rpc.Service"; -import * as _210 from "./upgrade/v1beta1/query.rpc.Query"; -import * as _211 from "./authz/v1beta1/tx.rpc.msg"; -import * as _212 from "./bank/v1beta1/tx.rpc.msg"; -import * as _213 from "./crisis/v1beta1/tx.rpc.msg"; -import * as _214 from "./distribution/v1beta1/tx.rpc.msg"; -import * as _215 from "./evidence/v1beta1/tx.rpc.msg"; -import * as _216 from "./feegrant/v1beta1/tx.rpc.msg"; -import * as _217 from "./gov/v1/tx.rpc.msg"; -import * as _218 from "./gov/v1beta1/tx.rpc.msg"; -import * as _219 from "./group/v1/tx.rpc.msg"; -import * as _220 from "./nft/v1beta1/tx.rpc.msg"; -import * as _221 from "./slashing/v1beta1/tx.rpc.msg"; -import * as _222 from "./staking/v1beta1/tx.rpc.msg"; -import * as _223 from "./upgrade/v1beta1/tx.rpc.msg"; -import * as _224 from "./vesting/v1beta1/tx.rpc.msg"; -import * as _256 from "./lcd"; -import * as _257 from "./rpc.query"; -import * as _258 from "./rpc.tx"; +import * as _166 from "./authz/v1beta1/tx.amino"; +import * as _167 from "./bank/v1beta1/tx.amino"; +import * as _168 from "./crisis/v1beta1/tx.amino"; +import * as _169 from "./distribution/v1beta1/tx.amino"; +import * as _170 from "./evidence/v1beta1/tx.amino"; +import * as _171 from "./feegrant/v1beta1/tx.amino"; +import * as _172 from "./gov/v1/tx.amino"; +import * as _173 from "./gov/v1beta1/tx.amino"; +import * as _174 from "./group/v1/tx.amino"; +import * as _175 from "./nft/v1beta1/tx.amino"; +import * as _176 from "./slashing/v1beta1/tx.amino"; +import * as _177 from "./staking/v1beta1/tx.amino"; +import * as _178 from "./upgrade/v1beta1/tx.amino"; +import * as _179 from "./vesting/v1beta1/tx.amino"; +import * as _180 from "./authz/v1beta1/tx.registry"; +import * as _181 from "./bank/v1beta1/tx.registry"; +import * as _182 from "./crisis/v1beta1/tx.registry"; +import * as _183 from "./distribution/v1beta1/tx.registry"; +import * as _184 from "./evidence/v1beta1/tx.registry"; +import * as _185 from "./feegrant/v1beta1/tx.registry"; +import * as _186 from "./gov/v1/tx.registry"; +import * as _187 from "./gov/v1beta1/tx.registry"; +import * as _188 from "./group/v1/tx.registry"; +import * as _189 from "./nft/v1beta1/tx.registry"; +import * as _190 from "./slashing/v1beta1/tx.registry"; +import * as _191 from "./staking/v1beta1/tx.registry"; +import * as _192 from "./upgrade/v1beta1/tx.registry"; +import * as _193 from "./vesting/v1beta1/tx.registry"; +import * as _194 from "./auth/v1beta1/query.lcd"; +import * as _195 from "./authz/v1beta1/query.lcd"; +import * as _196 from "./bank/v1beta1/query.lcd"; +import * as _197 from "./base/tendermint/v1beta1/query.lcd"; +import * as _198 from "./distribution/v1beta1/query.lcd"; +import * as _199 from "./evidence/v1beta1/query.lcd"; +import * as _200 from "./feegrant/v1beta1/query.lcd"; +import * as _201 from "./gov/v1/query.lcd"; +import * as _202 from "./gov/v1beta1/query.lcd"; +import * as _203 from "./group/v1/query.lcd"; +import * as _204 from "./mint/v1beta1/query.lcd"; +import * as _205 from "./nft/v1beta1/query.lcd"; +import * as _206 from "./params/v1beta1/query.lcd"; +import * as _207 from "./slashing/v1beta1/query.lcd"; +import * as _208 from "./staking/v1beta1/query.lcd"; +import * as _209 from "./tx/v1beta1/service.lcd"; +import * as _210 from "./upgrade/v1beta1/query.lcd"; +import * as _211 from "./app/v1alpha1/query.rpc.Query"; +import * as _212 from "./auth/v1beta1/query.rpc.Query"; +import * as _213 from "./authz/v1beta1/query.rpc.Query"; +import * as _214 from "./bank/v1beta1/query.rpc.Query"; +import * as _215 from "./base/tendermint/v1beta1/query.rpc.Service"; +import * as _216 from "./distribution/v1beta1/query.rpc.Query"; +import * as _217 from "./evidence/v1beta1/query.rpc.Query"; +import * as _218 from "./feegrant/v1beta1/query.rpc.Query"; +import * as _219 from "./gov/v1/query.rpc.Query"; +import * as _220 from "./gov/v1beta1/query.rpc.Query"; +import * as _221 from "./group/v1/query.rpc.Query"; +import * as _222 from "./mint/v1beta1/query.rpc.Query"; +import * as _223 from "./nft/v1beta1/query.rpc.Query"; +import * as _224 from "./params/v1beta1/query.rpc.Query"; +import * as _225 from "./slashing/v1beta1/query.rpc.Query"; +import * as _226 from "./staking/v1beta1/query.rpc.Query"; +import * as _227 from "./tx/v1beta1/service.rpc.Service"; +import * as _228 from "./upgrade/v1beta1/query.rpc.Query"; +import * as _229 from "./authz/v1beta1/tx.rpc.msg"; +import * as _230 from "./bank/v1beta1/tx.rpc.msg"; +import * as _231 from "./crisis/v1beta1/tx.rpc.msg"; +import * as _232 from "./distribution/v1beta1/tx.rpc.msg"; +import * as _233 from "./evidence/v1beta1/tx.rpc.msg"; +import * as _234 from "./feegrant/v1beta1/tx.rpc.msg"; +import * as _235 from "./gov/v1/tx.rpc.msg"; +import * as _236 from "./gov/v1beta1/tx.rpc.msg"; +import * as _237 from "./group/v1/tx.rpc.msg"; +import * as _238 from "./nft/v1beta1/tx.rpc.msg"; +import * as _239 from "./slashing/v1beta1/tx.rpc.msg"; +import * as _240 from "./staking/v1beta1/tx.rpc.msg"; +import * as _241 from "./upgrade/v1beta1/tx.rpc.msg"; +import * as _242 from "./vesting/v1beta1/tx.rpc.msg"; +import * as _294 from "./lcd"; +import * as _295 from "./rpc.query"; +import * as _296 from "./rpc.tx"; export namespace cosmos { export namespace app { - export const v1alpha1 = { ..._2, + export const v1alpha1 = { + ..._2, ..._3, ..._4, - ..._193 + ..._211 }; } export namespace auth { - export const v1beta1 = { ..._5, + export const v1beta1 = { + ..._5, ..._6, ..._7, - ..._176, - ..._194 + ..._194, + ..._212 }; } export namespace authz { - export const v1beta1 = { ..._8, + export const v1beta1 = { + ..._8, ..._9, ..._10, ..._11, ..._12, - ..._148, - ..._162, - ..._177, + ..._166, + ..._180, ..._195, - ..._211 + ..._213, + ..._229 }; } export namespace bank { - export const v1beta1 = { ..._13, + export const v1beta1 = { + ..._13, ..._14, ..._15, ..._16, ..._17, - ..._149, - ..._163, - ..._178, + ..._167, + ..._181, ..._196, - ..._212 + ..._214, + ..._230 }; } export namespace base { export namespace abci { - export const v1beta1 = { ..._18 + export const v1beta1 = { + ..._18 }; } export namespace kv { - export const v1beta1 = { ..._19 + export const v1beta1 = { + ..._19 }; } export namespace query { - export const v1beta1 = { ..._20 + export const v1beta1 = { + ..._20 }; } export namespace reflection { - export const v1beta1 = { ..._21 + export const v1beta1 = { + ..._21 }; - export const v2alpha1 = { ..._22 + export const v2alpha1 = { + ..._22 }; } export namespace snapshots { - export const v1beta1 = { ..._23 + export const v1beta1 = { + ..._23 }; } export namespace store { - export const v1beta1 = { ..._24, + export const v1beta1 = { + ..._24, ..._25 }; } export namespace tendermint { - export const v1beta1 = { ..._26, - ..._179, - ..._197 + export const v1beta1 = { + ..._26, + ..._197, + ..._215 }; } - export const v1beta1 = { ..._27 + export const v1beta1 = { + ..._27 }; } export namespace capability { - export const v1beta1 = { ..._28, + export const v1beta1 = { + ..._28, ..._29 }; } export namespace crisis { - export const v1beta1 = { ..._30, + export const v1beta1 = { + ..._30, ..._31, - ..._150, - ..._164, - ..._213 + ..._168, + ..._182, + ..._231 }; } export namespace crypto { - export const ed25519 = { ..._32 + export const ed25519 = { + ..._32 }; export namespace hd { - export const v1 = { ..._33 + export const v1 = { + ..._33 }; } export namespace keyring { - export const v1 = { ..._34 + export const v1 = { + ..._34 }; } - export const multisig = { ..._35 + export const multisig = { + ..._35 }; - export const secp256k1 = { ..._36 + export const secp256k1 = { + ..._36 }; - export const secp256r1 = { ..._37 + export const secp256r1 = { + ..._37 }; } export namespace distribution { - export const v1beta1 = { ..._38, + export const v1beta1 = { + ..._38, ..._39, ..._40, ..._41, - ..._151, - ..._165, - ..._180, + ..._169, + ..._183, ..._198, - ..._214 + ..._216, + ..._232 }; } export namespace evidence { - export const v1beta1 = { ..._42, + export const v1beta1 = { + ..._42, ..._43, ..._44, ..._45, - ..._152, - ..._166, - ..._181, + ..._170, + ..._184, ..._199, - ..._215 + ..._217, + ..._233 }; } export namespace feegrant { - export const v1beta1 = { ..._46, + export const v1beta1 = { + ..._46, ..._47, ..._48, ..._49, - ..._153, - ..._167, - ..._182, + ..._171, + ..._185, ..._200, - ..._216 + ..._218, + ..._234 }; } export namespace genutil { - export const v1beta1 = { ..._50 + export const v1beta1 = { + ..._50 }; } export namespace gov { - export const v1 = { ..._51, + export const v1 = { + ..._51, ..._52, ..._53, ..._54, - ..._154, - ..._168, - ..._183, + ..._172, + ..._186, ..._201, - ..._217 + ..._219, + ..._235 }; - export const v1beta1 = { ..._55, + export const v1beta1 = { + ..._55, ..._56, ..._57, ..._58, - ..._155, - ..._169, - ..._184, + ..._173, + ..._187, ..._202, - ..._218 + ..._220, + ..._236 }; } export namespace group { - export const v1 = { ..._59, + export const v1 = { + ..._59, ..._60, ..._61, ..._62, ..._63, - ..._156, - ..._170, - ..._185, + ..._174, + ..._188, ..._203, - ..._219 + ..._221, + ..._237 }; } export namespace mint { - export const v1beta1 = { ..._64, + export const v1beta1 = { + ..._64, ..._65, ..._66, - ..._186, - ..._204 + ..._204, + ..._222 }; } export namespace msg { - export const v1 = { ..._67 + export const v1 = { + ..._67 }; } export namespace nft { - export const v1beta1 = { ..._68, + export const v1beta1 = { + ..._68, ..._69, ..._70, ..._71, ..._72, - ..._157, - ..._171, - ..._187, + ..._175, + ..._189, ..._205, - ..._220 + ..._223, + ..._238 }; } export namespace orm { - export const v1 = { ..._73 + export const v1 = { + ..._73 }; - export const v1alpha1 = { ..._74 + export const v1alpha1 = { + ..._74 }; } export namespace params { - export const v1beta1 = { ..._75, + export const v1beta1 = { + ..._75, ..._76, - ..._188, - ..._206 + ..._206, + ..._224 }; } export namespace slashing { - export const v1beta1 = { ..._77, + export const v1beta1 = { + ..._77, ..._78, ..._79, ..._80, - ..._158, - ..._172, - ..._189, + ..._176, + ..._190, ..._207, - ..._221 + ..._225, + ..._239 }; } export namespace staking { - export const v1beta1 = { ..._81, + export const v1beta1 = { + ..._81, ..._82, ..._83, ..._84, ..._85, - ..._159, - ..._173, - ..._190, + ..._177, + ..._191, ..._208, - ..._222 + ..._226, + ..._240 }; } export namespace tx { export namespace signing { - export const v1beta1 = { ..._86 + export const v1beta1 = { + ..._86 }; } - export const v1beta1 = { ..._87, + export const v1beta1 = { + ..._87, ..._88, - ..._191, - ..._209 + ..._209, + ..._227 }; } export namespace upgrade { - export const v1beta1 = { ..._89, + export const v1beta1 = { + ..._89, ..._90, ..._91, - ..._160, - ..._174, + ..._178, ..._192, ..._210, - ..._223 + ..._228, + ..._241 }; } export namespace vesting { - export const v1beta1 = { ..._92, + export const v1beta1 = { + ..._92, ..._93, - ..._161, - ..._175, - ..._224 + ..._179, + ..._193, + ..._242 }; } - export const ClientFactory = { ..._256, - ..._257, - ..._258 + export const ClientFactory = { + ..._294, + ..._295, + ..._296 }; } \ No newline at end of file diff --git a/src/codegen/cosmos/capability/v1beta1/capability.ts b/src/codegen/cosmos/capability/v1beta1/capability.ts index 5ea834d..162e292 100644 --- a/src/codegen/cosmos/capability/v1beta1/capability.ts +++ b/src/codegen/cosmos/capability/v1beta1/capability.ts @@ -1,35 +1,61 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * Capability defines an implementation of an object capability. The index * provided to a Capability must be globally unique. */ - export interface Capability { - index: Long; + index: bigint; +} +export interface CapabilityProtoMsg { + typeUrl: "/cosmos.capability.v1beta1.Capability"; + value: Uint8Array; +} +/** + * Capability defines an implementation of an object capability. The index + * provided to a Capability must be globally unique. + */ +export interface CapabilityAmino { + index?: string; +} +export interface CapabilityAminoMsg { + type: "cosmos-sdk/Capability"; + value: CapabilityAmino; } /** * Capability defines an implementation of an object capability. The index * provided to a Capability must be globally unique. */ - export interface CapabilitySDKType { - index: Long; + index: bigint; } /** * Owner defines a single capability owner. An owner is defined by the name of * capability and the module name. */ - export interface Owner { module: string; name: string; } +export interface OwnerProtoMsg { + typeUrl: "/cosmos.capability.v1beta1.Owner"; + value: Uint8Array; +} +/** + * Owner defines a single capability owner. An owner is defined by the name of + * capability and the module name. + */ +export interface OwnerAmino { + module?: string; + name?: string; +} +export interface OwnerAminoMsg { + type: "cosmos-sdk/Owner"; + value: OwnerAmino; +} /** * Owner defines a single capability owner. An owner is defined by the name of * capability and the module name. */ - export interface OwnerSDKType { module: string; name: string; @@ -38,160 +64,249 @@ export interface OwnerSDKType { * CapabilityOwners defines a set of owners of a single Capability. The set of * owners must be unique. */ - export interface CapabilityOwners { owners: Owner[]; } +export interface CapabilityOwnersProtoMsg { + typeUrl: "/cosmos.capability.v1beta1.CapabilityOwners"; + value: Uint8Array; +} +/** + * CapabilityOwners defines a set of owners of a single Capability. The set of + * owners must be unique. + */ +export interface CapabilityOwnersAmino { + owners?: OwnerAmino[]; +} +export interface CapabilityOwnersAminoMsg { + type: "cosmos-sdk/CapabilityOwners"; + value: CapabilityOwnersAmino; +} /** * CapabilityOwners defines a set of owners of a single Capability. The set of * owners must be unique. */ - export interface CapabilityOwnersSDKType { owners: OwnerSDKType[]; } - function createBaseCapability(): Capability { return { - index: Long.UZERO + index: BigInt(0) }; } - export const Capability = { - encode(message: Capability, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.index.isZero()) { + typeUrl: "/cosmos.capability.v1beta1.Capability", + encode(message: Capability, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Capability { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Capability { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCapability(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.index = (reader.uint64() as Long); + message.index = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Capability { + fromPartial(object: Partial): Capability { + const message = createBaseCapability(); + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); + return message; + }, + fromAmino(object: CapabilityAmino): Capability { const message = createBaseCapability(); - message.index = object.index !== undefined && object.index !== null ? Long.fromValue(object.index) : Long.UZERO; + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } return message; + }, + toAmino(message: Capability): CapabilityAmino { + const obj: any = {}; + obj.index = message.index ? message.index.toString() : undefined; + return obj; + }, + fromAminoMsg(object: CapabilityAminoMsg): Capability { + return Capability.fromAmino(object.value); + }, + toAminoMsg(message: Capability): CapabilityAminoMsg { + return { + type: "cosmos-sdk/Capability", + value: Capability.toAmino(message) + }; + }, + fromProtoMsg(message: CapabilityProtoMsg): Capability { + return Capability.decode(message.value); + }, + toProto(message: Capability): Uint8Array { + return Capability.encode(message).finish(); + }, + toProtoMsg(message: Capability): CapabilityProtoMsg { + return { + typeUrl: "/cosmos.capability.v1beta1.Capability", + value: Capability.encode(message).finish() + }; } - }; - function createBaseOwner(): Owner { return { module: "", name: "" }; } - export const Owner = { - encode(message: Owner, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.capability.v1beta1.Owner", + encode(message: Owner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.module !== "") { writer.uint32(10).string(message.module); } - if (message.name !== "") { writer.uint32(18).string(message.name); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Owner { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Owner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseOwner(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.module = reader.string(); break; - case 2: message.name = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Owner { + fromPartial(object: Partial): Owner { const message = createBaseOwner(); message.module = object.module ?? ""; message.name = object.name ?? ""; return message; + }, + fromAmino(object: OwnerAmino): Owner { + const message = createBaseOwner(); + if (object.module !== undefined && object.module !== null) { + message.module = object.module; + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + return message; + }, + toAmino(message: Owner): OwnerAmino { + const obj: any = {}; + obj.module = message.module; + obj.name = message.name; + return obj; + }, + fromAminoMsg(object: OwnerAminoMsg): Owner { + return Owner.fromAmino(object.value); + }, + toAminoMsg(message: Owner): OwnerAminoMsg { + return { + type: "cosmos-sdk/Owner", + value: Owner.toAmino(message) + }; + }, + fromProtoMsg(message: OwnerProtoMsg): Owner { + return Owner.decode(message.value); + }, + toProto(message: Owner): Uint8Array { + return Owner.encode(message).finish(); + }, + toProtoMsg(message: Owner): OwnerProtoMsg { + return { + typeUrl: "/cosmos.capability.v1beta1.Owner", + value: Owner.encode(message).finish() + }; } - }; - function createBaseCapabilityOwners(): CapabilityOwners { return { owners: [] }; } - export const CapabilityOwners = { - encode(message: CapabilityOwners, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.capability.v1beta1.CapabilityOwners", + encode(message: CapabilityOwners, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.owners) { Owner.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CapabilityOwners { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CapabilityOwners { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCapabilityOwners(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.owners.push(Owner.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CapabilityOwners { + fromPartial(object: Partial): CapabilityOwners { const message = createBaseCapabilityOwners(); message.owners = object.owners?.map(e => Owner.fromPartial(e)) || []; return message; + }, + fromAmino(object: CapabilityOwnersAmino): CapabilityOwners { + const message = createBaseCapabilityOwners(); + message.owners = object.owners?.map(e => Owner.fromAmino(e)) || []; + return message; + }, + toAmino(message: CapabilityOwners): CapabilityOwnersAmino { + const obj: any = {}; + if (message.owners) { + obj.owners = message.owners.map(e => e ? Owner.toAmino(e) : undefined); + } else { + obj.owners = []; + } + return obj; + }, + fromAminoMsg(object: CapabilityOwnersAminoMsg): CapabilityOwners { + return CapabilityOwners.fromAmino(object.value); + }, + toAminoMsg(message: CapabilityOwners): CapabilityOwnersAminoMsg { + return { + type: "cosmos-sdk/CapabilityOwners", + value: CapabilityOwners.toAmino(message) + }; + }, + fromProtoMsg(message: CapabilityOwnersProtoMsg): CapabilityOwners { + return CapabilityOwners.decode(message.value); + }, + toProto(message: CapabilityOwners): Uint8Array { + return CapabilityOwners.encode(message).finish(); + }, + toProtoMsg(message: CapabilityOwners): CapabilityOwnersProtoMsg { + return { + typeUrl: "/cosmos.capability.v1beta1.CapabilityOwners", + value: CapabilityOwners.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/capability/v1beta1/genesis.ts b/src/codegen/cosmos/capability/v1beta1/genesis.ts index 4708764..285c15e 100644 --- a/src/codegen/cosmos/capability/v1beta1/genesis.ts +++ b/src/codegen/cosmos/capability/v1beta1/genesis.ts @@ -1,155 +1,226 @@ -import { CapabilityOwners, CapabilityOwnersSDKType } from "./capability"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { CapabilityOwners, CapabilityOwnersAmino, CapabilityOwnersSDKType } from "./capability"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisOwners defines the capability owners with their corresponding index. */ - export interface GenesisOwners { /** index is the index of the capability owner. */ - index: Long; + index: bigint; /** index_owners are the owners at the given index. */ - - indexOwners?: CapabilityOwners; + indexOwners: CapabilityOwners; +} +export interface GenesisOwnersProtoMsg { + typeUrl: "/cosmos.capability.v1beta1.GenesisOwners"; + value: Uint8Array; } /** GenesisOwners defines the capability owners with their corresponding index. */ - -export interface GenesisOwnersSDKType { +export interface GenesisOwnersAmino { /** index is the index of the capability owner. */ - index: Long; + index?: string; /** index_owners are the owners at the given index. */ - - index_owners?: CapabilityOwnersSDKType; + index_owners?: CapabilityOwnersAmino; +} +export interface GenesisOwnersAminoMsg { + type: "cosmos-sdk/GenesisOwners"; + value: GenesisOwnersAmino; +} +/** GenesisOwners defines the capability owners with their corresponding index. */ +export interface GenesisOwnersSDKType { + index: bigint; + index_owners: CapabilityOwnersSDKType; } /** GenesisState defines the capability module's genesis state. */ - export interface GenesisState { /** index is the capability global index. */ - index: Long; + index: bigint; /** * owners represents a map from index to owners of the capability index * index key is string to allow amino marshalling. */ - owners: GenesisOwners[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.capability.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the capability module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** index is the capability global index. */ - index: Long; + index?: string; /** * owners represents a map from index to owners of the capability index * index key is string to allow amino marshalling. */ - + owners?: GenesisOwnersAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the capability module's genesis state. */ +export interface GenesisStateSDKType { + index: bigint; owners: GenesisOwnersSDKType[]; } - function createBaseGenesisOwners(): GenesisOwners { return { - index: Long.UZERO, - indexOwners: undefined + index: BigInt(0), + indexOwners: CapabilityOwners.fromPartial({}) }; } - export const GenesisOwners = { - encode(message: GenesisOwners, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.index.isZero()) { + typeUrl: "/cosmos.capability.v1beta1.GenesisOwners", + encode(message: GenesisOwners, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); } - if (message.indexOwners !== undefined) { CapabilityOwners.encode(message.indexOwners, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisOwners { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisOwners { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisOwners(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.index = (reader.uint64() as Long); + message.index = reader.uint64(); break; - case 2: message.indexOwners = CapabilityOwners.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisOwners { + fromPartial(object: Partial): GenesisOwners { const message = createBaseGenesisOwners(); - message.index = object.index !== undefined && object.index !== null ? Long.fromValue(object.index) : Long.UZERO; + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); message.indexOwners = object.indexOwners !== undefined && object.indexOwners !== null ? CapabilityOwners.fromPartial(object.indexOwners) : undefined; return message; + }, + fromAmino(object: GenesisOwnersAmino): GenesisOwners { + const message = createBaseGenesisOwners(); + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + if (object.index_owners !== undefined && object.index_owners !== null) { + message.indexOwners = CapabilityOwners.fromAmino(object.index_owners); + } + return message; + }, + toAmino(message: GenesisOwners): GenesisOwnersAmino { + const obj: any = {}; + obj.index = message.index ? message.index.toString() : undefined; + obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisOwnersAminoMsg): GenesisOwners { + return GenesisOwners.fromAmino(object.value); + }, + toAminoMsg(message: GenesisOwners): GenesisOwnersAminoMsg { + return { + type: "cosmos-sdk/GenesisOwners", + value: GenesisOwners.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisOwnersProtoMsg): GenesisOwners { + return GenesisOwners.decode(message.value); + }, + toProto(message: GenesisOwners): Uint8Array { + return GenesisOwners.encode(message).finish(); + }, + toProtoMsg(message: GenesisOwners): GenesisOwnersProtoMsg { + return { + typeUrl: "/cosmos.capability.v1beta1.GenesisOwners", + value: GenesisOwners.encode(message).finish() + }; } - }; - function createBaseGenesisState(): GenesisState { return { - index: Long.UZERO, + index: BigInt(0), owners: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.index.isZero()) { + typeUrl: "/cosmos.capability.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); } - for (const v of message.owners) { GenesisOwners.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.index = (reader.uint64() as Long); + message.index = reader.uint64(); break; - case 2: message.owners.push(GenesisOwners.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); - message.index = object.index !== undefined && object.index !== null ? Long.fromValue(object.index) : Long.UZERO; + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); message.owners = object.owners?.map(e => GenesisOwners.fromPartial(e)) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + message.owners = object.owners?.map(e => GenesisOwners.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.index = message.index ? message.index.toString() : undefined; + if (message.owners) { + obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); + } else { + obj.owners = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.capability.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/client.ts b/src/codegen/cosmos/client.ts index 3151627..d716468 100644 --- a/src/codegen/cosmos/client.ts +++ b/src/codegen/cosmos/client.ts @@ -29,7 +29,8 @@ import * as cosmosSlashingV1beta1TxAmino from "./slashing/v1beta1/tx.amino"; import * as cosmosStakingV1beta1TxAmino from "./staking/v1beta1/tx.amino"; import * as cosmosUpgradeV1beta1TxAmino from "./upgrade/v1beta1/tx.amino"; import * as cosmosVestingV1beta1TxAmino from "./vesting/v1beta1/tx.amino"; -export const cosmosAminoConverters = { ...cosmosAuthzV1beta1TxAmino.AminoConverter, +export const cosmosAminoConverters = { + ...cosmosAuthzV1beta1TxAmino.AminoConverter, ...cosmosBankV1beta1TxAmino.AminoConverter, ...cosmosCrisisV1beta1TxAmino.AminoConverter, ...cosmosDistributionV1beta1TxAmino.AminoConverter, @@ -50,7 +51,8 @@ export const getSigningCosmosClientOptions = (): { aminoTypes: AminoTypes; } => { const registry = new Registry([...cosmosProtoRegistry]); - const aminoTypes = new AminoTypes({ ...cosmosAminoConverters + const aminoTypes = new AminoTypes({ + ...cosmosAminoConverters }); return { registry, @@ -69,7 +71,7 @@ export const getSigningCosmosClient = async ({ aminoTypes } = getSigningCosmosClientOptions(); const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { - registry, + registry: (registry as any), aminoTypes }); return client; diff --git a/src/codegen/cosmos/crisis/v1beta1/genesis.ts b/src/codegen/cosmos/crisis/v1beta1/genesis.ts index 8e55fa3..4b3c0a1 100644 --- a/src/codegen/cosmos/crisis/v1beta1/genesis.ts +++ b/src/codegen/cosmos/crisis/v1beta1/genesis.ts @@ -1,66 +1,99 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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; + constantFee: Coin; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.crisis.v1beta1.GenesisState"; + value: Uint8Array; } /** GenesisState defines the crisis module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** * constant_fee is the fee used to verify the invariant in the crisis * module. */ - constant_fee?: CoinSDKType; + constant_fee?: CoinAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the crisis module's genesis state. */ +export interface GenesisStateSDKType { + constant_fee: CoinSDKType; } - function createBaseGenesisState(): GenesisState { return { - constantFee: undefined + constantFee: Coin.fromPartial({}) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crisis.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.constantFee !== undefined) { Coin.encode(message.constantFee, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.constantFee = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.constantFee = object.constantFee !== undefined && object.constantFee !== null ? Coin.fromPartial(object.constantFee) : undefined; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.constant_fee !== undefined && object.constant_fee !== null) { + message.constantFee = Coin.fromAmino(object.constant_fee); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.constant_fee = message.constantFee ? Coin.toAmino(message.constantFee) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.crisis.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/crisis/v1beta1/tx.amino.ts b/src/codegen/cosmos/crisis/v1beta1/tx.amino.ts index 7d4adbc..5269268 100644 --- a/src/codegen/cosmos/crisis/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/crisis/v1beta1/tx.amino.ts @@ -1,37 +1,8 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgVerifyInvariant } from "./tx"; -export interface AminoMsgVerifyInvariant extends AminoMsg { - type: "cosmos-sdk/MsgVerifyInvariant"; - value: { - sender: string; - invariant_module_name: string; - invariant_route: string; - }; -} export const AminoConverter = { "/cosmos.crisis.v1beta1.MsgVerifyInvariant": { aminoType: "cosmos-sdk/MsgVerifyInvariant", - toAmino: ({ - sender, - invariantModuleName, - invariantRoute - }: MsgVerifyInvariant): AminoMsgVerifyInvariant["value"] => { - return { - sender, - invariant_module_name: invariantModuleName, - invariant_route: invariantRoute - }; - }, - fromAmino: ({ - sender, - invariant_module_name, - invariant_route - }: AminoMsgVerifyInvariant["value"]): MsgVerifyInvariant => { - return { - sender, - invariantModuleName: invariant_module_name, - invariantRoute: invariant_route - }; - } + toAmino: MsgVerifyInvariant.toAmino, + fromAmino: MsgVerifyInvariant.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/crisis/v1beta1/tx.registry.ts b/src/codegen/cosmos/crisis/v1beta1/tx.registry.ts index a3a6b31..8a14b48 100644 --- a/src/codegen/cosmos/crisis/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/crisis/v1beta1/tx.registry.ts @@ -14,7 +14,6 @@ export const MessageComposer = { value: MsgVerifyInvariant.encode(value).finish() }; } - }, withTypeUrl: { verifyInvariant(value: MsgVerifyInvariant) { @@ -23,7 +22,6 @@ export const MessageComposer = { value }; } - }, fromPartial: { verifyInvariant(value: MsgVerifyInvariant) { @@ -32,6 +30,5 @@ export const MessageComposer = { value: MsgVerifyInvariant.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/crisis/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/crisis/v1beta1/tx.rpc.msg.ts index cd2c038..b0b9ea1 100644 --- a/src/codegen/cosmos/crisis/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/crisis/v1beta1/tx.rpc.msg.ts @@ -1,24 +1,20 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgVerifyInvariant, MsgVerifyInvariantResponse } from "./tx"; /** Msg defines the bank Msg service. */ - export interface Msg { /** VerifyInvariant defines a method to verify a particular invariance. */ verifyInvariant(request: MsgVerifyInvariant): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.verifyInvariant = this.verifyInvariant.bind(this); } - verifyInvariant(request: MsgVerifyInvariant): Promise { const data = MsgVerifyInvariant.encode(request).finish(); const promise = this.rpc.request("cosmos.crisis.v1beta1.Msg", "VerifyInvariant", data); - return promise.then(data => MsgVerifyInvariantResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgVerifyInvariantResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/crisis/v1beta1/tx.ts b/src/codegen/cosmos/crisis/v1beta1/tx.ts index 14e3dca..5ebfd3e 100644 --- a/src/codegen/cosmos/crisis/v1beta1/tx.ts +++ b/src/codegen/cosmos/crisis/v1beta1/tx.ts @@ -1,26 +1,44 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ - export interface MsgVerifyInvariant { sender: string; invariantModuleName: string; invariantRoute: string; } +export interface MsgVerifyInvariantProtoMsg { + typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant"; + value: Uint8Array; +} +/** MsgVerifyInvariant represents a message to verify a particular invariance. */ +export interface MsgVerifyInvariantAmino { + sender?: string; + invariant_module_name?: string; + invariant_route?: string; +} +export interface MsgVerifyInvariantAminoMsg { + type: "cosmos-sdk/MsgVerifyInvariant"; + value: MsgVerifyInvariantAmino; +} /** MsgVerifyInvariant represents a message to verify a particular invariance. */ - export interface MsgVerifyInvariantSDKType { sender: string; invariant_module_name: string; invariant_route: string; } /** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ - export interface MsgVerifyInvariantResponse {} +export interface MsgVerifyInvariantResponseProtoMsg { + typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse"; + value: Uint8Array; +} +/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ +export interface MsgVerifyInvariantResponseAmino {} +export interface MsgVerifyInvariantResponseAminoMsg { + type: "cosmos-sdk/MsgVerifyInvariantResponse"; + value: MsgVerifyInvariantResponseAmino; +} /** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ - export interface MsgVerifyInvariantResponseSDKType {} - function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { return { sender: "", @@ -28,94 +46,145 @@ function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { invariantRoute: "" }; } - export const MsgVerifyInvariant = { - encode(message: MsgVerifyInvariant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", + encode(message: MsgVerifyInvariant, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): MsgVerifyInvariant { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.sender = reader.string(); break; - case 2: message.invariantModuleName = reader.string(); break; - case 3: message.invariantRoute = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgVerifyInvariant { + fromPartial(object: Partial): MsgVerifyInvariant { const message = createBaseMsgVerifyInvariant(); message.sender = object.sender ?? ""; message.invariantModuleName = object.invariantModuleName ?? ""; message.invariantRoute = object.invariantRoute ?? ""; return message; + }, + fromAmino(object: MsgVerifyInvariantAmino): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.invariant_module_name !== undefined && object.invariant_module_name !== null) { + message.invariantModuleName = object.invariant_module_name; + } + if (object.invariant_route !== undefined && object.invariant_route !== null) { + message.invariantRoute = object.invariant_route; + } + return message; + }, + toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { + const obj: any = {}; + obj.sender = message.sender; + obj.invariant_module_name = message.invariantModuleName; + obj.invariant_route = message.invariantRoute; + return obj; + }, + fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { + return MsgVerifyInvariant.fromAmino(object.value); + }, + toAminoMsg(message: MsgVerifyInvariant): MsgVerifyInvariantAminoMsg { + return { + type: "cosmos-sdk/MsgVerifyInvariant", + value: MsgVerifyInvariant.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVerifyInvariantProtoMsg): MsgVerifyInvariant { + return MsgVerifyInvariant.decode(message.value); + }, + toProto(message: MsgVerifyInvariant): Uint8Array { + return MsgVerifyInvariant.encode(message).finish(); + }, + toProtoMsg(message: MsgVerifyInvariant): MsgVerifyInvariantProtoMsg { + return { + typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", + value: MsgVerifyInvariant.encode(message).finish() + }; } - }; - function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { return {}; } - export const MsgVerifyInvariantResponse = { - encode(_: MsgVerifyInvariantResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", + encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVerifyInvariantResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgVerifyInvariantResponse { + fromPartial(_: Partial): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, + fromAmino(_: MsgVerifyInvariantResponseAmino): MsgVerifyInvariantResponse { const message = createBaseMsgVerifyInvariantResponse(); return message; + }, + toAmino(_: MsgVerifyInvariantResponse): MsgVerifyInvariantResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVerifyInvariantResponseAminoMsg): MsgVerifyInvariantResponse { + return MsgVerifyInvariantResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVerifyInvariantResponse): MsgVerifyInvariantResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVerifyInvariantResponse", + value: MsgVerifyInvariantResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVerifyInvariantResponseProtoMsg): MsgVerifyInvariantResponse { + return MsgVerifyInvariantResponse.decode(message.value); + }, + toProto(message: MsgVerifyInvariantResponse): Uint8Array { + return MsgVerifyInvariantResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVerifyInvariantResponse): MsgVerifyInvariantResponseProtoMsg { + return { + typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", + value: MsgVerifyInvariantResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/crypto/ed25519/keys.ts b/src/codegen/cosmos/crypto/ed25519/keys.ts index cfa5931..39040bb 100644 --- a/src/codegen/cosmos/crypto/ed25519/keys.ts +++ b/src/codegen/cosmos/crypto/ed25519/keys.ts @@ -1,5 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** * PubKey is an ed25519 public key for handling Tendermint keys in SDK. * It's needed for Any serialization and SDK compatibility. @@ -7,10 +7,27 @@ import { DeepPartial } from "../../../helpers"; * ADR-28. Nevertheless, you will like to use ed25519 in app user level * then you must create a new proto message and follow ADR-28 for Address construction. */ - export interface PubKey { key: Uint8Array; } +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.ed25519.PubKey"; + value: Uint8Array; +} +/** + * PubKey is an ed25519 public key for handling Tendermint keys in SDK. + * It's needed for Any serialization and SDK compatibility. + * It must not be used in a non Tendermint key context because it doesn't implement + * ADR-28. Nevertheless, you will like to use ed25519 in app user level + * then you must create a new proto message and follow ADR-28 for Address construction. + */ +export interface PubKeyAmino { + key?: string; +} +export interface PubKeyAminoMsg { + type: "cosmos-sdk/PubKey"; + value: PubKeyAmino; +} /** * PubKey is an ed25519 public key for handling Tendermint keys in SDK. * It's needed for Any serialization and SDK compatibility. @@ -18,7 +35,6 @@ export interface PubKey { * 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 PubKeySDKType { key: Uint8Array; } @@ -26,105 +42,166 @@ export interface PubKeySDKType { * Deprecated: PrivKey defines a ed25519 private key. * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. */ - export interface PrivKey { key: Uint8Array; } +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.ed25519.PrivKey"; + value: Uint8Array; +} +/** + * Deprecated: PrivKey defines a ed25519 private key. + * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. + */ +export interface PrivKeyAmino { + key?: string; +} +export interface PrivKeyAminoMsg { + type: "cosmos-sdk/PrivKey"; + value: PrivKeyAmino; +} /** * Deprecated: PrivKey defines a ed25519 private key. * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. */ - export interface PrivKeySDKType { key: Uint8Array; } - function createBasePubKey(): PubKey { return { key: new Uint8Array() }; } - export const PubKey = { - encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.ed25519.PubKey", + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePubKey(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PubKey { + fromPartial(object: Partial): PubKey { const message = createBasePubKey(); message.key = object.key ?? new Uint8Array(); return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "cosmos-sdk/PubKey", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.ed25519.PubKey", + value: PubKey.encode(message).finish() + }; } - }; - function createBasePrivKey(): PrivKey { return { key: new Uint8Array() }; } - export const PrivKey = { - encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.ed25519.PrivKey", + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePrivKey(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PrivKey { + fromPartial(object: Partial): PrivKey { const message = createBasePrivKey(); message.key = object.key ?? new Uint8Array(); return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "cosmos-sdk/PrivKey", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.ed25519.PrivKey", + value: PrivKey.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/crypto/hd/v1/hd.ts b/src/codegen/cosmos/crypto/hd/v1/hd.ts index 91f362c..e9f94e1 100644 --- a/src/codegen/cosmos/crypto/hd/v1/hd.ts +++ b/src/codegen/cosmos/crypto/hd/v1/hd.ts @@ -1,48 +1,52 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** 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; } +export interface BIP44ParamsProtoMsg { + typeUrl: "/cosmos.crypto.hd.v1.BIP44Params"; + value: Uint8Array; +} /** BIP44Params is used as path field in ledger item in Record. */ - -export interface BIP44ParamsSDKType { +export interface BIP44ParamsAmino { /** purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation */ - purpose: number; + purpose?: number; /** coin_type is a constant that improves privacy */ - - coin_type: number; + coin_type?: number; /** account splits the key space into independent user identities */ - - account: number; + 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; + change?: boolean; /** address_index is used as child index in BIP32 derivation */ - + address_index?: number; +} +export interface BIP44ParamsAminoMsg { + type: "cosmos-sdk/BIP44Params"; + value: BIP44ParamsAmino; +} +/** BIP44Params is used as path field in ledger item in Record. */ +export interface BIP44ParamsSDKType { + purpose: number; + coin_type: number; + account: number; + change: boolean; address_index: number; } - function createBaseBIP44Params(): BIP44Params { return { purpose: 0, @@ -52,71 +56,56 @@ function createBaseBIP44Params(): BIP44Params { addressIndex: 0 }; } - export const BIP44Params = { - encode(message: BIP44Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.hd.v1.BIP44Params", + encode(message: BIP44Params, writer: BinaryWriter = BinaryWriter.create()): 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 === true) { writer.uint32(32).bool(message.change); } - if (message.addressIndex !== 0) { writer.uint32(40).uint32(message.addressIndex); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BIP44Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.purpose = reader.uint32(); break; - case 2: message.coinType = reader.uint32(); break; - case 3: message.account = reader.uint32(); break; - case 4: message.change = reader.bool(); break; - case 5: message.addressIndex = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BIP44Params { + fromPartial(object: Partial): BIP44Params { const message = createBaseBIP44Params(); message.purpose = object.purpose ?? 0; message.coinType = object.coinType ?? 0; @@ -124,6 +113,54 @@ export const BIP44Params = { message.change = object.change ?? false; message.addressIndex = object.addressIndex ?? 0; return message; + }, + fromAmino(object: BIP44ParamsAmino): BIP44Params { + const message = createBaseBIP44Params(); + if (object.purpose !== undefined && object.purpose !== null) { + message.purpose = object.purpose; + } + if (object.coin_type !== undefined && object.coin_type !== null) { + message.coinType = object.coin_type; + } + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + if (object.change !== undefined && object.change !== null) { + message.change = object.change; + } + if (object.address_index !== undefined && object.address_index !== null) { + message.addressIndex = object.address_index; + } + return message; + }, + toAmino(message: BIP44Params): BIP44ParamsAmino { + const obj: any = {}; + obj.purpose = message.purpose; + obj.coin_type = message.coinType; + obj.account = message.account; + obj.change = message.change; + obj.address_index = message.addressIndex; + return obj; + }, + fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { + return BIP44Params.fromAmino(object.value); + }, + toAminoMsg(message: BIP44Params): BIP44ParamsAminoMsg { + return { + type: "cosmos-sdk/BIP44Params", + value: BIP44Params.toAmino(message) + }; + }, + fromProtoMsg(message: BIP44ParamsProtoMsg): BIP44Params { + return BIP44Params.decode(message.value); + }, + toProto(message: BIP44Params): Uint8Array { + return BIP44Params.encode(message).finish(); + }, + toProtoMsg(message: BIP44Params): BIP44ParamsProtoMsg { + return { + typeUrl: "/cosmos.crypto.hd.v1.BIP44Params", + value: BIP44Params.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/crypto/keyring/v1/record.ts b/src/codegen/cosmos/crypto/keyring/v1/record.ts index f8f3e2c..bf1b7f0 100644 --- a/src/codegen/cosmos/crypto/keyring/v1/record.ts +++ b/src/codegen/cosmos/crypto/keyring/v1/record.ts @@ -1,90 +1,133 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { BIP44Params, BIP44ParamsSDKType } from "../../hd/v1/hd"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BIP44Params, BIP44ParamsAmino, BIP44ParamsSDKType } from "../../hd/v1/hd"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** 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; /** local stores the public information about a locally stored key */ - local?: Record_Local; /** ledger stores the public information about a Ledger key */ - ledger?: Record_Ledger; /** Multi does not store any information. */ - multi?: Record_Multi; /** Offline does not store any information. */ - offline?: Record_Offline; } +export interface RecordProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Record"; + value: Uint8Array; +} /** Record is used for representing a key in the keyring. */ - -export interface RecordSDKType { +export interface RecordAmino { /** name represents a name of Record */ - name: string; + name?: string; /** pub_key represents a public key in any format */ - - pub_key?: AnySDKType; + pub_key?: AnyAmino; /** local stores the public information about a locally stored key */ - - local?: Record_LocalSDKType; + local?: Record_LocalAmino; /** ledger stores the public information about a Ledger key */ - - ledger?: Record_LedgerSDKType; + ledger?: Record_LedgerAmino; /** Multi does not store any information. */ - - multi?: Record_MultiSDKType; + multi?: Record_MultiAmino; /** Offline does not store any information. */ - + offline?: Record_OfflineAmino; +} +export interface RecordAminoMsg { + type: "cosmos-sdk/Record"; + value: RecordAmino; +} +/** Record is used for representing a key in the keyring. */ +export interface RecordSDKType { + name: string; + pub_key?: AnySDKType; + local?: Record_LocalSDKType; + ledger?: Record_LedgerSDKType; + multi?: Record_MultiSDKType; offline?: Record_OfflineSDKType; } /** * Item is a keyring item stored in a keyring backend. * Local item */ - export interface Record_Local { privKey?: Any; privKeyType: string; } +export interface Record_LocalProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Local"; + value: Uint8Array; +} +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_LocalAmino { + priv_key?: AnyAmino; + priv_key_type?: string; +} +export interface Record_LocalAminoMsg { + type: "cosmos-sdk/Local"; + value: Record_LocalAmino; +} /** * Item is a keyring item stored in a keyring backend. * Local item */ - export interface Record_LocalSDKType { priv_key?: AnySDKType; priv_key_type: string; } /** Ledger item */ - export interface Record_Ledger { path?: BIP44Params; } +export interface Record_LedgerProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Ledger"; + value: Uint8Array; +} +/** Ledger item */ +export interface Record_LedgerAmino { + path?: BIP44ParamsAmino; +} +export interface Record_LedgerAminoMsg { + type: "cosmos-sdk/Ledger"; + value: Record_LedgerAmino; +} /** Ledger item */ - export interface Record_LedgerSDKType { path?: BIP44ParamsSDKType; } /** Multi item */ - export interface Record_Multi {} +export interface Record_MultiProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Multi"; + value: Uint8Array; +} +/** Multi item */ +export interface Record_MultiAmino {} +export interface Record_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: Record_MultiAmino; +} /** Multi item */ - export interface Record_MultiSDKType {} /** Offline item */ - export interface Record_Offline {} +export interface Record_OfflineProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Offline"; + value: Uint8Array; +} +/** Offline item */ +export interface Record_OfflineAmino {} +export interface Record_OfflineAminoMsg { + type: "cosmos-sdk/Offline"; + value: Record_OfflineAmino; +} /** Offline item */ - export interface Record_OfflineSDKType {} - function createBaseRecord(): Record { return { name: "", @@ -95,79 +138,62 @@ function createBaseRecord(): Record { offline: undefined }; } - export const Record = { - encode(message: Record, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.keyring.v1.Record", + encode(message: Record, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.pubKey !== undefined) { Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); } - if (message.local !== undefined) { Record_Local.encode(message.local, writer.uint32(26).fork()).ldelim(); } - if (message.ledger !== undefined) { Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).ldelim(); } - if (message.multi !== undefined) { Record_Multi.encode(message.multi, writer.uint32(42).fork()).ldelim(); } - if (message.offline !== undefined) { Record_Offline.encode(message.offline, writer.uint32(50).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Record { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.name = reader.string(); break; - case 2: message.pubKey = Any.decode(reader, reader.uint32()); break; - case 3: message.local = Record_Local.decode(reader, reader.uint32()); break; - case 4: message.ledger = Record_Ledger.decode(reader, reader.uint32()); break; - case 5: message.multi = Record_Multi.decode(reader, reader.uint32()); break; - case 6: message.offline = Record_Offline.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Record { + fromPartial(object: Partial): Record { const message = createBaseRecord(); message.name = object.name ?? ""; message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? Any.fromPartial(object.pubKey) : undefined; @@ -176,174 +202,320 @@ export const Record = { 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; + }, + fromAmino(object: RecordAmino): Record { + const message = createBaseRecord(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = Any.fromAmino(object.pub_key); + } + if (object.local !== undefined && object.local !== null) { + message.local = Record_Local.fromAmino(object.local); + } + if (object.ledger !== undefined && object.ledger !== null) { + message.ledger = Record_Ledger.fromAmino(object.ledger); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = Record_Multi.fromAmino(object.multi); + } + if (object.offline !== undefined && object.offline !== null) { + message.offline = Record_Offline.fromAmino(object.offline); + } + return message; + }, + toAmino(message: Record): RecordAmino { + const obj: any = {}; + obj.name = message.name; + obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; + obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; + obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; + obj.multi = message.multi ? Record_Multi.toAmino(message.multi) : undefined; + obj.offline = message.offline ? Record_Offline.toAmino(message.offline) : undefined; + return obj; + }, + fromAminoMsg(object: RecordAminoMsg): Record { + return Record.fromAmino(object.value); + }, + toAminoMsg(message: Record): RecordAminoMsg { + return { + type: "cosmos-sdk/Record", + value: Record.toAmino(message) + }; + }, + fromProtoMsg(message: RecordProtoMsg): Record { + return Record.decode(message.value); + }, + toProto(message: Record): Uint8Array { + return Record.encode(message).finish(); + }, + toProtoMsg(message: Record): RecordProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Record", + value: Record.encode(message).finish() + }; } - }; - function createBaseRecord_Local(): Record_Local { return { privKey: undefined, privKeyType: "" }; } - export const Record_Local = { - encode(message: Record_Local, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.keyring.v1.Local", + encode(message: Record_Local, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.privKey !== undefined) { Any.encode(message.privKey, writer.uint32(10).fork()).ldelim(); } - if (message.privKeyType !== "") { writer.uint32(18).string(message.privKeyType); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Record_Local { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.privKey = Any.decode(reader, reader.uint32()); break; - case 2: message.privKeyType = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Record_Local { + fromPartial(object: Partial): Record_Local { const message = createBaseRecord_Local(); message.privKey = object.privKey !== undefined && object.privKey !== null ? Any.fromPartial(object.privKey) : undefined; message.privKeyType = object.privKeyType ?? ""; return message; + }, + fromAmino(object: Record_LocalAmino): Record_Local { + const message = createBaseRecord_Local(); + if (object.priv_key !== undefined && object.priv_key !== null) { + message.privKey = Any.fromAmino(object.priv_key); + } + if (object.priv_key_type !== undefined && object.priv_key_type !== null) { + message.privKeyType = object.priv_key_type; + } + return message; + }, + toAmino(message: Record_Local): Record_LocalAmino { + const obj: any = {}; + obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; + obj.priv_key_type = message.privKeyType; + return obj; + }, + fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { + return Record_Local.fromAmino(object.value); + }, + toAminoMsg(message: Record_Local): Record_LocalAminoMsg { + return { + type: "cosmos-sdk/Local", + value: Record_Local.toAmino(message) + }; + }, + fromProtoMsg(message: Record_LocalProtoMsg): Record_Local { + return Record_Local.decode(message.value); + }, + toProto(message: Record_Local): Uint8Array { + return Record_Local.encode(message).finish(); + }, + toProtoMsg(message: Record_Local): Record_LocalProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Local", + value: Record_Local.encode(message).finish() + }; } - }; - function createBaseRecord_Ledger(): Record_Ledger { return { path: undefined }; } - export const Record_Ledger = { - encode(message: Record_Ledger, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.keyring.v1.Ledger", + encode(message: Record_Ledger, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path !== undefined) { BIP44Params.encode(message.path, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Record_Ledger { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.path = BIP44Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Record_Ledger { + fromPartial(object: Partial): Record_Ledger { const message = createBaseRecord_Ledger(); message.path = object.path !== undefined && object.path !== null ? BIP44Params.fromPartial(object.path) : undefined; return message; + }, + fromAmino(object: Record_LedgerAmino): Record_Ledger { + const message = createBaseRecord_Ledger(); + if (object.path !== undefined && object.path !== null) { + message.path = BIP44Params.fromAmino(object.path); + } + return message; + }, + toAmino(message: Record_Ledger): Record_LedgerAmino { + const obj: any = {}; + obj.path = message.path ? BIP44Params.toAmino(message.path) : undefined; + return obj; + }, + fromAminoMsg(object: Record_LedgerAminoMsg): Record_Ledger { + return Record_Ledger.fromAmino(object.value); + }, + toAminoMsg(message: Record_Ledger): Record_LedgerAminoMsg { + return { + type: "cosmos-sdk/Ledger", + value: Record_Ledger.toAmino(message) + }; + }, + fromProtoMsg(message: Record_LedgerProtoMsg): Record_Ledger { + return Record_Ledger.decode(message.value); + }, + toProto(message: Record_Ledger): Uint8Array { + return Record_Ledger.encode(message).finish(); + }, + toProtoMsg(message: Record_Ledger): Record_LedgerProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Ledger", + value: Record_Ledger.encode(message).finish() + }; } - }; - function createBaseRecord_Multi(): Record_Multi { return {}; } - export const Record_Multi = { - encode(_: Record_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.keyring.v1.Multi", + encode(_: Record_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Record_Multi { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): Record_Multi { + fromPartial(_: Partial): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, + fromAmino(_: Record_MultiAmino): Record_Multi { const message = createBaseRecord_Multi(); return message; + }, + toAmino(_: Record_Multi): Record_MultiAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: Record_MultiAminoMsg): Record_Multi { + return Record_Multi.fromAmino(object.value); + }, + toAminoMsg(message: Record_Multi): Record_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: Record_Multi.toAmino(message) + }; + }, + fromProtoMsg(message: Record_MultiProtoMsg): Record_Multi { + return Record_Multi.decode(message.value); + }, + toProto(message: Record_Multi): Uint8Array { + return Record_Multi.encode(message).finish(); + }, + toProtoMsg(message: Record_Multi): Record_MultiProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Multi", + value: Record_Multi.encode(message).finish() + }; } - }; - function createBaseRecord_Offline(): Record_Offline { return {}; } - export const Record_Offline = { - encode(_: Record_Offline, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.keyring.v1.Offline", + encode(_: Record_Offline, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Record_Offline { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): Record_Offline { + fromPartial(_: Partial): Record_Offline { const message = createBaseRecord_Offline(); return message; + }, + fromAmino(_: Record_OfflineAmino): Record_Offline { + const message = createBaseRecord_Offline(); + return message; + }, + toAmino(_: Record_Offline): Record_OfflineAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: Record_OfflineAminoMsg): Record_Offline { + return Record_Offline.fromAmino(object.value); + }, + toAminoMsg(message: Record_Offline): Record_OfflineAminoMsg { + return { + type: "cosmos-sdk/Offline", + value: Record_Offline.toAmino(message) + }; + }, + fromProtoMsg(message: Record_OfflineProtoMsg): Record_Offline { + return Record_Offline.decode(message.value); + }, + toProto(message: Record_Offline): Uint8Array { + return Record_Offline.encode(message).finish(); + }, + toProtoMsg(message: Record_Offline): Record_OfflineProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Offline", + value: Record_Offline.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/crypto/multisig/keys.ts b/src/codegen/cosmos/crypto/multisig/keys.ts index 7a63e06..896ee48 100644 --- a/src/codegen/cosmos/crypto/multisig/keys.ts +++ b/src/codegen/cosmos/crypto/multisig/keys.ts @@ -1,78 +1,120 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * 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[]; } +export interface LegacyAminoPubKeyProtoMsg { + typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey"; + value: Uint8Array; +} +/** + * LegacyAminoPubKey specifies a public key type + * which nests multiple public keys and a threshold, + * it uses legacy amino address rules. + */ +export interface LegacyAminoPubKeyAmino { + threshold?: number; + public_keys?: AnyAmino[]; +} +export interface LegacyAminoPubKeyAminoMsg { + type: "cosmos-sdk/LegacyAminoPubKey"; + value: LegacyAminoPubKeyAmino; +} /** * LegacyAminoPubKey specifies a public key type * which nests multiple public keys and a threshold, * it uses legacy amino address rules. */ - export interface LegacyAminoPubKeySDKType { threshold: number; public_keys: AnySDKType[]; } - function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { return { threshold: 0, publicKeys: [] }; } - export const LegacyAminoPubKey = { - encode(message: LegacyAminoPubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", + encode(message: LegacyAminoPubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.threshold !== 0) { writer.uint32(8).uint32(message.threshold); } - for (const v of message.publicKeys) { Any.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): LegacyAminoPubKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.threshold = reader.uint32(); break; - case 2: message.publicKeys.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): LegacyAminoPubKey { + fromPartial(object: Partial): LegacyAminoPubKey { const message = createBaseLegacyAminoPubKey(); message.threshold = object.threshold ?? 0; message.publicKeys = object.publicKeys?.map(e => Any.fromPartial(e)) || []; return message; + }, + fromAmino(object: LegacyAminoPubKeyAmino): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + message.publicKeys = object.public_keys?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { + const obj: any = {}; + obj.threshold = message.threshold; + if (message.publicKeys) { + obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.public_keys = []; + } + return obj; + }, + fromAminoMsg(object: LegacyAminoPubKeyAminoMsg): LegacyAminoPubKey { + return LegacyAminoPubKey.fromAmino(object.value); + }, + toAminoMsg(message: LegacyAminoPubKey): LegacyAminoPubKeyAminoMsg { + return { + type: "cosmos-sdk/LegacyAminoPubKey", + value: LegacyAminoPubKey.toAmino(message) + }; + }, + fromProtoMsg(message: LegacyAminoPubKeyProtoMsg): LegacyAminoPubKey { + return LegacyAminoPubKey.decode(message.value); + }, + toProto(message: LegacyAminoPubKey): Uint8Array { + return LegacyAminoPubKey.encode(message).finish(); + }, + toProtoMsg(message: LegacyAminoPubKey): LegacyAminoPubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", + value: LegacyAminoPubKey.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/crypto/multisig/v1beta1/multisig.ts b/src/codegen/cosmos/crypto/multisig/v1beta1/multisig.ts index 3a6e570..ef28ae1 100644 --- a/src/codegen/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/src/codegen/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -1,20 +1,34 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers * signed and with which modes. */ - export interface MultiSignature { signatures: Uint8Array[]; } +export interface MultiSignatureProtoMsg { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature"; + value: Uint8Array; +} +/** + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. + */ +export interface MultiSignatureAmino { + signatures?: string[]; +} +export interface MultiSignatureAminoMsg { + type: "cosmos-sdk/MultiSignature"; + value: MultiSignatureAmino; +} /** * 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 MultiSignatureSDKType { signatures: Uint8Array[]; } @@ -24,119 +38,187 @@ export interface MultiSignatureSDKType { * space after proto encoding. * This is not thread safe, and is not intended for concurrent usage. */ - export interface CompactBitArray { extraBitsStored: number; elems: Uint8Array; } +export interface CompactBitArrayProtoMsg { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray"; + value: Uint8Array; +} +/** + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. + */ +export interface CompactBitArrayAmino { + extra_bits_stored?: number; + elems?: string; +} +export interface CompactBitArrayAminoMsg { + type: "cosmos-sdk/CompactBitArray"; + value: CompactBitArrayAmino; +} /** * 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 CompactBitArraySDKType { extra_bits_stored: number; elems: Uint8Array; } - function createBaseMultiSignature(): MultiSignature { return { signatures: [] }; } - export const MultiSignature = { - encode(message: MultiSignature, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", + encode(message: MultiSignature, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signatures) { writer.uint32(10).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MultiSignature { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMultiSignature(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signatures.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MultiSignature { + fromPartial(object: Partial): MultiSignature { const message = createBaseMultiSignature(); message.signatures = object.signatures?.map(e => e) || []; return message; + }, + fromAmino(object: MultiSignatureAmino): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MultiSignature): MultiSignatureAmino { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: MultiSignatureAminoMsg): MultiSignature { + return MultiSignature.fromAmino(object.value); + }, + toAminoMsg(message: MultiSignature): MultiSignatureAminoMsg { + return { + type: "cosmos-sdk/MultiSignature", + value: MultiSignature.toAmino(message) + }; + }, + fromProtoMsg(message: MultiSignatureProtoMsg): MultiSignature { + return MultiSignature.decode(message.value); + }, + toProto(message: MultiSignature): Uint8Array { + return MultiSignature.encode(message).finish(); + }, + toProtoMsg(message: MultiSignature): MultiSignatureProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", + value: MultiSignature.encode(message).finish() + }; } - }; - function createBaseCompactBitArray(): CompactBitArray { return { extraBitsStored: 0, elems: new Uint8Array() }; } - export const CompactBitArray = { - encode(message: CompactBitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", + encode(message: CompactBitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.extraBitsStored !== 0) { writer.uint32(8).uint32(message.extraBitsStored); } - if (message.elems.length !== 0) { writer.uint32(18).bytes(message.elems); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CompactBitArray { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCompactBitArray(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.extraBitsStored = reader.uint32(); break; - case 2: message.elems = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CompactBitArray { + fromPartial(object: Partial): CompactBitArray { const message = createBaseCompactBitArray(); message.extraBitsStored = object.extraBitsStored ?? 0; message.elems = object.elems ?? new Uint8Array(); return message; + }, + fromAmino(object: CompactBitArrayAmino): CompactBitArray { + const message = createBaseCompactBitArray(); + if (object.extra_bits_stored !== undefined && object.extra_bits_stored !== null) { + message.extraBitsStored = object.extra_bits_stored; + } + if (object.elems !== undefined && object.elems !== null) { + message.elems = bytesFromBase64(object.elems); + } + return message; + }, + toAmino(message: CompactBitArray): CompactBitArrayAmino { + const obj: any = {}; + obj.extra_bits_stored = message.extraBitsStored; + obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; + return obj; + }, + fromAminoMsg(object: CompactBitArrayAminoMsg): CompactBitArray { + return CompactBitArray.fromAmino(object.value); + }, + toAminoMsg(message: CompactBitArray): CompactBitArrayAminoMsg { + return { + type: "cosmos-sdk/CompactBitArray", + value: CompactBitArray.toAmino(message) + }; + }, + fromProtoMsg(message: CompactBitArrayProtoMsg): CompactBitArray { + return CompactBitArray.decode(message.value); + }, + toProto(message: CompactBitArray): Uint8Array { + return CompactBitArray.encode(message).finish(); + }, + toProtoMsg(message: CompactBitArray): CompactBitArrayProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", + value: CompactBitArray.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/crypto/secp256k1/keys.ts b/src/codegen/cosmos/crypto/secp256k1/keys.ts index 576b262..1451cc8 100644 --- a/src/codegen/cosmos/crypto/secp256k1/keys.ts +++ b/src/codegen/cosmos/crypto/secp256k1/keys.ts @@ -1,5 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** * PubKey defines a secp256k1 public key * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte @@ -7,10 +7,27 @@ import { DeepPartial } from "../../../helpers"; * the x-coordinate. Otherwise the first byte is a 0x03. * This prefix is followed with the x-coordinate. */ - export interface PubKey { key: Uint8Array; } +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256k1.PubKey"; + value: Uint8Array; +} +/** + * PubKey defines a secp256k1 public key + * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte + * if the y-coordinate is the lexicographically largest of the two associated with + * the x-coordinate. Otherwise the first byte is a 0x03. + * This prefix is followed with the x-coordinate. + */ +export interface PubKeyAmino { + key?: string; +} +export interface PubKeyAminoMsg { + type: "cosmos-sdk/PubKey"; + value: PubKeyAmino; +} /** * PubKey defines a secp256k1 public key * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte @@ -18,107 +35,164 @@ export interface PubKey { * the x-coordinate. Otherwise the first byte is a 0x03. * This prefix is followed with the x-coordinate. */ - export interface PubKeySDKType { key: Uint8Array; } /** PrivKey defines a secp256k1 private key. */ - export interface PrivKey { key: Uint8Array; } +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey"; + value: Uint8Array; +} +/** PrivKey defines a secp256k1 private key. */ +export interface PrivKeyAmino { + key?: string; +} +export interface PrivKeyAminoMsg { + type: "cosmos-sdk/PrivKey"; + value: PrivKeyAmino; +} /** PrivKey defines a secp256k1 private key. */ - export interface PrivKeySDKType { key: Uint8Array; } - function createBasePubKey(): PubKey { return { key: new Uint8Array() }; } - export const PubKey = { - encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePubKey(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PubKey { + fromPartial(object: Partial): PubKey { const message = createBasePubKey(); message.key = object.key ?? new Uint8Array(); return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "cosmos-sdk/PubKey", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: PubKey.encode(message).finish() + }; } - }; - function createBasePrivKey(): PrivKey { return { key: new Uint8Array() }; } - export const PrivKey = { - encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey", + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePrivKey(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PrivKey { + fromPartial(object: Partial): PrivKey { const message = createBasePrivKey(); message.key = object.key ?? new Uint8Array(); return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "cosmos-sdk/PrivKey", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey", + value: PrivKey.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/crypto/secp256r1/keys.ts b/src/codegen/cosmos/crypto/secp256r1/keys.ts index 300d411..ae95f61 100644 --- a/src/codegen/cosmos/crypto/secp256r1/keys.ts +++ b/src/codegen/cosmos/crypto/secp256r1/keys.ts @@ -1,7 +1,6 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** PubKey defines a secp256r1 ECDSA public key. */ - export interface PubKey { /** * Point on secp256r1 curve in a compressed representation as specified in section @@ -9,114 +8,183 @@ export interface PubKey { */ key: Uint8Array; } +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256r1.PubKey"; + value: Uint8Array; +} /** PubKey defines a secp256r1 ECDSA public key. */ - -export interface PubKeySDKType { +export interface PubKeyAmino { /** * Point on secp256r1 curve in a compressed representation as specified in section * 4.3.6 of ANSI X9.62: https://webstore.ansi.org/standards/ascx9/ansix9621998 */ + key?: string; +} +export interface PubKeyAminoMsg { + type: "cosmos-sdk/PubKey"; + value: PubKeyAmino; +} +/** PubKey defines a secp256r1 ECDSA public key. */ +export interface PubKeySDKType { key: Uint8Array; } /** PrivKey defines a secp256r1 ECDSA private key. */ - export interface PrivKey { /** secret number serialized using big-endian encoding */ secret: Uint8Array; } +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey"; + value: Uint8Array; +} /** PrivKey defines a secp256r1 ECDSA private key. */ - -export interface PrivKeySDKType { +export interface PrivKeyAmino { /** secret number serialized using big-endian encoding */ + secret?: string; +} +export interface PrivKeyAminoMsg { + type: "cosmos-sdk/PrivKey"; + value: PrivKeyAmino; +} +/** PrivKey defines a secp256r1 ECDSA private key. */ +export interface PrivKeySDKType { secret: Uint8Array; } - function createBasePubKey(): PubKey { return { key: new Uint8Array() }; } - export const PubKey = { - encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.secp256r1.PubKey", + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePubKey(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PubKey { + fromPartial(object: Partial): PubKey { const message = createBasePubKey(); message.key = object.key ?? new Uint8Array(); return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "cosmos-sdk/PubKey", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256r1.PubKey", + value: PubKey.encode(message).finish() + }; } - }; - function createBasePrivKey(): PrivKey { return { secret: new Uint8Array() }; } - export const PrivKey = { - encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey", + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.secret.length !== 0) { writer.uint32(10).bytes(message.secret); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePrivKey(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.secret = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PrivKey { + fromPartial(object: Partial): PrivKey { const message = createBasePrivKey(); message.secret = object.secret ?? new Uint8Array(); return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.secret !== undefined && object.secret !== null) { + message.secret = bytesFromBase64(object.secret); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.secret = message.secret ? base64FromBytes(message.secret) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "cosmos-sdk/PrivKey", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey", + value: PrivKey.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/distribution.ts b/src/codegen/cosmos/distribution/v1beta1/distribution.ts index 8cdec79..c113810 100644 --- a/src/codegen/cosmos/distribution/v1beta1/distribution.ts +++ b/src/codegen/cosmos/distribution/v1beta1/distribution.ts @@ -1,16 +1,29 @@ -import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; /** Params defines the set of params for the distribution module. */ - export interface Params { communityTax: string; baseProposerReward: string; bonusProposerReward: string; withdrawAddrEnabled: boolean; } +export interface ParamsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the set of params for the distribution module. */ +export interface ParamsAmino { + community_tax?: string; + base_proposer_reward?: string; + bonus_proposer_reward?: string; + withdraw_addr_enabled?: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} /** Params defines the set of params for the distribution module. */ - export interface ParamsSDKType { community_tax: string; base_proposer_reward: string; @@ -31,11 +44,36 @@ export interface ParamsSDKType { * read that record) * + one per validator for the zeroeth period, set on initialization */ - export interface ValidatorHistoricalRewards { cumulativeRewardRatio: DecCoin[]; referenceCount: number; } +export interface ValidatorHistoricalRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards"; + value: Uint8Array; +} +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewardsAmino { + cumulative_reward_ratio?: DecCoinAmino[]; + reference_count?: number; +} +export interface ValidatorHistoricalRewardsAminoMsg { + type: "cosmos-sdk/ValidatorHistoricalRewards"; + value: ValidatorHistoricalRewardsAmino; +} /** * ValidatorHistoricalRewards represents historical rewards for a validator. * Height is implicit within the store key. @@ -50,7 +88,6 @@ export interface ValidatorHistoricalRewards { * read that record) * + one per validator for the zeroeth period, set on initialization */ - export interface ValidatorHistoricalRewardsSDKType { cumulative_reward_ratio: DecCoinSDKType[]; reference_count: number; @@ -60,34 +97,62 @@ export interface ValidatorHistoricalRewardsSDKType { * 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: Long; + period: bigint; +} +export interface ValidatorCurrentRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards"; + value: Uint8Array; +} +/** + * ValidatorCurrentRewards represents current rewards and current + * period for a validator kept as a running counter and incremented + * each block as long as the validator's tokens remain constant. + */ +export interface ValidatorCurrentRewardsAmino { + rewards?: DecCoinAmino[]; + period?: string; +} +export interface ValidatorCurrentRewardsAminoMsg { + type: "cosmos-sdk/ValidatorCurrentRewards"; + value: ValidatorCurrentRewardsAmino; } /** * 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 ValidatorCurrentRewardsSDKType { rewards: DecCoinSDKType[]; - period: Long; + period: bigint; } /** * ValidatorAccumulatedCommission represents accumulated commission * for a validator kept as a running counter, can be withdrawn at any time. */ - export interface ValidatorAccumulatedCommission { commission: DecCoin[]; } +export interface ValidatorAccumulatedCommissionProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission"; + value: Uint8Array; +} +/** + * ValidatorAccumulatedCommission represents accumulated commission + * for a validator kept as a running counter, can be withdrawn at any time. + */ +export interface ValidatorAccumulatedCommissionAmino { + commission?: DecCoinAmino[]; +} +export interface ValidatorAccumulatedCommissionAminoMsg { + type: "cosmos-sdk/ValidatorAccumulatedCommission"; + value: ValidatorAccumulatedCommissionAmino; +} /** * ValidatorAccumulatedCommission represents accumulated commission * for a validator kept as a running counter, can be withdrawn at any time. */ - export interface ValidatorAccumulatedCommissionSDKType { commission: DecCoinSDKType[]; } @@ -95,15 +160,28 @@ export interface ValidatorAccumulatedCommissionSDKType { * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards * for a validator inexpensive to track, allows simple sanity checks. */ - export interface ValidatorOutstandingRewards { rewards: DecCoin[]; } +export interface ValidatorOutstandingRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards"; + value: Uint8Array; +} +/** + * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards + * for a validator inexpensive to track, allows simple sanity checks. + */ +export interface ValidatorOutstandingRewardsAmino { + rewards?: DecCoinAmino[]; +} +export interface ValidatorOutstandingRewardsAminoMsg { + type: "cosmos-sdk/ValidatorOutstandingRewards"; + value: ValidatorOutstandingRewardsAmino; +} /** * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards * for a validator inexpensive to track, allows simple sanity checks. */ - export interface ValidatorOutstandingRewardsSDKType { rewards: DecCoinSDKType[]; } @@ -113,39 +191,75 @@ export interface ValidatorOutstandingRewardsSDKType { * This is needed to calculate appropriate amount of staking tokens * for delegations which are withdrawn after a slash has occurred. */ - export interface ValidatorSlashEvent { - validatorPeriod: Long; + validatorPeriod: bigint; fraction: string; } +export interface ValidatorSlashEventProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent"; + value: Uint8Array; +} +/** + * ValidatorSlashEvent represents a validator slash event. + * Height is implicit within the store key. + * This is needed to calculate appropriate amount of staking tokens + * for delegations which are withdrawn after a slash has occurred. + */ +export interface ValidatorSlashEventAmino { + validator_period?: string; + fraction?: string; +} +export interface ValidatorSlashEventAminoMsg { + type: "cosmos-sdk/ValidatorSlashEvent"; + value: ValidatorSlashEventAmino; +} /** * 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 ValidatorSlashEventSDKType { - validator_period: Long; + validator_period: bigint; fraction: string; } /** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ - export interface ValidatorSlashEvents { validatorSlashEvents: ValidatorSlashEvent[]; } +export interface ValidatorSlashEventsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents"; + value: Uint8Array; +} +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEventsAmino { + validator_slash_events?: ValidatorSlashEventAmino[]; +} +export interface ValidatorSlashEventsAminoMsg { + type: "cosmos-sdk/ValidatorSlashEvents"; + value: ValidatorSlashEventsAmino; +} /** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ - export interface ValidatorSlashEventsSDKType { validator_slash_events: ValidatorSlashEventSDKType[]; } /** FeePool is the global fee pool for distribution. */ - export interface FeePool { communityPool: DecCoin[]; } +export interface FeePoolProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.FeePool"; + value: Uint8Array; +} +/** FeePool is the global fee pool for distribution. */ +export interface FeePoolAmino { + community_pool?: DecCoinAmino[]; +} +export interface FeePoolAminoMsg { + type: "cosmos-sdk/FeePool"; + value: FeePoolAmino; +} /** FeePool is the global fee pool for distribution. */ - export interface FeePoolSDKType { community_pool: DecCoinSDKType[]; } @@ -154,19 +268,36 @@ export interface FeePoolSDKType { * together with how many coins are proposed to be spent, and to which * recipient account. */ - export interface CommunityPoolSpendProposal { title: string; description: string; recipient: string; amount: Coin[]; } +export interface CommunityPoolSpendProposalProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal"; + value: Uint8Array; +} +/** + * CommunityPoolSpendProposal details a proposal for use of community funds, + * together with how many coins are proposed to be spent, and to which + * recipient account. + */ +export interface CommunityPoolSpendProposalAmino { + title?: string; + description?: string; + recipient?: string; + amount?: CoinAmino[]; +} +export interface CommunityPoolSpendProposalAminoMsg { + type: "cosmos-sdk/CommunityPoolSpendProposal"; + value: CommunityPoolSpendProposalAmino; +} /** * CommunityPoolSpendProposal details a proposal for use of community funds, * together with how many coins are proposed to be spent, and to which * recipient account. */ - export interface CommunityPoolSpendProposalSDKType { title: string; description: string; @@ -181,11 +312,31 @@ export interface CommunityPoolSpendProposalSDKType { * the delegators within the validator may be left with less than a full token, * thus sdk.Dec is used. */ - export interface DelegatorStartingInfo { - previousPeriod: Long; + previousPeriod: bigint; stake: string; - height: Long; + height: bigint; +} +export interface DelegatorStartingInfoProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo"; + value: Uint8Array; +} +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfoAmino { + previous_period?: string; + stake?: string; + height?: string; +} +export interface DelegatorStartingInfoAminoMsg { + type: "cosmos-sdk/DelegatorStartingInfo"; + value: DelegatorStartingInfoAmino; } /** * DelegatorStartingInfo represents the starting info for a delegator reward @@ -195,26 +346,39 @@ export interface DelegatorStartingInfo { * the delegators within the validator may be left with less than a full token, * thus sdk.Dec is used. */ - export interface DelegatorStartingInfoSDKType { - previous_period: Long; + previous_period: bigint; stake: string; - height: Long; + height: bigint; } /** * DelegationDelegatorReward represents the properties * of a delegator's delegation reward. */ - export interface DelegationDelegatorReward { validatorAddress: string; reward: DecCoin[]; } +export interface DelegationDelegatorRewardProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward"; + value: Uint8Array; +} +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorRewardAmino { + validator_address?: string; + reward?: DecCoinAmino[]; +} +export interface DelegationDelegatorRewardAminoMsg { + type: "cosmos-sdk/DelegationDelegatorReward"; + value: DelegationDelegatorRewardAmino; +} /** * DelegationDelegatorReward represents the properties * of a delegator's delegation reward. */ - export interface DelegationDelegatorRewardSDKType { validator_address: string; reward: DecCoinSDKType[]; @@ -223,7 +387,6 @@ export interface DelegationDelegatorRewardSDKType { * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal * with a deposit */ - export interface CommunityPoolSpendProposalWithDeposit { title: string; description: string; @@ -231,11 +394,29 @@ export interface CommunityPoolSpendProposalWithDeposit { amount: string; deposit: string; } +export interface CommunityPoolSpendProposalWithDepositProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit"; + value: Uint8Array; +} +/** + * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal + * with a deposit + */ +export interface CommunityPoolSpendProposalWithDepositAmino { + title?: string; + description?: string; + recipient?: string; + amount?: string; + deposit?: string; +} +export interface CommunityPoolSpendProposalWithDepositAminoMsg { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit"; + value: CommunityPoolSpendProposalWithDepositAmino; +} /** * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal * with a deposit */ - export interface CommunityPoolSpendProposalWithDepositSDKType { title: string; description: string; @@ -243,7 +424,6 @@ export interface CommunityPoolSpendProposalWithDepositSDKType { amount: string; deposit: string; } - function createBaseParams(): Params { return { communityTax: "", @@ -252,418 +432,634 @@ function createBaseParams(): Params { withdrawAddrEnabled: false }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.communityTax !== "") { - writer.uint32(10).string(message.communityTax); + writer.uint32(10).string(Decimal.fromUserInput(message.communityTax, 18).atomics); } - if (message.baseProposerReward !== "") { - writer.uint32(18).string(message.baseProposerReward); + writer.uint32(18).string(Decimal.fromUserInput(message.baseProposerReward, 18).atomics); } - if (message.bonusProposerReward !== "") { - writer.uint32(26).string(message.bonusProposerReward); + writer.uint32(26).string(Decimal.fromUserInput(message.bonusProposerReward, 18).atomics); } - 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.communityTax = reader.string(); + message.communityTax = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 2: - message.baseProposerReward = reader.string(); + message.baseProposerReward = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 3: - message.bonusProposerReward = reader.string(); + message.bonusProposerReward = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 4: message.withdrawAddrEnabled = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); message.communityTax = object.communityTax ?? ""; message.baseProposerReward = object.baseProposerReward ?? ""; message.bonusProposerReward = object.bonusProposerReward ?? ""; message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.community_tax !== undefined && object.community_tax !== null) { + message.communityTax = object.community_tax; + } + if (object.base_proposer_reward !== undefined && object.base_proposer_reward !== null) { + message.baseProposerReward = object.base_proposer_reward; + } + if (object.bonus_proposer_reward !== undefined && object.bonus_proposer_reward !== null) { + message.bonusProposerReward = object.bonus_proposer_reward; + } + if (object.withdraw_addr_enabled !== undefined && object.withdraw_addr_enabled !== null) { + message.withdrawAddrEnabled = object.withdraw_addr_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.community_tax = message.communityTax; + obj.base_proposer_reward = message.baseProposerReward; + obj.bonus_proposer_reward = message.bonusProposerReward; + obj.withdraw_addr_enabled = message.withdrawAddrEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.Params", + value: Params.encode(message).finish() + }; } - }; - function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { return { cumulativeRewardRatio: [], referenceCount: 0 }; } - export const ValidatorHistoricalRewards = { - encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.cumulativeRewardRatio) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.referenceCount !== 0) { writer.uint32(16).uint32(message.referenceCount); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorHistoricalRewards(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); break; - case 2: message.referenceCount = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorHistoricalRewards { + fromPartial(object: Partial): ValidatorHistoricalRewards { const message = createBaseValidatorHistoricalRewards(); message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map(e => DecCoin.fromPartial(e)) || []; message.referenceCount = object.referenceCount ?? 0; return message; + }, + fromAmino(object: ValidatorHistoricalRewardsAmino): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulative_reward_ratio?.map(e => DecCoin.fromAmino(e)) || []; + if (object.reference_count !== undefined && object.reference_count !== null) { + message.referenceCount = object.reference_count; + } + return message; + }, + toAmino(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsAmino { + const obj: any = {}; + if (message.cumulativeRewardRatio) { + obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.cumulative_reward_ratio = []; + } + obj.reference_count = message.referenceCount; + return obj; + }, + fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorHistoricalRewards", + value: ValidatorHistoricalRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorHistoricalRewardsProtoMsg): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.decode(message.value); + }, + toProto(message: ValidatorHistoricalRewards): Uint8Array { + return ValidatorHistoricalRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", + value: ValidatorHistoricalRewards.encode(message).finish() + }; } - }; - function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { return { rewards: [], - period: Long.UZERO + period: BigInt(0) }; } - export const ValidatorCurrentRewards = { - encode(message: ValidatorCurrentRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - - if (!message.period.isZero()) { + if (message.period !== BigInt(0)) { writer.uint32(16).uint64(message.period); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorCurrentRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorCurrentRewards(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.rewards.push(DecCoin.decode(reader, reader.uint32())); break; - case 2: - message.period = (reader.uint64() as Long); + message.period = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorCurrentRewards { + fromPartial(object: Partial): ValidatorCurrentRewards { const message = createBaseValidatorCurrentRewards(); message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; - message.period = object.period !== undefined && object.period !== null ? Long.fromValue(object.period) : Long.UZERO; + message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorCurrentRewardsAmino): ValidatorCurrentRewards { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period); + } return message; + }, + toAmino(message: ValidatorCurrentRewards): ValidatorCurrentRewardsAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = []; + } + obj.period = message.period ? message.period.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorCurrentRewards): ValidatorCurrentRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorCurrentRewards", + value: ValidatorCurrentRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorCurrentRewardsProtoMsg): ValidatorCurrentRewards { + return ValidatorCurrentRewards.decode(message.value); + }, + toProto(message: ValidatorCurrentRewards): Uint8Array { + return ValidatorCurrentRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorCurrentRewards): ValidatorCurrentRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", + value: ValidatorCurrentRewards.encode(message).finish() + }; } - }; - function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommission { return { commission: [] }; } - export const ValidatorAccumulatedCommission = { - encode(message: ValidatorAccumulatedCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.commission) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorAccumulatedCommission { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorAccumulatedCommission(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.commission.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorAccumulatedCommission { + fromPartial(object: Partial): ValidatorAccumulatedCommission { const message = createBaseValidatorAccumulatedCommission(); message.commission = object.commission?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: ValidatorAccumulatedCommissionAmino): ValidatorAccumulatedCommission { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionAmino { + const obj: any = {}; + if (message.commission) { + obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.commission = []; + } + return obj; + }, + fromAminoMsg(object: ValidatorAccumulatedCommissionAminoMsg): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionAminoMsg { + return { + type: "cosmos-sdk/ValidatorAccumulatedCommission", + value: ValidatorAccumulatedCommission.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorAccumulatedCommissionProtoMsg): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.decode(message.value); + }, + toProto(message: ValidatorAccumulatedCommission): Uint8Array { + return ValidatorAccumulatedCommission.encode(message).finish(); + }, + toProtoMsg(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", + value: ValidatorAccumulatedCommission.encode(message).finish() + }; } - }; - function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { return { rewards: [] }; } - export const ValidatorOutstandingRewards = { - encode(message: ValidatorOutstandingRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorOutstandingRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorOutstandingRewards(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.rewards.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorOutstandingRewards { + fromPartial(object: Partial): ValidatorOutstandingRewards { const message = createBaseValidatorOutstandingRewards(); message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: ValidatorOutstandingRewardsAmino): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + fromAminoMsg(object: ValidatorOutstandingRewardsAminoMsg): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorOutstandingRewards", + value: ValidatorOutstandingRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorOutstandingRewardsProtoMsg): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.decode(message.value); + }, + toProto(message: ValidatorOutstandingRewards): Uint8Array { + return ValidatorOutstandingRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", + value: ValidatorOutstandingRewards.encode(message).finish() + }; } - }; - function createBaseValidatorSlashEvent(): ValidatorSlashEvent { return { - validatorPeriod: Long.UZERO, + validatorPeriod: BigInt(0), fraction: "" }; } - export const ValidatorSlashEvent = { - encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.validatorPeriod.isZero()) { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", + encode(message: ValidatorSlashEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorPeriod !== BigInt(0)) { writer.uint32(8).uint64(message.validatorPeriod); } - if (message.fraction !== "") { - writer.uint32(18).string(message.fraction); + writer.uint32(18).string(Decimal.fromUserInput(message.fraction, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEvent { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorSlashEvent(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.validatorPeriod = (reader.uint64() as Long); + message.validatorPeriod = reader.uint64(); break; - case 2: - message.fraction = reader.string(); + message.fraction = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorSlashEvent { + fromPartial(object: Partial): ValidatorSlashEvent { const message = createBaseValidatorSlashEvent(); - message.validatorPeriod = object.validatorPeriod !== undefined && object.validatorPeriod !== null ? Long.fromValue(object.validatorPeriod) : Long.UZERO; + message.validatorPeriod = object.validatorPeriod !== undefined && object.validatorPeriod !== null ? BigInt(object.validatorPeriod.toString()) : BigInt(0); message.fraction = object.fraction ?? ""; return message; + }, + fromAmino(object: ValidatorSlashEventAmino): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + if (object.validator_period !== undefined && object.validator_period !== null) { + message.validatorPeriod = BigInt(object.validator_period); + } + if (object.fraction !== undefined && object.fraction !== null) { + message.fraction = object.fraction; + } + return message; + }, + toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { + const obj: any = {}; + obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.fraction = message.fraction; + return obj; + }, + fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { + return ValidatorSlashEvent.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSlashEvent): ValidatorSlashEventAminoMsg { + return { + type: "cosmos-sdk/ValidatorSlashEvent", + value: ValidatorSlashEvent.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSlashEventProtoMsg): ValidatorSlashEvent { + return ValidatorSlashEvent.decode(message.value); + }, + toProto(message: ValidatorSlashEvent): Uint8Array { + return ValidatorSlashEvent.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSlashEvent): ValidatorSlashEventProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", + value: ValidatorSlashEvent.encode(message).finish() + }; } - }; - function createBaseValidatorSlashEvents(): ValidatorSlashEvents { return { validatorSlashEvents: [] }; } - export const ValidatorSlashEvents = { - encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", + encode(message: ValidatorSlashEvents, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validatorSlashEvents) { ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEvents { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorSlashEvents(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorSlashEvents { + fromPartial(object: Partial): ValidatorSlashEvents { const message = createBaseValidatorSlashEvents(); message.validatorSlashEvents = object.validatorSlashEvents?.map(e => ValidatorSlashEvent.fromPartial(e)) || []; return message; + }, + fromAmino(object: ValidatorSlashEventsAmino): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validator_slash_events?.map(e => ValidatorSlashEvent.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorSlashEvents): ValidatorSlashEventsAmino { + const obj: any = {}; + if (message.validatorSlashEvents) { + obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); + } else { + obj.validator_slash_events = []; + } + return obj; + }, + fromAminoMsg(object: ValidatorSlashEventsAminoMsg): ValidatorSlashEvents { + return ValidatorSlashEvents.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSlashEvents): ValidatorSlashEventsAminoMsg { + return { + type: "cosmos-sdk/ValidatorSlashEvents", + value: ValidatorSlashEvents.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSlashEventsProtoMsg): ValidatorSlashEvents { + return ValidatorSlashEvents.decode(message.value); + }, + toProto(message: ValidatorSlashEvents): Uint8Array { + return ValidatorSlashEvents.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSlashEvents): ValidatorSlashEventsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", + value: ValidatorSlashEvents.encode(message).finish() + }; } - }; - function createBaseFeePool(): FeePool { return { communityPool: [] }; } - export const FeePool = { - encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.FeePool", + encode(message: FeePool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.communityPool) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FeePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFeePool(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.communityPool.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): FeePool { + fromPartial(object: Partial): FeePool { const message = createBaseFeePool(); message.communityPool = object.communityPool?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: FeePoolAmino): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.community_pool?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: FeePool): FeePoolAmino { + const obj: any = {}; + if (message.communityPool) { + obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.community_pool = []; + } + return obj; + }, + fromAminoMsg(object: FeePoolAminoMsg): FeePool { + return FeePool.fromAmino(object.value); + }, + toAminoMsg(message: FeePool): FeePoolAminoMsg { + return { + type: "cosmos-sdk/FeePool", + value: FeePool.toAmino(message) + }; + }, + fromProtoMsg(message: FeePoolProtoMsg): FeePool { + return FeePool.decode(message.value); + }, + toProto(message: FeePool): Uint8Array { + return FeePool.encode(message).finish(); + }, + toProtoMsg(message: FeePool): FeePoolProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.FeePool", + value: FeePool.encode(message).finish() + }; } - }; - function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { return { title: "", @@ -672,193 +1068,281 @@ function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { amount: [] }; } - export const CommunityPoolSpendProposal = { - encode(message: CommunityPoolSpendProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.recipient !== "") { writer.uint32(26).string(message.recipient); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CommunityPoolSpendProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommunityPoolSpendProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.title = reader.string(); break; - case 2: message.description = reader.string(); break; - case 3: message.recipient = reader.string(); break; - case 4: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CommunityPoolSpendProposal { + fromPartial(object: Partial): CommunityPoolSpendProposal { const message = createBaseCommunityPoolSpendProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; message.recipient = object.recipient ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: CommunityPoolSpendProposalAmino): CommunityPoolSpendProposal { + const message = createBaseCommunityPoolSpendProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + obj.recipient = message.recipient; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: CommunityPoolSpendProposalAminoMsg): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromAmino(object.value); + }, + toAminoMsg(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAminoMsg { + return { + type: "cosmos-sdk/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(message) + }; + }, + fromProtoMsg(message: CommunityPoolSpendProposalProtoMsg): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.decode(message.value); + }, + toProto(message: CommunityPoolSpendProposal): Uint8Array { + return CommunityPoolSpendProposal.encode(message).finish(); + }, + toProtoMsg(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(message).finish() + }; } - }; - function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { return { - previousPeriod: Long.UZERO, + previousPeriod: BigInt(0), stake: "", - height: Long.UZERO + height: BigInt(0) }; } - export const DelegatorStartingInfo = { - encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.previousPeriod.isZero()) { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", + encode(message: DelegatorStartingInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.previousPeriod !== BigInt(0)) { writer.uint32(8).uint64(message.previousPeriod); } - if (message.stake !== "") { - writer.uint32(18).string(message.stake); + writer.uint32(18).string(Decimal.fromUserInput(message.stake, 18).atomics); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(24).uint64(message.height); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDelegatorStartingInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.previousPeriod = (reader.uint64() as Long); + message.previousPeriod = reader.uint64(); break; - case 2: - message.stake = reader.string(); + message.stake = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 3: - message.height = (reader.uint64() as Long); + message.height = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DelegatorStartingInfo { + fromPartial(object: Partial): DelegatorStartingInfo { const message = createBaseDelegatorStartingInfo(); - message.previousPeriod = object.previousPeriod !== undefined && object.previousPeriod !== null ? Long.fromValue(object.previousPeriod) : Long.UZERO; + message.previousPeriod = object.previousPeriod !== undefined && object.previousPeriod !== null ? BigInt(object.previousPeriod.toString()) : BigInt(0); message.stake = object.stake ?? ""; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.UZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: DelegatorStartingInfoAmino): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + if (object.previous_period !== undefined && object.previous_period !== null) { + message.previousPeriod = BigInt(object.previous_period); + } + if (object.stake !== undefined && object.stake !== null) { + message.stake = object.stake; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } return message; + }, + toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { + const obj: any = {}; + obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.stake = message.stake; + obj.height = message.height ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { + return DelegatorStartingInfo.fromAmino(object.value); + }, + toAminoMsg(message: DelegatorStartingInfo): DelegatorStartingInfoAminoMsg { + return { + type: "cosmos-sdk/DelegatorStartingInfo", + value: DelegatorStartingInfo.toAmino(message) + }; + }, + fromProtoMsg(message: DelegatorStartingInfoProtoMsg): DelegatorStartingInfo { + return DelegatorStartingInfo.decode(message.value); + }, + toProto(message: DelegatorStartingInfo): Uint8Array { + return DelegatorStartingInfo.encode(message).finish(); + }, + toProtoMsg(message: DelegatorStartingInfo): DelegatorStartingInfoProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", + value: DelegatorStartingInfo.encode(message).finish() + }; } - }; - function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { return { validatorAddress: "", reward: [] }; } - export const DelegationDelegatorReward = { - encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", + encode(message: DelegationDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); } - for (const v of message.reward) { DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDelegationDelegatorReward(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddress = reader.string(); break; - case 2: message.reward.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DelegationDelegatorReward { + fromPartial(object: Partial): DelegationDelegatorReward { const message = createBaseDelegationDelegatorReward(); message.validatorAddress = object.validatorAddress ?? ""; message.reward = object.reward?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: DelegationDelegatorRewardAmino): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.reward = object.reward?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + if (message.reward) { + obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.reward = []; + } + return obj; + }, + fromAminoMsg(object: DelegationDelegatorRewardAminoMsg): DelegationDelegatorReward { + return DelegationDelegatorReward.fromAmino(object.value); + }, + toAminoMsg(message: DelegationDelegatorReward): DelegationDelegatorRewardAminoMsg { + return { + type: "cosmos-sdk/DelegationDelegatorReward", + value: DelegationDelegatorReward.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationDelegatorRewardProtoMsg): DelegationDelegatorReward { + return DelegationDelegatorReward.decode(message.value); + }, + toProto(message: DelegationDelegatorReward): Uint8Array { + return DelegationDelegatorReward.encode(message).finish(); + }, + toProtoMsg(message: DelegationDelegatorReward): DelegationDelegatorRewardProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", + value: DelegationDelegatorReward.encode(message).finish() + }; } - }; - function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { return { title: "", @@ -868,71 +1352,56 @@ function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendPr deposit: "" }; } - export const CommunityPoolSpendProposalWithDeposit = { - encode(message: CommunityPoolSpendProposalWithDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.recipient !== "") { writer.uint32(26).string(message.recipient); } - if (message.amount !== "") { writer.uint32(34).string(message.amount); } - if (message.deposit !== "") { writer.uint32(42).string(message.deposit); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommunityPoolSpendProposalWithDeposit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.title = reader.string(); break; - case 2: message.description = reader.string(); break; - case 3: message.recipient = reader.string(); break; - case 4: message.amount = reader.string(); break; - case 5: message.deposit = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CommunityPoolSpendProposalWithDeposit { + fromPartial(object: Partial): CommunityPoolSpendProposalWithDeposit { const message = createBaseCommunityPoolSpendProposalWithDeposit(); message.title = object.title ?? ""; message.description = object.description ?? ""; @@ -940,6 +1409,54 @@ export const CommunityPoolSpendProposalWithDeposit = { message.amount = object.amount ?? ""; message.deposit = object.deposit ?? ""; return message; + }, + fromAmino(object: CommunityPoolSpendProposalWithDepositAmino): CommunityPoolSpendProposalWithDeposit { + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + if (object.deposit !== undefined && object.deposit !== null) { + message.deposit = object.deposit; + } + return message; + }, + toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + obj.recipient = message.recipient; + obj.amount = message.amount; + obj.deposit = message.deposit; + return obj; + }, + fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromAmino(object.value); + }, + toAminoMsg(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAminoMsg { + return { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: CommunityPoolSpendProposalWithDepositProtoMsg): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.decode(message.value); + }, + toProto(message: CommunityPoolSpendProposalWithDeposit): Uint8Array { + return CommunityPoolSpendProposalWithDeposit.encode(message).finish(); + }, + toProtoMsg(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/genesis.ts b/src/codegen/cosmos/distribution/v1beta1/genesis.ts index 91658a9..dfa4824 100644 --- a/src/codegen/cosmos/distribution/v1beta1/genesis.ts +++ b/src/codegen/cosmos/distribution/v1beta1/genesis.ts @@ -1,673 +1,933 @@ -import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; -import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, Params, ParamsSDKType, FeePool, FeePoolSDKType } from "./distribution"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; +import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsAmino, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsAmino, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoAmino, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, Params, ParamsAmino, ParamsSDKType, FeePool, FeePoolAmino, FeePoolSDKType } from "./distribution"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * 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; } +export interface DelegatorWithdrawInfoProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo"; + value: Uint8Array; +} /** * 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 DelegatorWithdrawInfoSDKType { +export interface DelegatorWithdrawInfoAmino { /** delegator_address is the address of the delegator. */ - delegator_address: string; + delegator_address?: string; /** withdraw_address is the address to withdraw the delegation rewards to. */ - + withdraw_address?: string; +} +export interface DelegatorWithdrawInfoAminoMsg { + type: "cosmos-sdk/DelegatorWithdrawInfo"; + value: DelegatorWithdrawInfoAmino; +} +/** + * 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 DelegatorWithdrawInfoSDKType { + delegator_address: string; withdraw_address: 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 oustanding rewards of a validator. */ - outstandingRewards: DecCoin[]; } +export interface ValidatorOutstandingRewardsRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord"; + value: Uint8Array; +} /** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ - -export interface ValidatorOutstandingRewardsRecordSDKType { +export interface ValidatorOutstandingRewardsRecordAmino { /** validator_address is the address of the validator. */ - validator_address: string; + validator_address?: string; /** outstanding_rewards represents the oustanding rewards of a validator. */ - + outstanding_rewards?: DecCoinAmino[]; +} +export interface ValidatorOutstandingRewardsRecordAminoMsg { + type: "cosmos-sdk/ValidatorOutstandingRewardsRecord"; + value: ValidatorOutstandingRewardsRecordAmino; +} +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecordSDKType { + validator_address: string; outstanding_rewards: DecCoinSDKType[]; } /** * 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; + accumulated: ValidatorAccumulatedCommission; +} +export interface ValidatorAccumulatedCommissionRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord"; + value: Uint8Array; } /** * ValidatorAccumulatedCommissionRecord is used for import / export via genesis * json. */ - -export interface ValidatorAccumulatedCommissionRecordSDKType { +export interface ValidatorAccumulatedCommissionRecordAmino { /** validator_address is the address of the validator. */ - validator_address: string; + validator_address?: string; /** accumulated is the accumulated commission of a validator. */ - - accumulated?: ValidatorAccumulatedCommissionSDKType; + accumulated?: ValidatorAccumulatedCommissionAmino; +} +export interface ValidatorAccumulatedCommissionRecordAminoMsg { + type: "cosmos-sdk/ValidatorAccumulatedCommissionRecord"; + value: ValidatorAccumulatedCommissionRecordAmino; +} +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecordSDKType { + validator_address: string; + accumulated: ValidatorAccumulatedCommissionSDKType; } /** * 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: Long; + period: bigint; /** rewards defines the historical rewards of a validator. */ - - rewards?: ValidatorHistoricalRewards; + rewards: ValidatorHistoricalRewards; +} +export interface ValidatorHistoricalRewardsRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord"; + value: Uint8Array; } /** * ValidatorHistoricalRewardsRecord is used for import / export via genesis * json. */ - -export interface ValidatorHistoricalRewardsRecordSDKType { +export interface ValidatorHistoricalRewardsRecordAmino { /** validator_address is the address of the validator. */ - validator_address: string; + validator_address?: string; /** period defines the period the historical rewards apply to. */ - - period: Long; + period?: string; /** rewards defines the historical rewards of a validator. */ - - rewards?: ValidatorHistoricalRewardsSDKType; + rewards?: ValidatorHistoricalRewardsAmino; +} +export interface ValidatorHistoricalRewardsRecordAminoMsg { + type: "cosmos-sdk/ValidatorHistoricalRewardsRecord"; + value: ValidatorHistoricalRewardsRecordAmino; +} +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecordSDKType { + validator_address: string; + period: bigint; + rewards: ValidatorHistoricalRewardsSDKType; } /** 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; + rewards: ValidatorCurrentRewards; +} +export interface ValidatorCurrentRewardsRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord"; + value: Uint8Array; } /** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ - -export interface ValidatorCurrentRewardsRecordSDKType { +export interface ValidatorCurrentRewardsRecordAmino { /** validator_address is the address of the validator. */ - validator_address: string; + validator_address?: string; /** rewards defines the current rewards of a validator. */ - - rewards?: ValidatorCurrentRewardsSDKType; + rewards?: ValidatorCurrentRewardsAmino; +} +export interface ValidatorCurrentRewardsRecordAminoMsg { + type: "cosmos-sdk/ValidatorCurrentRewardsRecord"; + value: ValidatorCurrentRewardsRecordAmino; +} +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecordSDKType { + validator_address: string; + rewards: ValidatorCurrentRewardsSDKType; } /** 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; + startingInfo: DelegatorStartingInfo; +} +export interface DelegatorStartingInfoRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord"; + value: Uint8Array; } /** DelegatorStartingInfoRecord used for import / export via genesis json. */ - -export interface DelegatorStartingInfoRecordSDKType { +export interface DelegatorStartingInfoRecordAmino { /** delegator_address is the address of the delegator. */ - delegator_address: string; + delegator_address?: string; /** validator_address is the address of the validator. */ - - validator_address: string; + validator_address?: string; /** starting_info defines the starting info of a delegator. */ - - starting_info?: DelegatorStartingInfoSDKType; + starting_info?: DelegatorStartingInfoAmino; +} +export interface DelegatorStartingInfoRecordAminoMsg { + type: "cosmos-sdk/DelegatorStartingInfoRecord"; + value: DelegatorStartingInfoRecordAmino; +} +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecordSDKType { + delegator_address: string; + validator_address: string; + starting_info: DelegatorStartingInfoSDKType; } /** 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 occured. */ - - height: Long; + height: bigint; /** period is the period of the slash event. */ - - period: Long; + period: bigint; /** validator_slash_event describes the slash event. */ - - validatorSlashEvent?: ValidatorSlashEvent; + validatorSlashEvent: ValidatorSlashEvent; +} +export interface ValidatorSlashEventRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord"; + value: Uint8Array; } /** ValidatorSlashEventRecord is used for import / export via genesis json. */ - -export interface ValidatorSlashEventRecordSDKType { +export interface ValidatorSlashEventRecordAmino { /** validator_address is the address of the validator. */ - validator_address: string; + validator_address?: string; /** height defines the block height at which the slash event occured. */ - - height: Long; + height?: string; /** period is the period of the slash event. */ - - period: Long; + period?: string; /** validator_slash_event describes the slash event. */ - - validator_slash_event?: ValidatorSlashEventSDKType; + validator_slash_event?: ValidatorSlashEventAmino; +} +export interface ValidatorSlashEventRecordAminoMsg { + type: "cosmos-sdk/ValidatorSlashEventRecord"; + value: ValidatorSlashEventRecordAmino; +} +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecordSDKType { + validator_address: string; + height: bigint; + period: bigint; + validator_slash_event: ValidatorSlashEventSDKType; } /** GenesisState defines the distribution module's genesis state. */ - export interface GenesisState { /** params defines all the paramaters of the module. */ - params?: Params; + params: Params; /** fee_pool defines the fee pool at genesis. */ - - feePool?: FeePool; + feePool: FeePool; /** 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 commisions 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[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the distribution module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** params defines all the paramaters of the module. */ - params?: ParamsSDKType; + params?: ParamsAmino; /** fee_pool defines the fee pool at genesis. */ - - fee_pool?: FeePoolSDKType; + fee_pool?: FeePoolAmino; /** fee_pool defines the delegator withdraw infos at genesis. */ - - delegator_withdraw_infos: DelegatorWithdrawInfoSDKType[]; + delegator_withdraw_infos?: DelegatorWithdrawInfoAmino[]; /** fee_pool defines the previous proposer at genesis. */ - - previous_proposer: string; + previous_proposer?: string; /** fee_pool defines the outstanding rewards of all validators at genesis. */ - - outstanding_rewards: ValidatorOutstandingRewardsRecordSDKType[]; + outstanding_rewards?: ValidatorOutstandingRewardsRecordAmino[]; /** fee_pool defines the accumulated commisions of all validators at genesis. */ - - validator_accumulated_commissions: ValidatorAccumulatedCommissionRecordSDKType[]; + validator_accumulated_commissions?: ValidatorAccumulatedCommissionRecordAmino[]; /** fee_pool defines the historical rewards of all validators at genesis. */ - - validator_historical_rewards: ValidatorHistoricalRewardsRecordSDKType[]; + validator_historical_rewards?: ValidatorHistoricalRewardsRecordAmino[]; /** fee_pool defines the current rewards of all validators at genesis. */ - - validator_current_rewards: ValidatorCurrentRewardsRecordSDKType[]; + validator_current_rewards?: ValidatorCurrentRewardsRecordAmino[]; /** fee_pool defines the delegator starting infos at genesis. */ - - delegator_starting_infos: DelegatorStartingInfoRecordSDKType[]; + delegator_starting_infos?: DelegatorStartingInfoRecordAmino[]; /** fee_pool defines the validator slash events at genesis. */ - + validator_slash_events?: ValidatorSlashEventRecordAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + fee_pool: FeePoolSDKType; + delegator_withdraw_infos: DelegatorWithdrawInfoSDKType[]; + previous_proposer: string; + outstanding_rewards: ValidatorOutstandingRewardsRecordSDKType[]; + validator_accumulated_commissions: ValidatorAccumulatedCommissionRecordSDKType[]; + validator_historical_rewards: ValidatorHistoricalRewardsRecordSDKType[]; + validator_current_rewards: ValidatorCurrentRewardsRecordSDKType[]; + delegator_starting_infos: DelegatorStartingInfoRecordSDKType[]; validator_slash_events: ValidatorSlashEventRecordSDKType[]; } - function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { return { delegatorAddress: "", withdrawAddress: "" }; } - export const DelegatorWithdrawInfo = { - encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", + encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.withdrawAddress !== "") { writer.uint32(18).string(message.withdrawAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.delegatorAddress = reader.string(); break; - case 2: message.withdrawAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DelegatorWithdrawInfo { + fromPartial(object: Partial): DelegatorWithdrawInfo { const message = createBaseDelegatorWithdrawInfo(); message.delegatorAddress = object.delegatorAddress ?? ""; message.withdrawAddress = object.withdrawAddress ?? ""; return message; + }, + fromAmino(object: DelegatorWithdrawInfoAmino): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.withdraw_address !== undefined && object.withdraw_address !== null) { + message.withdrawAddress = object.withdraw_address; + } + return message; + }, + toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress; + return obj; + }, + fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromAmino(object.value); + }, + toAminoMsg(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAminoMsg { + return { + type: "cosmos-sdk/DelegatorWithdrawInfo", + value: DelegatorWithdrawInfo.toAmino(message) + }; + }, + fromProtoMsg(message: DelegatorWithdrawInfoProtoMsg): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.decode(message.value); + }, + toProto(message: DelegatorWithdrawInfo): Uint8Array { + return DelegatorWithdrawInfo.encode(message).finish(); + }, + toProtoMsg(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", + value: DelegatorWithdrawInfo.encode(message).finish() + }; } - }; - function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { return { validatorAddress: "", outstandingRewards: [] }; } - export const ValidatorOutstandingRewardsRecord = { - encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", + encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + 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: message.validatorAddress = reader.string(); break; - case 2: message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorOutstandingRewardsRecord { + fromPartial(object: Partial): ValidatorOutstandingRewardsRecord { const message = createBaseValidatorOutstandingRewardsRecord(); message.validatorAddress = object.validatorAddress ?? ""; message.outstandingRewards = object.outstandingRewards?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: ValidatorOutstandingRewardsRecordAmino): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.outstandingRewards = object.outstanding_rewards?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + if (message.outstandingRewards) { + obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.outstanding_rewards = []; + } + return obj; + }, + fromAminoMsg(object: ValidatorOutstandingRewardsRecordAminoMsg): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorOutstandingRewardsRecord", + value: ValidatorOutstandingRewardsRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorOutstandingRewardsRecordProtoMsg): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.decode(message.value); + }, + toProto(message: ValidatorOutstandingRewardsRecord): Uint8Array { + return ValidatorOutstandingRewardsRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", + value: ValidatorOutstandingRewardsRecord.encode(message).finish() + }; } - }; - function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { return { validatorAddress: "", - accumulated: undefined + accumulated: ValidatorAccumulatedCommission.fromPartial({}) }; } - export const ValidatorAccumulatedCommissionRecord = { - encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", + encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + 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: message.validatorAddress = reader.string(); break; - case 2: message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorAccumulatedCommissionRecord { + fromPartial(object: Partial): ValidatorAccumulatedCommissionRecord { const message = createBaseValidatorAccumulatedCommissionRecord(); message.validatorAddress = object.validatorAddress ?? ""; message.accumulated = object.accumulated !== undefined && object.accumulated !== null ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) : undefined; return message; + }, + fromAmino(object: ValidatorAccumulatedCommissionRecordAmino): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.accumulated !== undefined && object.accumulated !== null) { + message.accumulated = ValidatorAccumulatedCommission.fromAmino(object.accumulated); + } + return message; + }, + toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAccumulatedCommissionRecordAminoMsg): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorAccumulatedCommissionRecord", + value: ValidatorAccumulatedCommissionRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorAccumulatedCommissionRecordProtoMsg): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.decode(message.value); + }, + toProto(message: ValidatorAccumulatedCommissionRecord): Uint8Array { + return ValidatorAccumulatedCommissionRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", + value: ValidatorAccumulatedCommissionRecord.encode(message).finish() + }; } - }; - function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { return { validatorAddress: "", - period: Long.UZERO, - rewards: undefined + period: BigInt(0), + rewards: ValidatorHistoricalRewards.fromPartial({}) }; } - export const ValidatorHistoricalRewardsRecord = { - encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", + encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); } - - if (!message.period.isZero()) { + if (message.period !== BigInt(0)) { writer.uint32(16).uint64(message.period); } - if (message.rewards !== undefined) { ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.validatorAddress = reader.string(); break; - case 2: - message.period = (reader.uint64() as Long); + message.period = reader.uint64(); break; - case 3: message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorHistoricalRewardsRecord { + fromPartial(object: Partial): ValidatorHistoricalRewardsRecord { const message = createBaseValidatorHistoricalRewardsRecord(); message.validatorAddress = object.validatorAddress ?? ""; - message.period = object.period !== undefined && object.period !== null ? Long.fromValue(object.period) : Long.UZERO; + message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorHistoricalRewards.fromPartial(object.rewards) : undefined; return message; + }, + fromAmino(object: ValidatorHistoricalRewardsRecordAmino): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period); + } + if (object.rewards !== undefined && object.rewards !== null) { + message.rewards = ValidatorHistoricalRewards.fromAmino(object.rewards); + } + return message; + }, + toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + obj.period = message.period ? message.period.toString() : undefined; + obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorHistoricalRewardsRecordAminoMsg): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorHistoricalRewardsRecord", + value: ValidatorHistoricalRewardsRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorHistoricalRewardsRecordProtoMsg): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.decode(message.value); + }, + toProto(message: ValidatorHistoricalRewardsRecord): Uint8Array { + return ValidatorHistoricalRewardsRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", + value: ValidatorHistoricalRewardsRecord.encode(message).finish() + }; } - }; - function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { return { validatorAddress: "", - rewards: undefined + rewards: ValidatorCurrentRewards.fromPartial({}) }; } - export const ValidatorCurrentRewardsRecord = { - encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", + encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + 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: message.validatorAddress = reader.string(); break; - case 2: message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorCurrentRewardsRecord { + fromPartial(object: Partial): ValidatorCurrentRewardsRecord { const message = createBaseValidatorCurrentRewardsRecord(); message.validatorAddress = object.validatorAddress ?? ""; message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorCurrentRewards.fromPartial(object.rewards) : undefined; return message; + }, + fromAmino(object: ValidatorCurrentRewardsRecordAmino): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.rewards !== undefined && object.rewards !== null) { + message.rewards = ValidatorCurrentRewards.fromAmino(object.rewards); + } + return message; + }, + toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorCurrentRewardsRecordAminoMsg): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorCurrentRewardsRecord", + value: ValidatorCurrentRewardsRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorCurrentRewardsRecordProtoMsg): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.decode(message.value); + }, + toProto(message: ValidatorCurrentRewardsRecord): Uint8Array { + return ValidatorCurrentRewardsRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", + value: ValidatorCurrentRewardsRecord.encode(message).finish() + }; } - }; - function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { return { delegatorAddress: "", validatorAddress: "", - startingInfo: undefined + startingInfo: DelegatorStartingInfo.fromPartial({}) }; } - export const DelegatorStartingInfoRecord = { - encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", + encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - if (message.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 : new _m0.Reader(input); + 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: message.delegatorAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - case 3: message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DelegatorStartingInfoRecord { + fromPartial(object: Partial): 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; + }, + fromAmino(object: DelegatorStartingInfoRecordAmino): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.starting_info !== undefined && object.starting_info !== null) { + message.startingInfo = DelegatorStartingInfo.fromAmino(object.starting_info); + } + return message; + }, + toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; + return obj; + }, + fromAminoMsg(object: DelegatorStartingInfoRecordAminoMsg): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromAmino(object.value); + }, + toAminoMsg(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAminoMsg { + return { + type: "cosmos-sdk/DelegatorStartingInfoRecord", + value: DelegatorStartingInfoRecord.toAmino(message) + }; + }, + fromProtoMsg(message: DelegatorStartingInfoRecordProtoMsg): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.decode(message.value); + }, + toProto(message: DelegatorStartingInfoRecord): Uint8Array { + return DelegatorStartingInfoRecord.encode(message).finish(); + }, + toProtoMsg(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", + value: DelegatorStartingInfoRecord.encode(message).finish() + }; } - }; - function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { return { validatorAddress: "", - height: Long.UZERO, - period: Long.UZERO, - validatorSlashEvent: undefined + height: BigInt(0), + period: BigInt(0), + validatorSlashEvent: ValidatorSlashEvent.fromPartial({}) }; } - export const ValidatorSlashEventRecord = { - encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", + encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(16).uint64(message.height); } - - if (!message.period.isZero()) { + if (message.period !== BigInt(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 : new _m0.Reader(input); + 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: message.validatorAddress = reader.string(); break; - case 2: - message.height = (reader.uint64() as Long); + message.height = reader.uint64(); break; - case 3: - message.period = (reader.uint64() as Long); + message.period = reader.uint64(); break; - case 4: message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorSlashEventRecord { + fromPartial(object: Partial): ValidatorSlashEventRecord { const message = createBaseValidatorSlashEventRecord(); message.validatorAddress = object.validatorAddress ?? ""; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.UZERO; - message.period = object.period !== undefined && object.period !== null ? Long.fromValue(object.period) : Long.UZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); message.validatorSlashEvent = object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) : undefined; return message; + }, + fromAmino(object: ValidatorSlashEventRecordAmino): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period); + } + if (object.validator_slash_event !== undefined && object.validator_slash_event !== null) { + message.validatorSlashEvent = ValidatorSlashEvent.fromAmino(object.validator_slash_event); + } + return message; + }, + toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + obj.height = message.height ? message.height.toString() : undefined; + obj.period = message.period ? message.period.toString() : undefined; + obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorSlashEventRecordAminoMsg): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorSlashEventRecord", + value: ValidatorSlashEventRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSlashEventRecordProtoMsg): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.decode(message.value); + }, + toProto(message: ValidatorSlashEventRecord): Uint8Array { + return ValidatorSlashEventRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", + value: ValidatorSlashEventRecord.encode(message).finish() + }; } - }; - function createBaseGenesisState(): GenesisState { return { - params: undefined, - feePool: undefined, + params: Params.fromPartial({}), + feePool: FeePool.fromPartial({}), delegatorWithdrawInfos: [], previousProposer: "", outstandingRewards: [], @@ -678,111 +938,86 @@ function createBaseGenesisState(): GenesisState { validatorSlashEvents: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - case 2: message.feePool = FeePool.decode(reader, reader.uint32()); break; - case 3: message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); break; - case 4: message.previousProposer = reader.string(); break; - case 5: message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); break; - case 6: message.validatorAccumulatedCommissions.push(ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32())); break; - case 7: message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); break; - case 8: message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); break; - case 9: message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); break; - case 10: message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): 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; @@ -795,6 +1030,88 @@ export const GenesisState = { message.delegatorStartingInfos = object.delegatorStartingInfos?.map(e => DelegatorStartingInfoRecord.fromPartial(e)) || []; message.validatorSlashEvents = object.validatorSlashEvents?.map(e => ValidatorSlashEventRecord.fromPartial(e)) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + if (object.fee_pool !== undefined && object.fee_pool !== null) { + message.feePool = FeePool.fromAmino(object.fee_pool); + } + message.delegatorWithdrawInfos = object.delegator_withdraw_infos?.map(e => DelegatorWithdrawInfo.fromAmino(e)) || []; + if (object.previous_proposer !== undefined && object.previous_proposer !== null) { + message.previousProposer = object.previous_proposer; + } + message.outstandingRewards = object.outstanding_rewards?.map(e => ValidatorOutstandingRewardsRecord.fromAmino(e)) || []; + message.validatorAccumulatedCommissions = object.validator_accumulated_commissions?.map(e => ValidatorAccumulatedCommissionRecord.fromAmino(e)) || []; + message.validatorHistoricalRewards = object.validator_historical_rewards?.map(e => ValidatorHistoricalRewardsRecord.fromAmino(e)) || []; + message.validatorCurrentRewards = object.validator_current_rewards?.map(e => ValidatorCurrentRewardsRecord.fromAmino(e)) || []; + message.delegatorStartingInfos = object.delegator_starting_infos?.map(e => DelegatorStartingInfoRecord.fromAmino(e)) || []; + message.validatorSlashEvents = object.validator_slash_events?.map(e => ValidatorSlashEventRecord.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.fee_pool = message.feePool ? FeePool.toAmino(message.feePool) : undefined; + if (message.delegatorWithdrawInfos) { + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e) : undefined); + } else { + obj.delegator_withdraw_infos = []; + } + obj.previous_proposer = message.previousProposer; + if (message.outstandingRewards) { + obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); + } else { + obj.outstanding_rewards = []; + } + if (message.validatorAccumulatedCommissions) { + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions.map(e => e ? ValidatorAccumulatedCommissionRecord.toAmino(e) : undefined); + } else { + obj.validator_accumulated_commissions = []; + } + if (message.validatorHistoricalRewards) { + obj.validator_historical_rewards = message.validatorHistoricalRewards.map(e => e ? ValidatorHistoricalRewardsRecord.toAmino(e) : undefined); + } else { + obj.validator_historical_rewards = []; + } + if (message.validatorCurrentRewards) { + obj.validator_current_rewards = message.validatorCurrentRewards.map(e => e ? ValidatorCurrentRewardsRecord.toAmino(e) : undefined); + } else { + obj.validator_current_rewards = []; + } + if (message.delegatorStartingInfos) { + obj.delegator_starting_infos = message.delegatorStartingInfos.map(e => e ? DelegatorStartingInfoRecord.toAmino(e) : undefined); + } else { + obj.delegator_starting_infos = []; + } + if (message.validatorSlashEvents) { + obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEventRecord.toAmino(e) : undefined); + } else { + obj.validator_slash_events = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/query.lcd.ts b/src/codegen/cosmos/distribution/v1beta1/query.lcd.ts index 5c1f644..1d0dbb1 100644 --- a/src/codegen/cosmos/distribution/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/distribution/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryParamsRequest, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -21,84 +20,61 @@ export class LCDQueryClient { this.communityPool = this.communityPool.bind(this); } /* Params queries params of the distribution module. */ - - async params(_params: QueryParamsRequest = {}): Promise { const endpoint = `cosmos/distribution/v1beta1/params`; return await this.req.get(endpoint); } /* ValidatorOutstandingRewards queries rewards of a validator address. */ - - async validatorOutstandingRewards(params: QueryValidatorOutstandingRewardsRequest): Promise { const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}/outstanding_rewards`; return await this.req.get(endpoint); } /* ValidatorCommission queries accumulated commission for a validator. */ - - async validatorCommission(params: QueryValidatorCommissionRequest): Promise { const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}/commission`; return await this.req.get(endpoint); } /* ValidatorSlashes queries slash events of a validator. */ - - async validatorSlashes(params: QueryValidatorSlashesRequest): Promise { const options: any = { params: {} }; - if (typeof params?.startingHeight !== "undefined") { options.params.starting_height = params.startingHeight; } - if (typeof params?.endingHeight !== "undefined") { options.params.ending_height = params.endingHeight; } - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}/slashes`; return await this.req.get(endpoint, options); } /* DelegationRewards queries the total rewards accrued by a delegation. */ - - async delegationRewards(params: QueryDelegationRewardsRequest): Promise { - const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}rewards/${params.validatorAddress}`; + const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/rewards/${params.validatorAddress}`; return await this.req.get(endpoint); } /* DelegationTotalRewards queries the total rewards accrued by a each validator. */ - - async delegationTotalRewards(params: QueryDelegationTotalRewardsRequest): Promise { const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/rewards`; return await this.req.get(endpoint); } /* DelegatorValidators queries the validators of a delegator. */ - - async delegatorValidators(params: QueryDelegatorValidatorsRequest): Promise { const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/validators`; return await this.req.get(endpoint); } /* DelegatorWithdrawAddress queries withdraw address of a delegator. */ - - async delegatorWithdrawAddress(params: QueryDelegatorWithdrawAddressRequest): Promise { const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/withdraw_address`; return await this.req.get(endpoint); } /* CommunityPool queries the community pool coins. */ - - async communityPool(_params: QueryCommunityPoolRequest = {}): Promise { const endpoint = `cosmos/distribution/v1beta1/community_pool`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/distribution/v1beta1/query.rpc.Query.ts index 539882a..6ecc809 100644 --- a/src/codegen/cosmos/distribution/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/distribution/v1beta1/query.rpc.Query.ts @@ -1,43 +1,33 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsResponse, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponse, QueryValidatorCommissionRequest, QueryValidatorCommissionResponse, QueryValidatorSlashesRequest, QueryValidatorSlashesResponse, QueryDelegationRewardsRequest, QueryDelegationRewardsResponse, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponse, QueryCommunityPoolRequest, QueryCommunityPoolResponse } from "./query"; /** Query defines the gRPC querier service for distribution module. */ - export interface Query { /** Params queries params of the distribution module. */ params(request?: QueryParamsRequest): Promise; /** ValidatorOutstandingRewards queries rewards of a validator address. */ - validatorOutstandingRewards(request: QueryValidatorOutstandingRewardsRequest): Promise; /** ValidatorCommission queries accumulated commission for a validator. */ - validatorCommission(request: QueryValidatorCommissionRequest): Promise; /** ValidatorSlashes queries slash events of a validator. */ - validatorSlashes(request: QueryValidatorSlashesRequest): Promise; /** DelegationRewards queries the total rewards accrued by a delegation. */ - delegationRewards(request: QueryDelegationRewardsRequest): Promise; /** * DelegationTotalRewards queries the total rewards accrued by a each * validator. */ - delegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise; /** DelegatorValidators queries the validators of a delegator. */ - delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; /** DelegatorWithdrawAddress queries withdraw address of a delegator. */ - delegatorWithdrawAddress(request: QueryDelegatorWithdrawAddressRequest): Promise; /** CommunityPool queries the community pool coins. */ - communityPool(request?: QueryCommunityPoolRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.params = this.params.bind(this); @@ -50,61 +40,51 @@ export class QueryClientImpl implements Query { 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("cosmos.distribution.v1beta1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } - validatorOutstandingRewards(request: QueryValidatorOutstandingRewardsRequest): Promise { const data = QueryValidatorOutstandingRewardsRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorOutstandingRewards", data); - return promise.then(data => QueryValidatorOutstandingRewardsResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Query", "ValidatorCommission", data); - return promise.then(data => QueryValidatorCommissionResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Query", "ValidatorSlashes", data); - return promise.then(data => QueryValidatorSlashesResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Query", "DelegationRewards", data); - return promise.then(data => QueryDelegationRewardsResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Query", "DelegationTotalRewards", data); - return promise.then(data => QueryDelegationTotalRewardsResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Query", "DelegatorValidators", data); - return promise.then(data => QueryDelegatorValidatorsResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Query", "DelegatorWithdrawAddress", data); - return promise.then(data => QueryDelegatorWithdrawAddressResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Query", "CommunityPool", data); - return promise.then(data => QueryCommunityPoolResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryCommunityPoolResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -113,38 +93,29 @@ export const createRpcQueryExtension = (base: QueryClient) => { params(request?: QueryParamsRequest): Promise { return queryService.params(request); }, - validatorOutstandingRewards(request: QueryValidatorOutstandingRewardsRequest): Promise { return queryService.validatorOutstandingRewards(request); }, - validatorCommission(request: QueryValidatorCommissionRequest): Promise { return queryService.validatorCommission(request); }, - validatorSlashes(request: QueryValidatorSlashesRequest): Promise { return queryService.validatorSlashes(request); }, - delegationRewards(request: QueryDelegationRewardsRequest): Promise { return queryService.delegationRewards(request); }, - delegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise { return queryService.delegationTotalRewards(request); }, - delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise { return queryService.delegatorValidators(request); }, - delegatorWithdrawAddress(request: QueryDelegatorWithdrawAddressRequest): Promise { return queryService.delegatorWithdrawAddress(request); }, - communityPool(request?: QueryCommunityPoolRequest): Promise { return queryService.communityPool(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/query.ts b/src/codegen/cosmos/distribution/v1beta1/query.ts index 9d3ffd0..183f764 100644 --- a/src/codegen/cosmos/distribution/v1beta1/query.ts +++ b/src/codegen/cosmos/distribution/v1beta1/query.ts @@ -1,1187 +1,1856 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; -import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsAmino, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsAmino, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardAmino, DelegationDelegatorRewardSDKType } from "./distribution"; +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - export interface QueryParamsRequestSDKType {} /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** params defines the parameters of the module. */ - params?: Params; + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse"; + value: Uint8Array; } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** params defines the parameters of the module. */ - params?: ParamsSDKType; + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; } /** * 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; } +export interface QueryValidatorOutstandingRewardsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest"; + value: Uint8Array; +} /** * QueryValidatorOutstandingRewardsRequest is the request type for the * Query/ValidatorOutstandingRewards RPC method. */ - -export interface QueryValidatorOutstandingRewardsRequestSDKType { +export interface QueryValidatorOutstandingRewardsRequestAmino { /** validator_address defines the validator address to query for. */ + validator_address?: string; +} +export interface QueryValidatorOutstandingRewardsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorOutstandingRewardsRequest"; + value: QueryValidatorOutstandingRewardsRequestAmino; +} +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequestSDKType { validator_address: string; } /** * QueryValidatorOutstandingRewardsResponse is the response type for the * Query/ValidatorOutstandingRewards RPC method. */ - export interface QueryValidatorOutstandingRewardsResponse { - rewards?: ValidatorOutstandingRewards; + rewards: ValidatorOutstandingRewards; +} +export interface QueryValidatorOutstandingRewardsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse"; + value: Uint8Array; +} +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponseAmino { + rewards?: ValidatorOutstandingRewardsAmino; +} +export interface QueryValidatorOutstandingRewardsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorOutstandingRewardsResponse"; + value: QueryValidatorOutstandingRewardsResponseAmino; } /** * QueryValidatorOutstandingRewardsResponse is the response type for the * Query/ValidatorOutstandingRewards RPC method. */ - export interface QueryValidatorOutstandingRewardsResponseSDKType { - rewards?: ValidatorOutstandingRewardsSDKType; + rewards: ValidatorOutstandingRewardsSDKType; } /** * 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; } +export interface QueryValidatorCommissionRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest"; + value: Uint8Array; +} /** * QueryValidatorCommissionRequest is the request type for the * Query/ValidatorCommission RPC method */ - -export interface QueryValidatorCommissionRequestSDKType { +export interface QueryValidatorCommissionRequestAmino { /** validator_address defines the validator address to query for. */ + validator_address?: string; +} +export interface QueryValidatorCommissionRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorCommissionRequest"; + value: QueryValidatorCommissionRequestAmino; +} +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequestSDKType { validator_address: string; } /** * QueryValidatorCommissionResponse is the response type for the * Query/ValidatorCommission RPC method */ - export interface QueryValidatorCommissionResponse { /** commission defines the commision the validator received. */ - commission?: ValidatorAccumulatedCommission; + commission: ValidatorAccumulatedCommission; +} +export interface QueryValidatorCommissionResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse"; + value: Uint8Array; } /** * QueryValidatorCommissionResponse is the response type for the * Query/ValidatorCommission RPC method */ - -export interface QueryValidatorCommissionResponseSDKType { +export interface QueryValidatorCommissionResponseAmino { /** commission defines the commision the validator received. */ - commission?: ValidatorAccumulatedCommissionSDKType; + commission?: ValidatorAccumulatedCommissionAmino; +} +export interface QueryValidatorCommissionResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorCommissionResponse"; + value: QueryValidatorCommissionResponseAmino; +} +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponseSDKType { + commission: ValidatorAccumulatedCommissionSDKType; } /** * 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: Long; + startingHeight: bigint; /** starting_height defines the optional ending height to query the slashes. */ - - endingHeight: Long; + endingHeight: bigint; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryValidatorSlashesRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest"; + value: Uint8Array; +} /** * QueryValidatorSlashesRequest is the request type for the * Query/ValidatorSlashes RPC method */ - -export interface QueryValidatorSlashesRequestSDKType { +export interface QueryValidatorSlashesRequestAmino { /** validator_address defines the validator address to query for. */ - validator_address: string; + validator_address?: string; /** starting_height defines the optional starting height to query the slashes. */ - - starting_height: Long; + starting_height?: string; /** starting_height defines the optional ending height to query the slashes. */ - - ending_height: Long; + ending_height?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryValidatorSlashesRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorSlashesRequest"; + value: QueryValidatorSlashesRequestAmino; +} +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequestSDKType { + validator_address: string; + starting_height: bigint; + ending_height: bigint; pagination?: PageRequestSDKType; } /** * 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; } +export interface QueryValidatorSlashesResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse"; + value: Uint8Array; +} /** * QueryValidatorSlashesResponse is the response type for the * Query/ValidatorSlashes RPC method. */ - -export interface QueryValidatorSlashesResponseSDKType { +export interface QueryValidatorSlashesResponseAmino { /** slashes defines the slashes the validator received. */ - slashes: ValidatorSlashEventSDKType[]; + slashes?: ValidatorSlashEventAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryValidatorSlashesResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorSlashesResponse"; + value: QueryValidatorSlashesResponseAmino; +} +/** + * QueryValidatorSlashesResponse is the response type for the + * Query/ValidatorSlashes RPC method. + */ +export interface QueryValidatorSlashesResponseSDKType { + slashes: ValidatorSlashEventSDKType[]; pagination?: PageResponseSDKType; } /** * 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; } +export interface QueryDelegationRewardsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest"; + value: Uint8Array; +} /** * QueryDelegationRewardsRequest is the request type for the * Query/DelegationRewards RPC method. */ - -export interface QueryDelegationRewardsRequestSDKType { +export interface QueryDelegationRewardsRequestAmino { /** delegator_address defines the delegator address to query for. */ - delegator_address: string; + delegator_address?: string; /** validator_address defines the validator address to query for. */ - + validator_address?: string; +} +export interface QueryDelegationRewardsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegationRewardsRequest"; + value: QueryDelegationRewardsRequestAmino; +} +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequestSDKType { + delegator_address: string; validator_address: string; } /** * QueryDelegationRewardsResponse is the response type for the * Query/DelegationRewards RPC method. */ - export interface QueryDelegationRewardsResponse { /** rewards defines the rewards accrued by a delegation. */ rewards: DecCoin[]; } +export interface QueryDelegationRewardsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse"; + value: Uint8Array; +} /** * QueryDelegationRewardsResponse is the response type for the * Query/DelegationRewards RPC method. */ - -export interface QueryDelegationRewardsResponseSDKType { +export interface QueryDelegationRewardsResponseAmino { /** rewards defines the rewards accrued by a delegation. */ + rewards?: DecCoinAmino[]; +} +export interface QueryDelegationRewardsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegationRewardsResponse"; + value: QueryDelegationRewardsResponseAmino; +} +/** + * QueryDelegationRewardsResponse is the response type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsResponseSDKType { rewards: DecCoinSDKType[]; } /** * 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; } +export interface QueryDelegationTotalRewardsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest"; + value: Uint8Array; +} /** * QueryDelegationTotalRewardsRequest is the request type for the * Query/DelegationTotalRewards RPC method. */ - -export interface QueryDelegationTotalRewardsRequestSDKType { +export interface QueryDelegationTotalRewardsRequestAmino { /** delegator_address defines the delegator address to query for. */ + delegator_address?: string; +} +export interface QueryDelegationTotalRewardsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegationTotalRewardsRequest"; + value: QueryDelegationTotalRewardsRequestAmino; +} +/** + * QueryDelegationTotalRewardsRequest is the request type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsRequestSDKType { delegator_address: string; } /** * QueryDelegationTotalRewardsResponse is the response type for the * Query/DelegationTotalRewards RPC method. */ - export interface QueryDelegationTotalRewardsResponse { /** rewards defines all the rewards accrued by a delegator. */ rewards: DelegationDelegatorReward[]; /** total defines the sum of all the rewards. */ - total: DecCoin[]; } +export interface QueryDelegationTotalRewardsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse"; + value: Uint8Array; +} /** * QueryDelegationTotalRewardsResponse is the response type for the * Query/DelegationTotalRewards RPC method. */ - -export interface QueryDelegationTotalRewardsResponseSDKType { +export interface QueryDelegationTotalRewardsResponseAmino { /** rewards defines all the rewards accrued by a delegator. */ - rewards: DelegationDelegatorRewardSDKType[]; + rewards?: DelegationDelegatorRewardAmino[]; /** total defines the sum of all the rewards. */ - + total?: DecCoinAmino[]; +} +export interface QueryDelegationTotalRewardsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegationTotalRewardsResponse"; + value: QueryDelegationTotalRewardsResponseAmino; +} +/** + * QueryDelegationTotalRewardsResponse is the response type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsResponseSDKType { + rewards: DelegationDelegatorRewardSDKType[]; total: DecCoinSDKType[]; } /** * 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; } +export interface QueryDelegatorValidatorsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest"; + value: Uint8Array; +} /** * QueryDelegatorValidatorsRequest is the request type for the * Query/DelegatorValidators RPC method. */ - -export interface QueryDelegatorValidatorsRequestSDKType { +export interface QueryDelegatorValidatorsRequestAmino { /** delegator_address defines the delegator address to query for. */ + delegator_address?: string; +} +export interface QueryDelegatorValidatorsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest"; + value: QueryDelegatorValidatorsRequestAmino; +} +/** + * QueryDelegatorValidatorsRequest is the request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequestSDKType { delegator_address: string; } /** * QueryDelegatorValidatorsResponse is the response type for the * Query/DelegatorValidators RPC method. */ - export interface QueryDelegatorValidatorsResponse { /** validators defines the validators a delegator is delegating for. */ validators: string[]; } +export interface QueryDelegatorValidatorsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse"; + value: Uint8Array; +} /** * QueryDelegatorValidatorsResponse is the response type for the * Query/DelegatorValidators RPC method. */ - -export interface QueryDelegatorValidatorsResponseSDKType { +export interface QueryDelegatorValidatorsResponseAmino { /** validators defines the validators a delegator is delegating for. */ + validators?: string[]; +} +export interface QueryDelegatorValidatorsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse"; + value: QueryDelegatorValidatorsResponseAmino; +} +/** + * QueryDelegatorValidatorsResponse is the response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponseSDKType { 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; } +export interface QueryDelegatorWithdrawAddressRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest"; + value: Uint8Array; +} /** * QueryDelegatorWithdrawAddressRequest is the request type for the * Query/DelegatorWithdrawAddress RPC method. */ - -export interface QueryDelegatorWithdrawAddressRequestSDKType { +export interface QueryDelegatorWithdrawAddressRequestAmino { /** delegator_address defines the delegator address to query for. */ + delegator_address?: string; +} +export interface QueryDelegatorWithdrawAddressRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorWithdrawAddressRequest"; + value: QueryDelegatorWithdrawAddressRequestAmino; +} +/** + * QueryDelegatorWithdrawAddressRequest is the request type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressRequestSDKType { delegator_address: string; } /** * QueryDelegatorWithdrawAddressResponse is the response type for the * Query/DelegatorWithdrawAddress RPC method. */ - export interface QueryDelegatorWithdrawAddressResponse { /** withdraw_address defines the delegator address to query for. */ withdrawAddress: string; } +export interface QueryDelegatorWithdrawAddressResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse"; + value: Uint8Array; +} /** * QueryDelegatorWithdrawAddressResponse is the response type for the * Query/DelegatorWithdrawAddress RPC method. */ - -export interface QueryDelegatorWithdrawAddressResponseSDKType { +export interface QueryDelegatorWithdrawAddressResponseAmino { /** withdraw_address defines the delegator address to query for. */ + withdraw_address?: string; +} +export interface QueryDelegatorWithdrawAddressResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorWithdrawAddressResponse"; + value: QueryDelegatorWithdrawAddressResponseAmino; +} +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponseSDKType { withdraw_address: string; } /** * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC * method. */ - export interface QueryCommunityPoolRequest {} +export interface QueryCommunityPoolRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest"; + value: Uint8Array; +} +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequestAmino {} +export interface QueryCommunityPoolRequestAminoMsg { + type: "cosmos-sdk/QueryCommunityPoolRequest"; + value: QueryCommunityPoolRequestAmino; +} /** * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC * method. */ - export interface QueryCommunityPoolRequestSDKType {} /** * QueryCommunityPoolResponse is the response type for the Query/CommunityPool * RPC method. */ - export interface QueryCommunityPoolResponse { /** pool defines community pool's coins. */ pool: DecCoin[]; } +export interface QueryCommunityPoolResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse"; + value: Uint8Array; +} /** * QueryCommunityPoolResponse is the response type for the Query/CommunityPool * RPC method. */ - -export interface QueryCommunityPoolResponseSDKType { +export interface QueryCommunityPoolResponseAmino { /** pool defines community pool's coins. */ + pool?: DecCoinAmino[]; +} +export interface QueryCommunityPoolResponseAminoMsg { + type: "cosmos-sdk/QueryCommunityPoolResponse"; + value: QueryCommunityPoolResponseAmino; +} +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponseSDKType { pool: DecCoinSDKType[]; } - function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } - export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParamsRequest { + fromPartial(_: Partial): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + params: Params.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { return { validatorAddress: "" }; } - export const QueryValidatorOutstandingRewardsRequest = { - encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", + encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + 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: message.validatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorOutstandingRewardsRequest { + fromPartial(object: Partial): QueryValidatorOutstandingRewardsRequest { const message = createBaseQueryValidatorOutstandingRewardsRequest(); message.validatorAddress = object.validatorAddress ?? ""; return message; + }, + fromAmino(object: QueryValidatorOutstandingRewardsRequestAmino): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + return obj; + }, + fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorOutstandingRewardsRequest", + value: QueryValidatorOutstandingRewardsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorOutstandingRewardsRequestProtoMsg): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.decode(message.value); + }, + toProto(message: QueryValidatorOutstandingRewardsRequest): Uint8Array { + return QueryValidatorOutstandingRewardsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", + value: QueryValidatorOutstandingRewardsRequest.encode(message).finish() + }; } - }; - function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { return { - rewards: undefined + rewards: ValidatorOutstandingRewards.fromPartial({}) }; } - export const QueryValidatorOutstandingRewardsResponse = { - encode(message: QueryValidatorOutstandingRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", + encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rewards !== undefined) { ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorOutstandingRewardsResponse { + fromPartial(object: Partial): QueryValidatorOutstandingRewardsResponse { const message = createBaseQueryValidatorOutstandingRewardsResponse(); message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorOutstandingRewards.fromPartial(object.rewards) : undefined; return message; + }, + fromAmino(object: QueryValidatorOutstandingRewardsResponseAmino): QueryValidatorOutstandingRewardsResponse { + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + if (object.rewards !== undefined && object.rewards !== null) { + message.rewards = ValidatorOutstandingRewards.fromAmino(object.rewards); + } + return message; + }, + toAmino(message: QueryValidatorOutstandingRewardsResponse): QueryValidatorOutstandingRewardsResponseAmino { + const obj: any = {}; + obj.rewards = message.rewards ? ValidatorOutstandingRewards.toAmino(message.rewards) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorOutstandingRewardsResponseAminoMsg): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorOutstandingRewardsResponse): QueryValidatorOutstandingRewardsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorOutstandingRewardsResponse", + value: QueryValidatorOutstandingRewardsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorOutstandingRewardsResponseProtoMsg): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.decode(message.value); + }, + toProto(message: QueryValidatorOutstandingRewardsResponse): Uint8Array { + return QueryValidatorOutstandingRewardsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorOutstandingRewardsResponse): QueryValidatorOutstandingRewardsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", + value: QueryValidatorOutstandingRewardsResponse.encode(message).finish() + }; } - }; - function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRequest { return { validatorAddress: "" }; } - export const QueryValidatorCommissionRequest = { - encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", + encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + 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: message.validatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorCommissionRequest { + fromPartial(object: Partial): QueryValidatorCommissionRequest { const message = createBaseQueryValidatorCommissionRequest(); message.validatorAddress = object.validatorAddress ?? ""; return message; + }, + fromAmino(object: QueryValidatorCommissionRequestAmino): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + return obj; + }, + fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorCommissionRequest", + value: QueryValidatorCommissionRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorCommissionRequestProtoMsg): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.decode(message.value); + }, + toProto(message: QueryValidatorCommissionRequest): Uint8Array { + return QueryValidatorCommissionRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", + value: QueryValidatorCommissionRequest.encode(message).finish() + }; } - }; - function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { return { - commission: undefined + commission: ValidatorAccumulatedCommission.fromPartial({}) }; } - export const QueryValidatorCommissionResponse = { - encode(message: QueryValidatorCommissionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", + encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commission !== undefined) { ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorCommissionResponse { + fromPartial(object: Partial): QueryValidatorCommissionResponse { const message = createBaseQueryValidatorCommissionResponse(); message.commission = object.commission !== undefined && object.commission !== null ? ValidatorAccumulatedCommission.fromPartial(object.commission) : undefined; return message; + }, + fromAmino(object: QueryValidatorCommissionResponseAmino): QueryValidatorCommissionResponse { + const message = createBaseQueryValidatorCommissionResponse(); + if (object.commission !== undefined && object.commission !== null) { + message.commission = ValidatorAccumulatedCommission.fromAmino(object.commission); + } + return message; + }, + toAmino(message: QueryValidatorCommissionResponse): QueryValidatorCommissionResponseAmino { + const obj: any = {}; + obj.commission = message.commission ? ValidatorAccumulatedCommission.toAmino(message.commission) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorCommissionResponseAminoMsg): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorCommissionResponse): QueryValidatorCommissionResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorCommissionResponse", + value: QueryValidatorCommissionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorCommissionResponseProtoMsg): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.decode(message.value); + }, + toProto(message: QueryValidatorCommissionResponse): Uint8Array { + return QueryValidatorCommissionResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorCommissionResponse): QueryValidatorCommissionResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", + value: QueryValidatorCommissionResponse.encode(message).finish() + }; } - }; - function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest { return { validatorAddress: "", - startingHeight: Long.UZERO, - endingHeight: Long.UZERO, + startingHeight: BigInt(0), + endingHeight: BigInt(0), pagination: undefined }; } - export const QueryValidatorSlashesRequest = { - encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", + encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); } - - if (!message.startingHeight.isZero()) { + if (message.startingHeight !== BigInt(0)) { writer.uint32(16).uint64(message.startingHeight); } - - if (!message.endingHeight.isZero()) { + if (message.endingHeight !== BigInt(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 : new _m0.Reader(input); + 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: message.validatorAddress = reader.string(); break; - case 2: - message.startingHeight = (reader.uint64() as Long); + message.startingHeight = reader.uint64(); break; - case 3: - message.endingHeight = (reader.uint64() as Long); + message.endingHeight = reader.uint64(); break; - case 4: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorSlashesRequest { + fromPartial(object: Partial): QueryValidatorSlashesRequest { const message = createBaseQueryValidatorSlashesRequest(); message.validatorAddress = object.validatorAddress ?? ""; - message.startingHeight = object.startingHeight !== undefined && object.startingHeight !== null ? Long.fromValue(object.startingHeight) : Long.UZERO; - message.endingHeight = object.endingHeight !== undefined && object.endingHeight !== null ? Long.fromValue(object.endingHeight) : Long.UZERO; + message.startingHeight = object.startingHeight !== undefined && object.startingHeight !== null ? BigInt(object.startingHeight.toString()) : BigInt(0); + message.endingHeight = object.endingHeight !== undefined && object.endingHeight !== null ? BigInt(object.endingHeight.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryValidatorSlashesRequestAmino): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.starting_height !== undefined && object.starting_height !== null) { + message.startingHeight = BigInt(object.starting_height); + } + if (object.ending_height !== undefined && object.ending_height !== null) { + message.endingHeight = BigInt(object.ending_height); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorSlashesRequestAminoMsg): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorSlashesRequest", + value: QueryValidatorSlashesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorSlashesRequestProtoMsg): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.decode(message.value); + }, + toProto(message: QueryValidatorSlashesRequest): Uint8Array { + return QueryValidatorSlashesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", + value: QueryValidatorSlashesRequest.encode(message).finish() + }; } - }; - function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesResponse { return { slashes: [], pagination: undefined }; } - export const QueryValidatorSlashesResponse = { - encode(message: QueryValidatorSlashesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", + encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.slashes) { ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorSlashesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorSlashesResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryValidatorSlashesResponseAmino): QueryValidatorSlashesResponse { + const message = createBaseQueryValidatorSlashesResponse(); + message.slashes = object.slashes?.map(e => ValidatorSlashEvent.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorSlashesResponse): QueryValidatorSlashesResponseAmino { + const obj: any = {}; + if (message.slashes) { + obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); + } else { + obj.slashes = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorSlashesResponseAminoMsg): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorSlashesResponse): QueryValidatorSlashesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorSlashesResponse", + value: QueryValidatorSlashesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorSlashesResponseProtoMsg): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.decode(message.value); + }, + toProto(message: QueryValidatorSlashesResponse): Uint8Array { + return QueryValidatorSlashesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorSlashesResponse): QueryValidatorSlashesResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", + value: QueryValidatorSlashesResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsRequest { return { delegatorAddress: "", validatorAddress: "" }; } - export const QueryDelegationRewardsRequest = { - encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", + encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.delegatorAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegationRewardsRequest { + fromPartial(object: Partial): QueryDelegationRewardsRequest { const message = createBaseQueryDelegationRewardsRequest(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; return message; + }, + fromAmino(object: QueryDelegationRewardsRequestAmino): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationRewardsRequest", + value: QueryDelegationRewardsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationRewardsRequestProtoMsg): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.decode(message.value); + }, + toProto(message: QueryDelegationRewardsRequest): Uint8Array { + return QueryDelegationRewardsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", + value: QueryDelegationRewardsRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { return { rewards: [] }; } - export const QueryDelegationRewardsResponse = { - encode(message: QueryDelegationRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", + encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.rewards.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegationRewardsResponse { + fromPartial(object: Partial): QueryDelegationRewardsResponse { const message = createBaseQueryDelegationRewardsResponse(); message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryDelegationRewardsResponseAmino): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryDelegationRewardsResponse): QueryDelegationRewardsResponseAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + fromAminoMsg(object: QueryDelegationRewardsResponseAminoMsg): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationRewardsResponse): QueryDelegationRewardsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationRewardsResponse", + value: QueryDelegationRewardsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationRewardsResponseProtoMsg): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.decode(message.value); + }, + toProto(message: QueryDelegationRewardsResponse): Uint8Array { + return QueryDelegationRewardsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationRewardsResponse): QueryDelegationRewardsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", + value: QueryDelegationRewardsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { return { delegatorAddress: "" }; } - export const QueryDelegationTotalRewardsRequest = { - encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", + encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + 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: message.delegatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegationTotalRewardsRequest { + fromPartial(object: Partial): QueryDelegationTotalRewardsRequest { const message = createBaseQueryDelegationTotalRewardsRequest(); message.delegatorAddress = object.delegatorAddress ?? ""; return message; + }, + fromAmino(object: QueryDelegationTotalRewardsRequestAmino): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + return message; + }, + toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationTotalRewardsRequest", + value: QueryDelegationTotalRewardsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationTotalRewardsRequestProtoMsg): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.decode(message.value); + }, + toProto(message: QueryDelegationTotalRewardsRequest): Uint8Array { + return QueryDelegationTotalRewardsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", + value: QueryDelegationTotalRewardsRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { return { rewards: [], total: [] }; } - export const QueryDelegationTotalRewardsResponse = { - encode(message: QueryDelegationTotalRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", + encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.total) { DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); break; - case 2: message.total.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegationTotalRewardsResponse { + fromPartial(object: Partial): QueryDelegationTotalRewardsResponse { const message = createBaseQueryDelegationTotalRewardsResponse(); message.rewards = object.rewards?.map(e => DelegationDelegatorReward.fromPartial(e)) || []; message.total = object.total?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryDelegationTotalRewardsResponseAmino): QueryDelegationTotalRewardsResponse { + const message = createBaseQueryDelegationTotalRewardsResponse(); + message.rewards = object.rewards?.map(e => DelegationDelegatorReward.fromAmino(e)) || []; + message.total = object.total?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryDelegationTotalRewardsResponse): QueryDelegationTotalRewardsResponseAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toAmino(e) : undefined); + } else { + obj.rewards = []; + } + if (message.total) { + obj.total = message.total.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.total = []; + } + return obj; + }, + fromAminoMsg(object: QueryDelegationTotalRewardsResponseAminoMsg): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationTotalRewardsResponse): QueryDelegationTotalRewardsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationTotalRewardsResponse", + value: QueryDelegationTotalRewardsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationTotalRewardsResponseProtoMsg): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.decode(message.value); + }, + toProto(message: QueryDelegationTotalRewardsResponse): Uint8Array { + return QueryDelegationTotalRewardsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationTotalRewardsResponse): QueryDelegationTotalRewardsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", + value: QueryDelegationTotalRewardsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { return { delegatorAddress: "" }; } - export const QueryDelegatorValidatorsRequest = { - encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorValidatorsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { + fromPartial(object: Partial): QueryDelegatorValidatorsRequest { const message = createBaseQueryDelegatorValidatorsRequest(); message.delegatorAddress = object.delegatorAddress ?? ""; return message; + }, + fromAmino(object: QueryDelegatorValidatorsRequestAmino): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + return message; + }, + toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsRequestProtoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsRequest): Uint8Array { + return QueryDelegatorValidatorsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { return { validators: [] }; } - export const QueryDelegatorValidatorsResponse = { - encode(message: QueryDelegatorValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorValidatorsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validators.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorValidatorsResponse { + fromPartial(object: Partial): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map(e => e) || []; + return message; + }, + fromAmino(object: QueryDelegatorValidatorsResponseAmino): QueryDelegatorValidatorsResponse { const message = createBaseQueryDelegatorValidatorsResponse(); message.validators = object.validators?.map(e => e) || []; return message; + }, + toAmino(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e); + } else { + obj.validators = []; + } + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsResponseAminoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsResponseProtoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsResponse): Uint8Array { + return QueryDelegatorValidatorsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { return { delegatorAddress: "" }; } - export const QueryDelegatorWithdrawAddressRequest = { - encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", + encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + 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: message.delegatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorWithdrawAddressRequest { + fromPartial(object: Partial): QueryDelegatorWithdrawAddressRequest { const message = createBaseQueryDelegatorWithdrawAddressRequest(); message.delegatorAddress = object.delegatorAddress ?? ""; return message; + }, + fromAmino(object: QueryDelegatorWithdrawAddressRequestAmino): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + return message; + }, + toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorWithdrawAddressRequest", + value: QueryDelegatorWithdrawAddressRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorWithdrawAddressRequestProtoMsg): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.decode(message.value); + }, + toProto(message: QueryDelegatorWithdrawAddressRequest): Uint8Array { + return QueryDelegatorWithdrawAddressRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", + value: QueryDelegatorWithdrawAddressRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { return { withdrawAddress: "" }; } - export const QueryDelegatorWithdrawAddressResponse = { - encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", + encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + 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: message.withdrawAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorWithdrawAddressResponse { + fromPartial(object: Partial): QueryDelegatorWithdrawAddressResponse { const message = createBaseQueryDelegatorWithdrawAddressResponse(); message.withdrawAddress = object.withdrawAddress ?? ""; return message; + }, + fromAmino(object: QueryDelegatorWithdrawAddressResponseAmino): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + if (object.withdraw_address !== undefined && object.withdraw_address !== null) { + message.withdrawAddress = object.withdraw_address; + } + return message; + }, + toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { + const obj: any = {}; + obj.withdraw_address = message.withdrawAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorWithdrawAddressResponse", + value: QueryDelegatorWithdrawAddressResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorWithdrawAddressResponseProtoMsg): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.decode(message.value); + }, + toProto(message: QueryDelegatorWithdrawAddressResponse): Uint8Array { + return QueryDelegatorWithdrawAddressResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", + value: QueryDelegatorWithdrawAddressResponse.encode(message).finish() + }; } - }; - function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { return {}; } - export const QueryCommunityPoolRequest = { - encode(_: QueryCommunityPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommunityPoolRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryCommunityPoolRequest { + fromPartial(_: Partial): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, + fromAmino(_: QueryCommunityPoolRequestAmino): QueryCommunityPoolRequest { const message = createBaseQueryCommunityPoolRequest(); return message; + }, + toAmino(_: QueryCommunityPoolRequest): QueryCommunityPoolRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryCommunityPoolRequestAminoMsg): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCommunityPoolRequest): QueryCommunityPoolRequestAminoMsg { + return { + type: "cosmos-sdk/QueryCommunityPoolRequest", + value: QueryCommunityPoolRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCommunityPoolRequestProtoMsg): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.decode(message.value); + }, + toProto(message: QueryCommunityPoolRequest): Uint8Array { + return QueryCommunityPoolRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCommunityPoolRequest): QueryCommunityPoolRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", + value: QueryCommunityPoolRequest.encode(message).finish() + }; } - }; - function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { return { pool: [] }; } - export const QueryCommunityPoolResponse = { - encode(message: QueryCommunityPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pool) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommunityPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.pool.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryCommunityPoolResponse { + fromPartial(object: Partial): QueryCommunityPoolResponse { const message = createBaseQueryCommunityPoolResponse(); message.pool = object.pool?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryCommunityPoolResponseAmino): QueryCommunityPoolResponse { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseAmino { + const obj: any = {}; + if (message.pool) { + obj.pool = message.pool.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.pool = []; + } + return obj; + }, + fromAminoMsg(object: QueryCommunityPoolResponseAminoMsg): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseAminoMsg { + return { + type: "cosmos-sdk/QueryCommunityPoolResponse", + value: QueryCommunityPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCommunityPoolResponseProtoMsg): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.decode(message.value); + }, + toProto(message: QueryCommunityPoolResponse): Uint8Array { + return QueryCommunityPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", + value: QueryCommunityPoolResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/tx.amino.ts b/src/codegen/cosmos/distribution/v1beta1/tx.amino.ts index b3a60ed..5b1270c 100644 --- a/src/codegen/cosmos/distribution/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/distribution/v1beta1/tx.amino.ts @@ -1,120 +1,23 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool } from "./tx"; -export interface AminoMsgSetWithdrawAddress extends AminoMsg { - type: "cosmos-sdk/MsgModifyWithdrawAddress"; - value: { - delegator_address: string; - withdraw_address: string; - }; -} -export interface AminoMsgWithdrawDelegatorReward extends AminoMsg { - type: "cosmos-sdk/MsgWithdrawDelegationReward"; - value: { - delegator_address: string; - validator_address: string; - }; -} -export interface AminoMsgWithdrawValidatorCommission extends AminoMsg { - type: "cosmos-sdk/MsgWithdrawValidatorCommission"; - value: { - validator_address: string; - }; -} -export interface AminoMsgFundCommunityPool extends AminoMsg { - type: "cosmos-sdk/MsgFundCommunityPool"; - value: { - amount: { - denom: string; - amount: string; - }[]; - depositor: string; - }; -} export const AminoConverter = { "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress": { aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", - toAmino: ({ - delegatorAddress, - withdrawAddress - }: MsgSetWithdrawAddress): AminoMsgSetWithdrawAddress["value"] => { - return { - delegator_address: delegatorAddress, - withdraw_address: withdrawAddress - }; - }, - fromAmino: ({ - delegator_address, - withdraw_address - }: AminoMsgSetWithdrawAddress["value"]): MsgSetWithdrawAddress => { - return { - delegatorAddress: delegator_address, - withdrawAddress: withdraw_address - }; - } + toAmino: MsgSetWithdrawAddress.toAmino, + fromAmino: MsgSetWithdrawAddress.fromAmino }, "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": { aminoType: "cosmos-sdk/MsgWithdrawDelegationReward", - toAmino: ({ - delegatorAddress, - validatorAddress - }: MsgWithdrawDelegatorReward): AminoMsgWithdrawDelegatorReward["value"] => { - return { - delegator_address: delegatorAddress, - validator_address: validatorAddress - }; - }, - fromAmino: ({ - delegator_address, - validator_address - }: AminoMsgWithdrawDelegatorReward["value"]): MsgWithdrawDelegatorReward => { - return { - delegatorAddress: delegator_address, - validatorAddress: validator_address - }; - } + toAmino: MsgWithdrawDelegatorReward.toAmino, + fromAmino: MsgWithdrawDelegatorReward.fromAmino }, "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission": { aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", - toAmino: ({ - validatorAddress - }: MsgWithdrawValidatorCommission): AminoMsgWithdrawValidatorCommission["value"] => { - return { - validator_address: validatorAddress - }; - }, - fromAmino: ({ - validator_address - }: AminoMsgWithdrawValidatorCommission["value"]): MsgWithdrawValidatorCommission => { - return { - validatorAddress: validator_address - }; - } + toAmino: MsgWithdrawValidatorCommission.toAmino, + fromAmino: MsgWithdrawValidatorCommission.fromAmino }, "/cosmos.distribution.v1beta1.MsgFundCommunityPool": { aminoType: "cosmos-sdk/MsgFundCommunityPool", - toAmino: ({ - amount, - depositor - }: MsgFundCommunityPool): AminoMsgFundCommunityPool["value"] => { - return { - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })), - depositor - }; - }, - fromAmino: ({ - amount, - depositor - }: AminoMsgFundCommunityPool["value"]): MsgFundCommunityPool => { - return { - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })), - depositor - }; - } + toAmino: MsgFundCommunityPool.toAmino, + fromAmino: MsgFundCommunityPool.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/tx.registry.ts b/src/codegen/cosmos/distribution/v1beta1/tx.registry.ts index 52aa99f..98b599d 100644 --- a/src/codegen/cosmos/distribution/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/distribution/v1beta1/tx.registry.ts @@ -14,28 +14,24 @@ export const MessageComposer = { value: MsgSetWithdrawAddress.encode(value).finish() }; }, - withdrawDelegatorReward(value: MsgWithdrawDelegatorReward) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: MsgWithdrawDelegatorReward.encode(value).finish() }; }, - withdrawValidatorCommission(value: MsgWithdrawValidatorCommission) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.encode(value).finish() }; }, - fundCommunityPool(value: MsgFundCommunityPool) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: MsgFundCommunityPool.encode(value).finish() }; } - }, withTypeUrl: { setWithdrawAddress(value: MsgSetWithdrawAddress) { @@ -44,28 +40,24 @@ export const MessageComposer = { value }; }, - withdrawDelegatorReward(value: MsgWithdrawDelegatorReward) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value }; }, - withdrawValidatorCommission(value: MsgWithdrawValidatorCommission) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value }; }, - fundCommunityPool(value: MsgFundCommunityPool) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value }; } - }, fromPartial: { setWithdrawAddress(value: MsgSetWithdrawAddress) { @@ -74,27 +66,23 @@ export const MessageComposer = { value: MsgSetWithdrawAddress.fromPartial(value) }; }, - withdrawDelegatorReward(value: MsgWithdrawDelegatorReward) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: MsgWithdrawDelegatorReward.fromPartial(value) }; }, - withdrawValidatorCommission(value: MsgWithdrawValidatorCommission) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.fromPartial(value) }; }, - fundCommunityPool(value: MsgFundCommunityPool) { return { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: MsgFundCommunityPool.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/distribution/v1beta1/tx.rpc.msg.ts index 64e7e19..c66ec3e 100644 --- a/src/codegen/cosmos/distribution/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressResponse, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardResponse, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionResponse, MsgFundCommunityPool, MsgFundCommunityPoolResponse } from "./tx"; /** Msg defines the distribution Msg service. */ - export interface Msg { /** * SetWithdrawAddress defines a method to change the withdraw address @@ -13,24 +12,20 @@ export interface Msg { * WithdrawDelegatorReward defines a method to withdraw rewards of delegator * from a single validator. */ - withdrawDelegatorReward(request: MsgWithdrawDelegatorReward): Promise; /** * WithdrawValidatorCommission defines a method to withdraw the * full commission to the validator address. */ - withdrawValidatorCommission(request: MsgWithdrawValidatorCommission): Promise; /** * FundCommunityPool defines a method to allow an account to directly * fund the community pool. */ - fundCommunityPool(request: MsgFundCommunityPool): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.setWithdrawAddress = this.setWithdrawAddress.bind(this); @@ -38,29 +33,24 @@ export class MsgClientImpl implements Msg { this.withdrawValidatorCommission = this.withdrawValidatorCommission.bind(this); this.fundCommunityPool = this.fundCommunityPool.bind(this); } - setWithdrawAddress(request: MsgSetWithdrawAddress): Promise { const data = MsgSetWithdrawAddress.encode(request).finish(); const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "SetWithdrawAddress", data); - return promise.then(data => MsgSetWithdrawAddressResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Msg", "WithdrawDelegatorReward", data); - return promise.then(data => MsgWithdrawDelegatorRewardResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Msg", "WithdrawValidatorCommission", data); - return promise.then(data => MsgWithdrawValidatorCommissionResponse.decode(new _m0.Reader(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("cosmos.distribution.v1beta1.Msg", "FundCommunityPool", data); - return promise.then(data => MsgFundCommunityPoolResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgFundCommunityPoolResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/distribution/v1beta1/tx.ts b/src/codegen/cosmos/distribution/v1beta1/tx.ts index 182b5b5..481d77e 100644 --- a/src/codegen/cosmos/distribution/v1beta1/tx.ts +++ b/src/codegen/cosmos/distribution/v1beta1/tx.ts @@ -1,55 +1,100 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * MsgSetWithdrawAddress sets the withdraw address for * a delegator (or validator self-delegation). */ - export interface MsgSetWithdrawAddress { delegatorAddress: string; withdrawAddress: string; } +export interface MsgSetWithdrawAddressProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress"; + value: Uint8Array; +} +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddressAmino { + delegator_address?: string; + withdraw_address?: string; +} +export interface MsgSetWithdrawAddressAminoMsg { + type: "cosmos-sdk/MsgModifyWithdrawAddress"; + value: MsgSetWithdrawAddressAmino; +} /** * MsgSetWithdrawAddress sets the withdraw address for * a delegator (or validator self-delegation). */ - export interface MsgSetWithdrawAddressSDKType { delegator_address: string; withdraw_address: string; } /** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */ - export interface MsgSetWithdrawAddressResponse {} +export interface MsgSetWithdrawAddressResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse"; + value: Uint8Array; +} +/** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */ +export interface MsgSetWithdrawAddressResponseAmino {} +export interface MsgSetWithdrawAddressResponseAminoMsg { + type: "cosmos-sdk/MsgSetWithdrawAddressResponse"; + value: MsgSetWithdrawAddressResponseAmino; +} /** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */ - export interface MsgSetWithdrawAddressResponseSDKType {} /** * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator * from a single validator. */ - export interface MsgWithdrawDelegatorReward { delegatorAddress: string; validatorAddress: string; } +export interface MsgWithdrawDelegatorRewardProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"; + value: Uint8Array; +} +/** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ +export interface MsgWithdrawDelegatorRewardAmino { + delegator_address?: string; + validator_address?: string; +} +export interface MsgWithdrawDelegatorRewardAminoMsg { + type: "cosmos-sdk/MsgWithdrawDelegationReward"; + value: MsgWithdrawDelegatorRewardAmino; +} /** * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator * from a single validator. */ - export interface MsgWithdrawDelegatorRewardSDKType { delegator_address: string; validator_address: string; } /** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */ - export interface MsgWithdrawDelegatorRewardResponse { amount: Coin[]; } +export interface MsgWithdrawDelegatorRewardResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse"; + value: Uint8Array; +} +/** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */ +export interface MsgWithdrawDelegatorRewardResponseAmino { + amount?: CoinAmino[]; +} +export interface MsgWithdrawDelegatorRewardResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse"; + value: MsgWithdrawDelegatorRewardResponseAmino; +} /** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */ - export interface MsgWithdrawDelegatorRewardResponseSDKType { amount: CoinSDKType[]; } @@ -57,25 +102,48 @@ export interface MsgWithdrawDelegatorRewardResponseSDKType { * MsgWithdrawValidatorCommission withdraws the full commission to the validator * address. */ - export interface MsgWithdrawValidatorCommission { validatorAddress: string; } +export interface MsgWithdrawValidatorCommissionProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission"; + value: Uint8Array; +} +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommissionAmino { + validator_address?: string; +} +export interface MsgWithdrawValidatorCommissionAminoMsg { + type: "cosmos-sdk/MsgWithdrawValidatorCommission"; + value: MsgWithdrawValidatorCommissionAmino; +} /** * MsgWithdrawValidatorCommission withdraws the full commission to the validator * address. */ - export interface MsgWithdrawValidatorCommissionSDKType { validator_address: string; } /** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */ - export interface MsgWithdrawValidatorCommissionResponse { amount: Coin[]; } +export interface MsgWithdrawValidatorCommissionResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse"; + value: Uint8Array; +} +/** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */ +export interface MsgWithdrawValidatorCommissionResponseAmino { + amount?: CoinAmino[]; +} +export interface MsgWithdrawValidatorCommissionResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse"; + value: MsgWithdrawValidatorCommissionResponseAmino; +} /** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */ - export interface MsgWithdrawValidatorCommissionResponseSDKType { amount: CoinSDKType[]; } @@ -83,391 +151,613 @@ export interface MsgWithdrawValidatorCommissionResponseSDKType { * MsgFundCommunityPool allows an account to directly * fund the community pool. */ - export interface MsgFundCommunityPool { amount: Coin[]; depositor: string; } +export interface MsgFundCommunityPoolProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool"; + value: Uint8Array; +} +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPoolAmino { + amount?: CoinAmino[]; + depositor?: string; +} +export interface MsgFundCommunityPoolAminoMsg { + type: "cosmos-sdk/MsgFundCommunityPool"; + value: MsgFundCommunityPoolAmino; +} /** * MsgFundCommunityPool allows an account to directly * fund the community pool. */ - export interface MsgFundCommunityPoolSDKType { amount: CoinSDKType[]; depositor: string; } /** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ - export interface MsgFundCommunityPoolResponse {} +export interface MsgFundCommunityPoolResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse"; + value: Uint8Array; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponseAmino {} +export interface MsgFundCommunityPoolResponseAminoMsg { + type: "cosmos-sdk/MsgFundCommunityPoolResponse"; + value: MsgFundCommunityPoolResponseAmino; +} /** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ - export interface MsgFundCommunityPoolResponseSDKType {} - function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { return { delegatorAddress: "", withdrawAddress: "" }; } - export const MsgSetWithdrawAddress = { - encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.withdrawAddress !== "") { writer.uint32(18).string(message.withdrawAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSetWithdrawAddress(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.withdrawAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSetWithdrawAddress { + fromPartial(object: Partial): MsgSetWithdrawAddress { const message = createBaseMsgSetWithdrawAddress(); message.delegatorAddress = object.delegatorAddress ?? ""; message.withdrawAddress = object.withdrawAddress ?? ""; return message; + }, + fromAmino(object: MsgSetWithdrawAddressAmino): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.withdraw_address !== undefined && object.withdraw_address !== null) { + message.withdrawAddress = object.withdraw_address; + } + return message; + }, + toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress; + return obj; + }, + fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAminoMsg { + return { + type: "cosmos-sdk/MsgModifyWithdrawAddress", + value: MsgSetWithdrawAddress.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetWithdrawAddressProtoMsg): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.decode(message.value); + }, + toProto(message: MsgSetWithdrawAddress): Uint8Array { + return MsgSetWithdrawAddress.encode(message).finish(); + }, + toProtoMsg(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + value: MsgSetWithdrawAddress.encode(message).finish() + }; } - }; - function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { return {}; } - export const MsgSetWithdrawAddressResponse = { - encode(_: MsgSetWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSetWithdrawAddressResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgSetWithdrawAddressResponse { + fromPartial(_: Partial): MsgSetWithdrawAddressResponse { const message = createBaseMsgSetWithdrawAddressResponse(); return message; + }, + fromAmino(_: MsgSetWithdrawAddressResponseAmino): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, + toAmino(_: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSetWithdrawAddressResponseAminoMsg): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSetWithdrawAddressResponse", + value: MsgSetWithdrawAddressResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetWithdrawAddressResponseProtoMsg): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.decode(message.value); + }, + toProto(message: MsgSetWithdrawAddressResponse): Uint8Array { + return MsgSetWithdrawAddressResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", + value: MsgSetWithdrawAddressResponse.encode(message).finish() + }; } - }; - function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { return { delegatorAddress: "", validatorAddress: "" }; } - export const MsgWithdrawDelegatorReward = { - encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgWithdrawDelegatorReward(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgWithdrawDelegatorReward { + fromPartial(object: Partial): MsgWithdrawDelegatorReward { const message = createBaseMsgWithdrawDelegatorReward(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; return message; + }, + fromAmino(object: MsgWithdrawDelegatorRewardAmino): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + return obj; + }, + fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawDelegationReward", + value: MsgWithdrawDelegatorReward.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawDelegatorRewardProtoMsg): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.decode(message.value); + }, + toProto(message: MsgWithdrawDelegatorReward): Uint8Array { + return MsgWithdrawDelegatorReward.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + value: MsgWithdrawDelegatorReward.encode(message).finish() + }; } - }; - function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { return { amount: [] }; } - export const MsgWithdrawDelegatorRewardResponse = { - encode(message: MsgWithdrawDelegatorRewardResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgWithdrawDelegatorRewardResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgWithdrawDelegatorRewardResponse { + fromPartial(object: Partial): MsgWithdrawDelegatorRewardResponse { const message = createBaseMsgWithdrawDelegatorRewardResponse(); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgWithdrawDelegatorRewardResponseAmino): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgWithdrawDelegatorRewardResponseAminoMsg): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse", + value: MsgWithdrawDelegatorRewardResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawDelegatorRewardResponseProtoMsg): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.decode(message.value); + }, + toProto(message: MsgWithdrawDelegatorRewardResponse): Uint8Array { + return MsgWithdrawDelegatorRewardResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + value: MsgWithdrawDelegatorRewardResponse.encode(message).finish() + }; } - }; - function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { return { validatorAddress: "" }; } - export const MsgWithdrawValidatorCommission = { - encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { 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 : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgWithdrawValidatorCommission(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgWithdrawValidatorCommission { + fromPartial(object: Partial): MsgWithdrawValidatorCommission { const message = createBaseMsgWithdrawValidatorCommission(); message.validatorAddress = object.validatorAddress ?? ""; return message; + }, + fromAmino(object: MsgWithdrawValidatorCommissionAmino): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + return obj; + }, + fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawValidatorCommissionProtoMsg): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.decode(message.value); + }, + toProto(message: MsgWithdrawValidatorCommission): Uint8Array { + return MsgWithdrawValidatorCommission.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.encode(message).finish() + }; } - }; - function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { return { amount: [] }; } - export const MsgWithdrawValidatorCommissionResponse = { - encode(message: MsgWithdrawValidatorCommissionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgWithdrawValidatorCommissionResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgWithdrawValidatorCommissionResponse { + fromPartial(object: Partial): MsgWithdrawValidatorCommissionResponse { const message = createBaseMsgWithdrawValidatorCommissionResponse(); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgWithdrawValidatorCommissionResponseAmino): MsgWithdrawValidatorCommissionResponse { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgWithdrawValidatorCommissionResponseAminoMsg): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse", + value: MsgWithdrawValidatorCommissionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawValidatorCommissionResponseProtoMsg): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.decode(message.value); + }, + toProto(message: MsgWithdrawValidatorCommissionResponse): Uint8Array { + return MsgWithdrawValidatorCommissionResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + value: MsgWithdrawValidatorCommissionResponse.encode(message).finish() + }; } - }; - function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { return { amount: [], depositor: "" }; } - export const MsgFundCommunityPool = { - encode(message: MsgFundCommunityPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + encode(message: MsgFundCommunityPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.depositor !== "") { writer.uint32(18).string(message.depositor); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundCommunityPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgFundCommunityPool(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.amount.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.depositor = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgFundCommunityPool { + fromPartial(object: Partial): MsgFundCommunityPool { const message = createBaseMsgFundCommunityPool(); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; message.depositor = object.depositor ?? ""; return message; + }, + fromAmino(object: MsgFundCommunityPoolAmino): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + return message; + }, + toAmino(message: MsgFundCommunityPool): MsgFundCommunityPoolAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + obj.depositor = message.depositor; + return obj; + }, + fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { + return MsgFundCommunityPool.fromAmino(object.value); + }, + toAminoMsg(message: MsgFundCommunityPool): MsgFundCommunityPoolAminoMsg { + return { + type: "cosmos-sdk/MsgFundCommunityPool", + value: MsgFundCommunityPool.toAmino(message) + }; + }, + fromProtoMsg(message: MsgFundCommunityPoolProtoMsg): MsgFundCommunityPool { + return MsgFundCommunityPool.decode(message.value); + }, + toProto(message: MsgFundCommunityPool): Uint8Array { + return MsgFundCommunityPool.encode(message).finish(); + }, + toProtoMsg(message: MsgFundCommunityPool): MsgFundCommunityPoolProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + value: MsgFundCommunityPool.encode(message).finish() + }; } - }; - function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { return {}; } - export const MsgFundCommunityPoolResponse = { - encode(_: MsgFundCommunityPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgFundCommunityPoolResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgFundCommunityPoolResponse { + fromPartial(_: Partial): MsgFundCommunityPoolResponse { const message = createBaseMsgFundCommunityPoolResponse(); return message; + }, + fromAmino(_: MsgFundCommunityPoolResponseAmino): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, + toAmino(_: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgFundCommunityPoolResponseAminoMsg): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseAminoMsg { + return { + type: "cosmos-sdk/MsgFundCommunityPoolResponse", + value: MsgFundCommunityPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgFundCommunityPoolResponseProtoMsg): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.decode(message.value); + }, + toProto(message: MsgFundCommunityPoolResponse): Uint8Array { + return MsgFundCommunityPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", + value: MsgFundCommunityPoolResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/evidence.ts b/src/codegen/cosmos/evidence/v1beta1/evidence.ts index 8eba14e..9de5887 100644 --- a/src/codegen/cosmos/evidence/v1beta1/evidence.ts +++ b/src/codegen/cosmos/evidence/v1beta1/evidence.ts @@ -1,100 +1,146 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; -import * as _m0 from "protobufjs/minimal"; -import { toTimestamp, Long, fromTimestamp, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** * Equivocation implements the Evidence interface and defines evidence of double * signing misbehavior. */ - export interface Equivocation { - height: Long; - time?: Date; - power: Long; + height: bigint; + time: Date; + power: bigint; consensusAddress: string; } +export interface EquivocationProtoMsg { + typeUrl: "/cosmos.evidence.v1beta1.Equivocation"; + value: Uint8Array; +} +/** + * Equivocation implements the Evidence interface and defines evidence of double + * signing misbehavior. + */ +export interface EquivocationAmino { + height?: string; + time?: string; + power?: string; + consensus_address?: string; +} +export interface EquivocationAminoMsg { + type: "cosmos-sdk/Equivocation"; + value: EquivocationAmino; +} /** * Equivocation implements the Evidence interface and defines evidence of double * signing misbehavior. */ - export interface EquivocationSDKType { - height: Long; - time?: Date; - power: Long; + height: bigint; + time: Date; + power: bigint; consensus_address: string; } - function createBaseEquivocation(): Equivocation { return { - height: Long.ZERO, - time: undefined, - power: Long.ZERO, + height: BigInt(0), + time: new Date(), + power: BigInt(0), consensusAddress: "" }; } - export const Equivocation = { - encode(message: Equivocation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/cosmos.evidence.v1beta1.Equivocation", + encode(message: Equivocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); } - - if (!message.power.isZero()) { + if (message.power !== BigInt(0)) { writer.uint32(24).int64(message.power); } - if (message.consensusAddress !== "") { writer.uint32(34).string(message.consensusAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Equivocation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 2: message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 3: - message.power = (reader.int64() as Long); + message.power = reader.int64(); break; - case 4: message.consensusAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Equivocation { + fromPartial(object: Partial): Equivocation { const message = createBaseEquivocation(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.time = object.time ?? undefined; - message.power = object.power !== undefined && object.power !== null ? Long.fromValue(object.power) : Long.ZERO; + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); message.consensusAddress = object.consensusAddress ?? ""; return message; + }, + fromAmino(object: EquivocationAmino): Equivocation { + const message = createBaseEquivocation(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } + if (object.consensus_address !== undefined && object.consensus_address !== null) { + message.consensusAddress = object.consensus_address; + } + return message; + }, + toAmino(message: Equivocation): EquivocationAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.power = message.power ? message.power.toString() : undefined; + obj.consensus_address = message.consensusAddress; + return obj; + }, + fromAminoMsg(object: EquivocationAminoMsg): Equivocation { + return Equivocation.fromAmino(object.value); + }, + toAminoMsg(message: Equivocation): EquivocationAminoMsg { + return { + type: "cosmos-sdk/Equivocation", + value: Equivocation.toAmino(message) + }; + }, + fromProtoMsg(message: EquivocationProtoMsg): Equivocation { + return Equivocation.decode(message.value); + }, + toProto(message: Equivocation): Uint8Array { + return Equivocation.encode(message).finish(); + }, + toProtoMsg(message: Equivocation): EquivocationProtoMsg { + return { + typeUrl: "/cosmos.evidence.v1beta1.Equivocation", + value: Equivocation.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/genesis.ts b/src/codegen/cosmos/evidence/v1beta1/genesis.ts index 3f28174..7dd363c 100644 --- a/src/codegen/cosmos/evidence/v1beta1/genesis.ts +++ b/src/codegen/cosmos/evidence/v1beta1/genesis.ts @@ -1,60 +1,95 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the evidence module's genesis state. */ - export interface GenesisState { /** evidence defines all the evidence at genesis. */ evidence: Any[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.evidence.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the evidence module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** evidence defines all the evidence at genesis. */ + evidence?: AnyAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the evidence module's genesis state. */ +export interface GenesisStateSDKType { evidence: AnySDKType[]; } - function createBaseGenesisState(): GenesisState { return { evidence: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.evidence.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.evidence.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.evidence = object.evidence?.map(e => Any.fromPartial(e)) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.evidence = object.evidence?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.evidence = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.evidence.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/query.lcd.ts b/src/codegen/cosmos/evidence/v1beta1/query.lcd.ts index ff67bea..5696b22 100644 --- a/src/codegen/cosmos/evidence/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/evidence/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryEvidenceRequest, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -14,28 +13,21 @@ export class LCDQueryClient { this.allEvidence = this.allEvidence.bind(this); } /* Evidence queries evidence based on evidence hash. */ - - async evidence(params: QueryEvidenceRequest): Promise { const endpoint = `cosmos/evidence/v1beta1/evidence/${params.evidenceHash}`; return await this.req.get(endpoint); } /* AllEvidence queries all evidence. */ - - async allEvidence(params: QueryAllEvidenceRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/evidence/v1beta1/evidence`; return await this.req.get(endpoint, options); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/evidence/v1beta1/query.rpc.Query.ts index f55807b..8a7959a 100644 --- a/src/codegen/cosmos/evidence/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/evidence/v1beta1/query.rpc.Query.ts @@ -1,39 +1,33 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryEvidenceRequest, QueryEvidenceResponse, QueryAllEvidenceRequest, QueryAllEvidenceResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** Evidence queries evidence based on evidence hash. */ evidence(request: QueryEvidenceRequest): Promise; /** AllEvidence queries all evidence. */ - allEvidence(request?: QueryAllEvidenceRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.evidence.v1beta1.Query", "Evidence", data); - return promise.then(data => QueryEvidenceResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryEvidenceResponse.decode(new BinaryReader(data))); } - allEvidence(request: QueryAllEvidenceRequest = { pagination: undefined }): Promise { const data = QueryAllEvidenceRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.evidence.v1beta1.Query", "AllEvidence", data); - return promise.then(data => QueryAllEvidenceResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAllEvidenceResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -42,10 +36,8 @@ export const createRpcQueryExtension = (base: QueryClient) => { evidence(request: QueryEvidenceRequest): Promise { return queryService.evidence(request); }, - allEvidence(request?: QueryAllEvidenceRequest): Promise { return queryService.allEvidence(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/query.ts b/src/codegen/cosmos/evidence/v1beta1/query.ts index cacf060..3d9c915 100644 --- a/src/codegen/cosmos/evidence/v1beta1/query.ts +++ b/src/codegen/cosmos/evidence/v1beta1/query.ts @@ -1,260 +1,405 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** QueryEvidenceRequest is the request type for the Query/Evidence RPC method. */ - export interface QueryEvidenceRequest { /** evidence_hash defines the hash of the requested evidence. */ evidenceHash: Uint8Array; } +export interface QueryEvidenceRequestProtoMsg { + typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest"; + value: Uint8Array; +} /** QueryEvidenceRequest is the request type for the Query/Evidence RPC method. */ - -export interface QueryEvidenceRequestSDKType { +export interface QueryEvidenceRequestAmino { /** evidence_hash defines the hash of the requested evidence. */ + evidence_hash?: string; +} +export interface QueryEvidenceRequestAminoMsg { + type: "cosmos-sdk/QueryEvidenceRequest"; + value: QueryEvidenceRequestAmino; +} +/** QueryEvidenceRequest is the request type for the Query/Evidence RPC method. */ +export interface QueryEvidenceRequestSDKType { evidence_hash: Uint8Array; } /** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ - export interface QueryEvidenceResponse { /** evidence returns the requested evidence. */ evidence?: Any; } +export interface QueryEvidenceResponseProtoMsg { + typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse"; + value: Uint8Array; +} /** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ - -export interface QueryEvidenceResponseSDKType { +export interface QueryEvidenceResponseAmino { /** evidence returns the requested evidence. */ + evidence?: AnyAmino; +} +export interface QueryEvidenceResponseAminoMsg { + type: "cosmos-sdk/QueryEvidenceResponse"; + value: QueryEvidenceResponseAmino; +} +/** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ +export interface QueryEvidenceResponseSDKType { evidence?: AnySDKType; } /** * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC * method. */ - export interface QueryAllEvidenceRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryAllEvidenceRequestProtoMsg { + typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceRequest"; + value: Uint8Array; +} /** * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC * method. */ - -export interface QueryAllEvidenceRequestSDKType { +export interface QueryAllEvidenceRequestAmino { /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAllEvidenceRequestAminoMsg { + type: "cosmos-sdk/QueryAllEvidenceRequest"; + value: QueryAllEvidenceRequestAmino; +} +/** + * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceRequestSDKType { pagination?: PageRequestSDKType; } /** * 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; } +export interface QueryAllEvidenceResponseProtoMsg { + typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse"; + value: Uint8Array; +} /** * QueryAllEvidenceResponse is the response type for the Query/AllEvidence RPC * method. */ - -export interface QueryAllEvidenceResponseSDKType { +export interface QueryAllEvidenceResponseAmino { /** evidence returns all evidences. */ - evidence: AnySDKType[]; + evidence?: AnyAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryAllEvidenceResponseAminoMsg { + type: "cosmos-sdk/QueryAllEvidenceResponse"; + value: QueryAllEvidenceResponseAmino; +} +/** + * QueryAllEvidenceResponse is the response type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceResponseSDKType { + evidence: AnySDKType[]; pagination?: PageResponseSDKType; } - function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { return { evidenceHash: new Uint8Array() }; } - export const QueryEvidenceRequest = { - encode(message: QueryEvidenceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest", + encode(message: QueryEvidenceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.evidenceHash.length !== 0) { writer.uint32(10).bytes(message.evidenceHash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryEvidenceRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.evidenceHash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryEvidenceRequest { + fromPartial(object: Partial): QueryEvidenceRequest { const message = createBaseQueryEvidenceRequest(); message.evidenceHash = object.evidenceHash ?? new Uint8Array(); return message; + }, + fromAmino(object: QueryEvidenceRequestAmino): QueryEvidenceRequest { + const message = createBaseQueryEvidenceRequest(); + if (object.evidence_hash !== undefined && object.evidence_hash !== null) { + message.evidenceHash = bytesFromBase64(object.evidence_hash); + } + return message; + }, + toAmino(message: QueryEvidenceRequest): QueryEvidenceRequestAmino { + const obj: any = {}; + obj.evidence_hash = message.evidenceHash ? base64FromBytes(message.evidenceHash) : undefined; + return obj; + }, + fromAminoMsg(object: QueryEvidenceRequestAminoMsg): QueryEvidenceRequest { + return QueryEvidenceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryEvidenceRequest): QueryEvidenceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryEvidenceRequest", + value: QueryEvidenceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryEvidenceRequestProtoMsg): QueryEvidenceRequest { + return QueryEvidenceRequest.decode(message.value); + }, + toProto(message: QueryEvidenceRequest): Uint8Array { + return QueryEvidenceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryEvidenceRequest): QueryEvidenceRequestProtoMsg { + return { + typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest", + value: QueryEvidenceRequest.encode(message).finish() + }; } - }; - function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { return { evidence: undefined }; } - export const QueryEvidenceResponse = { - encode(message: QueryEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse", + encode(message: QueryEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.evidence !== undefined) { Any.encode(message.evidence, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryEvidenceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.evidence = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryEvidenceResponse { + fromPartial(object: Partial): QueryEvidenceResponse { const message = createBaseQueryEvidenceResponse(); message.evidence = object.evidence !== undefined && object.evidence !== null ? Any.fromPartial(object.evidence) : undefined; return message; + }, + fromAmino(object: QueryEvidenceResponseAmino): QueryEvidenceResponse { + const message = createBaseQueryEvidenceResponse(); + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = Any.fromAmino(object.evidence); + } + return message; + }, + toAmino(message: QueryEvidenceResponse): QueryEvidenceResponseAmino { + const obj: any = {}; + obj.evidence = message.evidence ? Any.toAmino(message.evidence) : undefined; + return obj; + }, + fromAminoMsg(object: QueryEvidenceResponseAminoMsg): QueryEvidenceResponse { + return QueryEvidenceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryEvidenceResponse): QueryEvidenceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryEvidenceResponse", + value: QueryEvidenceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryEvidenceResponseProtoMsg): QueryEvidenceResponse { + return QueryEvidenceResponse.decode(message.value); + }, + toProto(message: QueryEvidenceResponse): Uint8Array { + return QueryEvidenceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryEvidenceResponse): QueryEvidenceResponseProtoMsg { + return { + typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse", + value: QueryEvidenceResponse.encode(message).finish() + }; } - }; - function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { return { pagination: undefined }; } - export const QueryAllEvidenceRequest = { - encode(message: QueryAllEvidenceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceRequest", + encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEvidenceRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllEvidenceRequest { + fromPartial(object: Partial): QueryAllEvidenceRequest { const message = createBaseQueryAllEvidenceRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryAllEvidenceRequestAmino): QueryAllEvidenceRequest { + const message = createBaseQueryAllEvidenceRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllEvidenceRequest): QueryAllEvidenceRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllEvidenceRequestAminoMsg): QueryAllEvidenceRequest { + return QueryAllEvidenceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllEvidenceRequest): QueryAllEvidenceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllEvidenceRequest", + value: QueryAllEvidenceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllEvidenceRequestProtoMsg): QueryAllEvidenceRequest { + return QueryAllEvidenceRequest.decode(message.value); + }, + toProto(message: QueryAllEvidenceRequest): Uint8Array { + return QueryAllEvidenceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllEvidenceRequest): QueryAllEvidenceRequestProtoMsg { + return { + typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceRequest", + value: QueryAllEvidenceRequest.encode(message).finish() + }; } - }; - function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { return { evidence: [], pagination: undefined }; } - export const QueryAllEvidenceResponse = { - encode(message: QueryAllEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", + encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEvidenceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.evidence.push(Any.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllEvidenceResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryAllEvidenceResponseAmino): QueryAllEvidenceResponse { + const message = createBaseQueryAllEvidenceResponse(); + message.evidence = object.evidence?.map(e => Any.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllEvidenceResponse): QueryAllEvidenceResponseAmino { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.evidence = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllEvidenceResponseAminoMsg): QueryAllEvidenceResponse { + return QueryAllEvidenceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllEvidenceResponse): QueryAllEvidenceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllEvidenceResponse", + value: QueryAllEvidenceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllEvidenceResponseProtoMsg): QueryAllEvidenceResponse { + return QueryAllEvidenceResponse.decode(message.value); + }, + toProto(message: QueryAllEvidenceResponse): Uint8Array { + return QueryAllEvidenceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllEvidenceResponse): QueryAllEvidenceResponseProtoMsg { + return { + typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", + value: QueryAllEvidenceResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/tx.amino.ts b/src/codegen/cosmos/evidence/v1beta1/tx.amino.ts index 033b9c6..a9da417 100644 --- a/src/codegen/cosmos/evidence/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/evidence/v1beta1/tx.amino.ts @@ -1,41 +1,8 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgSubmitEvidence } from "./tx"; -export interface AminoMsgSubmitEvidence extends AminoMsg { - type: "cosmos-sdk/MsgSubmitEvidence"; - value: { - submitter: string; - evidence: { - type_url: string; - value: Uint8Array; - }; - }; -} export const AminoConverter = { "/cosmos.evidence.v1beta1.MsgSubmitEvidence": { aminoType: "cosmos-sdk/MsgSubmitEvidence", - toAmino: ({ - submitter, - evidence - }: MsgSubmitEvidence): AminoMsgSubmitEvidence["value"] => { - return { - submitter, - evidence: { - type_url: evidence.typeUrl, - value: evidence.value - } - }; - }, - fromAmino: ({ - submitter, - evidence - }: AminoMsgSubmitEvidence["value"]): MsgSubmitEvidence => { - return { - submitter, - evidence: { - typeUrl: evidence.type_url, - value: evidence.value - } - }; - } + toAmino: MsgSubmitEvidence.toAmino, + fromAmino: MsgSubmitEvidence.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/tx.registry.ts b/src/codegen/cosmos/evidence/v1beta1/tx.registry.ts index 327c02b..aea6576 100644 --- a/src/codegen/cosmos/evidence/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/evidence/v1beta1/tx.registry.ts @@ -14,7 +14,6 @@ export const MessageComposer = { value: MsgSubmitEvidence.encode(value).finish() }; } - }, withTypeUrl: { submitEvidence(value: MsgSubmitEvidence) { @@ -23,7 +22,6 @@ export const MessageComposer = { value }; } - }, fromPartial: { submitEvidence(value: MsgSubmitEvidence) { @@ -32,6 +30,5 @@ export const MessageComposer = { value: MsgSubmitEvidence.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/evidence/v1beta1/tx.rpc.msg.ts index afd2235..50e7473 100644 --- a/src/codegen/cosmos/evidence/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/evidence/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgSubmitEvidence, MsgSubmitEvidenceResponse } from "./tx"; /** Msg defines the evidence Msg service. */ - export interface Msg { /** * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or @@ -12,16 +11,13 @@ export interface Msg { } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.submitEvidence = this.submitEvidence.bind(this); } - submitEvidence(request: MsgSubmitEvidence): Promise { const data = MsgSubmitEvidence.encode(request).finish(); const promise = this.rpc.request("cosmos.evidence.v1beta1.Msg", "SubmitEvidence", data); - return promise.then(data => MsgSubmitEvidenceResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgSubmitEvidenceResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/evidence/v1beta1/tx.ts b/src/codegen/cosmos/evidence/v1beta1/tx.ts index 528ba88..83b549a 100644 --- a/src/codegen/cosmos/evidence/v1beta1/tx.ts +++ b/src/codegen/cosmos/evidence/v1beta1/tx.ts @@ -1,133 +1,207 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary * Evidence of misbehavior such as equivocation or counterfactual signing. */ - export interface MsgSubmitEvidence { submitter: string; evidence?: Any; } +export interface MsgSubmitEvidenceProtoMsg { + typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence"; + value: Uint8Array; +} +/** + * MsgSubmitEvidence represents a message that supports submitting arbitrary + * Evidence of misbehavior such as equivocation or counterfactual signing. + */ +export interface MsgSubmitEvidenceAmino { + submitter?: string; + evidence?: AnyAmino; +} +export interface MsgSubmitEvidenceAminoMsg { + type: "cosmos-sdk/MsgSubmitEvidence"; + value: MsgSubmitEvidenceAmino; +} /** * MsgSubmitEvidence represents a message that supports submitting arbitrary * Evidence of misbehavior such as equivocation or counterfactual signing. */ - export interface MsgSubmitEvidenceSDKType { submitter: string; evidence?: AnySDKType; } /** MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. */ - export interface MsgSubmitEvidenceResponse { /** hash defines the hash of the evidence. */ hash: Uint8Array; } +export interface MsgSubmitEvidenceResponseProtoMsg { + typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse"; + value: Uint8Array; +} /** MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. */ - -export interface MsgSubmitEvidenceResponseSDKType { +export interface MsgSubmitEvidenceResponseAmino { /** hash defines the hash of the evidence. */ + hash?: string; +} +export interface MsgSubmitEvidenceResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitEvidenceResponse"; + value: MsgSubmitEvidenceResponseAmino; +} +/** MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. */ +export interface MsgSubmitEvidenceResponseSDKType { hash: Uint8Array; } - function createBaseMsgSubmitEvidence(): MsgSubmitEvidence { return { submitter: "", evidence: undefined }; } - export const MsgSubmitEvidence = { - encode(message: MsgSubmitEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence", + encode(message: MsgSubmitEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.submitter !== "") { writer.uint32(10).string(message.submitter); } - if (message.evidence !== undefined) { Any.encode(message.evidence, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitEvidence { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.submitter = reader.string(); break; - case 2: message.evidence = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitEvidence { + fromPartial(object: Partial): MsgSubmitEvidence { const message = createBaseMsgSubmitEvidence(); message.submitter = object.submitter ?? ""; message.evidence = object.evidence !== undefined && object.evidence !== null ? Any.fromPartial(object.evidence) : undefined; return message; + }, + fromAmino(object: MsgSubmitEvidenceAmino): MsgSubmitEvidence { + const message = createBaseMsgSubmitEvidence(); + if (object.submitter !== undefined && object.submitter !== null) { + message.submitter = object.submitter; + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = Any.fromAmino(object.evidence); + } + return message; + }, + toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { + const obj: any = {}; + obj.submitter = message.submitter; + obj.evidence = message.evidence ? Any.toAmino(message.evidence) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitEvidenceAminoMsg): MsgSubmitEvidence { + return MsgSubmitEvidence.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitEvidence): MsgSubmitEvidenceAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitEvidence", + value: MsgSubmitEvidence.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitEvidenceProtoMsg): MsgSubmitEvidence { + return MsgSubmitEvidence.decode(message.value); + }, + toProto(message: MsgSubmitEvidence): Uint8Array { + return MsgSubmitEvidence.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitEvidence): MsgSubmitEvidenceProtoMsg { + return { + typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence", + value: MsgSubmitEvidence.encode(message).finish() + }; } - }; - function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { return { hash: new Uint8Array() }; } - export const MsgSubmitEvidenceResponse = { - encode(message: MsgSubmitEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", + encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 4: message.hash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitEvidenceResponse { + fromPartial(object: Partial): MsgSubmitEvidenceResponse { const message = createBaseMsgSubmitEvidenceResponse(); message.hash = object.hash ?? new Uint8Array(); return message; + }, + fromAmino(object: MsgSubmitEvidenceResponseAmino): MsgSubmitEvidenceResponse { + const message = createBaseMsgSubmitEvidenceResponse(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: MsgSubmitEvidenceResponse): MsgSubmitEvidenceResponseAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitEvidenceResponseAminoMsg): MsgSubmitEvidenceResponse { + return MsgSubmitEvidenceResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitEvidenceResponse): MsgSubmitEvidenceResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitEvidenceResponse", + value: MsgSubmitEvidenceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitEvidenceResponseProtoMsg): MsgSubmitEvidenceResponse { + return MsgSubmitEvidenceResponse.decode(message.value); + }, + toProto(message: MsgSubmitEvidenceResponse): Uint8Array { + return MsgSubmitEvidenceResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitEvidenceResponse): MsgSubmitEvidenceResponseProtoMsg { + return { + typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", + value: MsgSubmitEvidenceResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/feegrant.ts b/src/codegen/cosmos/feegrant/v1beta1/feegrant.ts index 9a4d6b2..f690579 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/feegrant.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/feegrant.ts @@ -1,14 +1,13 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** * BasicAllowance implements Allowance with a one-time grant of tokens * that optionally expires. The grantee can use up to SpendLimit to cover fees. */ - export interface BasicAllowance { /** * spend_limit specifies the maximum amount of tokens that can be spent @@ -17,259 +16,310 @@ export interface BasicAllowance { */ spendLimit: Coin[]; /** expiration specifies an optional time when this allowance expires */ - expiration?: Date; } +export interface BasicAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance"; + value: Uint8Array; +} /** * BasicAllowance implements Allowance with a one-time grant of tokens * that optionally expires. The grantee can use up to SpendLimit to cover fees. */ - -export interface BasicAllowanceSDKType { +export interface BasicAllowanceAmino { /** * spend_limit specifies the maximum amount of tokens that can be spent * by this allowance and will be updated as tokens are spent. If it is * empty, there is no spend limit and any amount of coins can be spent. */ - spend_limit: CoinSDKType[]; + spend_limit?: CoinAmino[]; /** expiration specifies an optional time when this allowance expires */ - + expiration?: string; +} +export interface BasicAllowanceAminoMsg { + type: "cosmos-sdk/BasicAllowance"; + value: BasicAllowanceAmino; +} +/** + * BasicAllowance implements Allowance with a one-time grant of tokens + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowanceSDKType { + spend_limit: CoinSDKType[]; expiration?: Date; } /** * PeriodicAllowance extends Allowance to allow for both a maximum cap, * as well as a limit per time period. */ - export interface PeriodicAllowance { /** basic specifies a struct of `BasicAllowance` */ - basic?: BasicAllowance; + basic: BasicAllowance; /** * period specifies the time duration in which period_spend_limit coins can * be spent before that allowance is reset */ - - period?: Duration; + period: Duration; /** * 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; + periodReset: Date; +} +export interface PeriodicAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance"; + value: Uint8Array; } /** * PeriodicAllowance extends Allowance to allow for both a maximum cap, * as well as a limit per time period. */ - -export interface PeriodicAllowanceSDKType { +export interface PeriodicAllowanceAmino { /** basic specifies a struct of `BasicAllowance` */ - basic?: BasicAllowanceSDKType; + basic?: BasicAllowanceAmino; /** * period specifies the time duration in which period_spend_limit coins can * be spent before that allowance is reset */ - - period?: DurationSDKType; + period?: DurationAmino; /** * period_spend_limit specifies the maximum number of coins that can be spent * in the period */ - - period_spend_limit: CoinSDKType[]; + period_spend_limit?: CoinAmino[]; /** period_can_spend is the number of coins left to be spent before the period_reset time */ - - period_can_spend: CoinSDKType[]; + period_can_spend?: CoinAmino[]; /** * period_reset is the time at which this period resets and a new one begins, * it is calculated from the start time of the first transaction after the * last period ended */ - - period_reset?: Date; + period_reset?: string; +} +export interface PeriodicAllowanceAminoMsg { + type: "cosmos-sdk/PeriodicAllowance"; + value: PeriodicAllowanceAmino; +} +/** + * PeriodicAllowance extends Allowance to allow for both a maximum cap, + * as well as a limit per time period. + */ +export interface PeriodicAllowanceSDKType { + basic: BasicAllowanceSDKType; + period: DurationSDKType; + period_spend_limit: CoinSDKType[]; + period_can_spend: CoinSDKType[]; + period_reset: Date; } /** AllowedMsgAllowance creates allowance only for specified message types. */ - export interface AllowedMsgAllowance { /** allowance can be any of basic and periodic fee allowance. */ allowance?: Any; /** allowed_messages are the messages for which the grantee has the access. */ - allowedMessages: string[]; } +export interface AllowedMsgAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance"; + value: Uint8Array; +} /** AllowedMsgAllowance creates allowance only for specified message types. */ - -export interface AllowedMsgAllowanceSDKType { +export interface AllowedMsgAllowanceAmino { /** allowance can be any of basic and periodic fee allowance. */ - allowance?: AnySDKType; + allowance?: AnyAmino; /** allowed_messages are the messages for which the grantee has the access. */ - + allowed_messages?: string[]; +} +export interface AllowedMsgAllowanceAminoMsg { + type: "cosmos-sdk/AllowedMsgAllowance"; + value: AllowedMsgAllowanceAmino; +} +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowanceSDKType { + allowance?: AnySDKType; allowed_messages: string[]; } /** Grant is stored in the KVStore to record a grant with full context */ - export interface Grant { /** granter is the address of the user granting an allowance of their funds. */ granter: string; /** grantee is the address of the user being granted an allowance of another user's funds. */ - grantee: string; /** allowance can be any of basic, periodic, allowed fee allowance. */ - allowance?: Any; } +export interface GrantProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.Grant"; + value: Uint8Array; +} /** Grant is stored in the KVStore to record a grant with full context */ - -export interface GrantSDKType { +export interface GrantAmino { /** granter is the address of the user granting an allowance of their funds. */ - granter: string; + granter?: string; /** grantee is the address of the user being granted an allowance of another user's funds. */ - - grantee: string; + grantee?: string; /** allowance can be any of basic, periodic, allowed fee allowance. */ - + allowance?: AnyAmino; +} +export interface GrantAminoMsg { + type: "cosmos-sdk/Grant"; + value: GrantAmino; +} +/** Grant is stored in the KVStore to record a grant with full context */ +export interface GrantSDKType { + granter: string; + grantee: string; allowance?: AnySDKType; } - function createBaseBasicAllowance(): BasicAllowance { return { spendLimit: [], expiration: undefined }; } - export const BasicAllowance = { - encode(message: BasicAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", + encode(message: BasicAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.spendLimit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.expiration !== undefined) { Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BasicAllowance { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.spendLimit.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BasicAllowance { + fromPartial(object: Partial): BasicAllowance { const message = createBaseBasicAllowance(); message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || []; message.expiration = object.expiration ?? undefined; return message; + }, + fromAmino(object: BasicAllowanceAmino): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spendLimit = object.spend_limit?.map(e => Coin.fromAmino(e)) || []; + if (object.expiration !== undefined && object.expiration !== null) { + message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); + } + return message; + }, + toAmino(message: BasicAllowance): BasicAllowanceAmino { + const obj: any = {}; + if (message.spendLimit) { + obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.spend_limit = []; + } + obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; + return obj; + }, + fromAminoMsg(object: BasicAllowanceAminoMsg): BasicAllowance { + return BasicAllowance.fromAmino(object.value); + }, + toAminoMsg(message: BasicAllowance): BasicAllowanceAminoMsg { + return { + type: "cosmos-sdk/BasicAllowance", + value: BasicAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: BasicAllowanceProtoMsg): BasicAllowance { + return BasicAllowance.decode(message.value); + }, + toProto(message: BasicAllowance): Uint8Array { + return BasicAllowance.encode(message).finish(); + }, + toProtoMsg(message: BasicAllowance): BasicAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", + value: BasicAllowance.encode(message).finish() + }; } - }; - function createBasePeriodicAllowance(): PeriodicAllowance { return { - basic: undefined, - period: undefined, + basic: BasicAllowance.fromPartial({}), + period: Duration.fromPartial({}), periodSpendLimit: [], periodCanSpend: [], - periodReset: undefined + periodReset: new Date() }; } - export const PeriodicAllowance = { - encode(message: PeriodicAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", + encode(message: PeriodicAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.basic !== undefined) { BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim(); } - if (message.period !== undefined) { Duration.encode(message.period, writer.uint32(18).fork()).ldelim(); } - for (const v of message.periodSpendLimit) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.periodCanSpend) { Coin.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.periodReset !== undefined) { Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PeriodicAllowance { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.basic = BasicAllowance.decode(reader, reader.uint32()); break; - case 2: message.period = Duration.decode(reader, reader.uint32()); break; - case 3: message.periodSpendLimit.push(Coin.decode(reader, reader.uint32())); break; - case 4: message.periodCanSpend.push(Coin.decode(reader, reader.uint32())); break; - case 5: message.periodReset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PeriodicAllowance { + fromPartial(object: Partial): 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; @@ -277,65 +327,144 @@ export const PeriodicAllowance = { message.periodCanSpend = object.periodCanSpend?.map(e => Coin.fromPartial(e)) || []; message.periodReset = object.periodReset ?? undefined; return message; + }, + fromAmino(object: PeriodicAllowanceAmino): PeriodicAllowance { + const message = createBasePeriodicAllowance(); + if (object.basic !== undefined && object.basic !== null) { + message.basic = BasicAllowance.fromAmino(object.basic); + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + message.periodSpendLimit = object.period_spend_limit?.map(e => Coin.fromAmino(e)) || []; + message.periodCanSpend = object.period_can_spend?.map(e => Coin.fromAmino(e)) || []; + if (object.period_reset !== undefined && object.period_reset !== null) { + message.periodReset = fromTimestamp(Timestamp.fromAmino(object.period_reset)); + } + return message; + }, + toAmino(message: PeriodicAllowance): PeriodicAllowanceAmino { + const obj: any = {}; + obj.basic = message.basic ? BasicAllowance.toAmino(message.basic) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + if (message.periodSpendLimit) { + obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.period_spend_limit = []; + } + if (message.periodCanSpend) { + obj.period_can_spend = message.periodCanSpend.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.period_can_spend = []; + } + obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : undefined; + return obj; + }, + fromAminoMsg(object: PeriodicAllowanceAminoMsg): PeriodicAllowance { + return PeriodicAllowance.fromAmino(object.value); + }, + toAminoMsg(message: PeriodicAllowance): PeriodicAllowanceAminoMsg { + return { + type: "cosmos-sdk/PeriodicAllowance", + value: PeriodicAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: PeriodicAllowanceProtoMsg): PeriodicAllowance { + return PeriodicAllowance.decode(message.value); + }, + toProto(message: PeriodicAllowance): Uint8Array { + return PeriodicAllowance.encode(message).finish(); + }, + toProtoMsg(message: PeriodicAllowance): PeriodicAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", + value: PeriodicAllowance.encode(message).finish() + }; } - }; - function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { return { allowance: undefined, allowedMessages: [] }; } - export const AllowedMsgAllowance = { - encode(message: AllowedMsgAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", + encode(message: AllowedMsgAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowance !== undefined) { Any.encode(message.allowance, writer.uint32(10).fork()).ldelim(); } - for (const v of message.allowedMessages) { writer.uint32(18).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AllowedMsgAllowance { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.allowance = Any.decode(reader, reader.uint32()); break; - case 2: message.allowedMessages.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AllowedMsgAllowance { + fromPartial(object: Partial): 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; + }, + fromAmino(object: AllowedMsgAllowanceAmino): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = Any.fromAmino(object.allowance); + } + message.allowedMessages = object.allowed_messages?.map(e => e) || []; + return message; + }, + toAmino(message: AllowedMsgAllowance): AllowedMsgAllowanceAmino { + const obj: any = {}; + obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; + if (message.allowedMessages) { + obj.allowed_messages = message.allowedMessages.map(e => e); + } else { + obj.allowed_messages = []; + } + return obj; + }, + fromAminoMsg(object: AllowedMsgAllowanceAminoMsg): AllowedMsgAllowance { + return AllowedMsgAllowance.fromAmino(object.value); + }, + toAminoMsg(message: AllowedMsgAllowance): AllowedMsgAllowanceAminoMsg { + return { + type: "cosmos-sdk/AllowedMsgAllowance", + value: AllowedMsgAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: AllowedMsgAllowanceProtoMsg): AllowedMsgAllowance { + return AllowedMsgAllowance.decode(message.value); + }, + toProto(message: AllowedMsgAllowance): Uint8Array { + return AllowedMsgAllowance.encode(message).finish(); + }, + toProtoMsg(message: AllowedMsgAllowance): AllowedMsgAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", + value: AllowedMsgAllowance.encode(message).finish() + }; } - }; - function createBaseGrant(): Grant { return { granter: "", @@ -343,60 +472,89 @@ function createBaseGrant(): Grant { allowance: undefined }; } - export const Grant = { - encode(message: Grant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.Grant", + encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.grantee !== "") { writer.uint32(18).string(message.grantee); } - if (message.allowance !== undefined) { Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Grant { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGrant(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.granter = reader.string(); break; - case 2: message.grantee = reader.string(); break; - case 3: message.allowance = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Grant { + fromPartial(object: Partial): 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; + }, + fromAmino(object: GrantAmino): Grant { + const message = createBaseGrant(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = Any.fromAmino(object.allowance); + } + return message; + }, + toAmino(message: Grant): GrantAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; + return obj; + }, + fromAminoMsg(object: GrantAminoMsg): Grant { + return Grant.fromAmino(object.value); + }, + toAminoMsg(message: Grant): GrantAminoMsg { + return { + type: "cosmos-sdk/Grant", + value: Grant.toAmino(message) + }; + }, + fromProtoMsg(message: GrantProtoMsg): Grant { + return Grant.decode(message.value); + }, + toProto(message: Grant): Uint8Array { + return Grant.encode(message).finish(); + }, + toProtoMsg(message: Grant): GrantProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.Grant", + value: Grant.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/genesis.ts b/src/codegen/cosmos/feegrant/v1beta1/genesis.ts index 2a4eecd..58ceb02 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/genesis.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/genesis.ts @@ -1,58 +1,93 @@ -import { Grant, GrantSDKType } from "./feegrant"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState contains a set of fee allowances, persisted from the store */ - export interface GenesisState { allowances: Grant[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState contains a set of fee allowances, persisted from the store */ +export interface GenesisStateAmino { + allowances?: GrantAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} /** GenesisState contains a set of fee allowances, persisted from the store */ - export interface GenesisStateSDKType { allowances: GrantSDKType[]; } - function createBaseGenesisState(): GenesisState { return { allowances: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.allowances.push(Grant.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.allowances = object.allowances?.map(e => Grant.fromPartial(e)) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.allowances = object.allowances?.map(e => Grant.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); + } else { + obj.allowances = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/query.lcd.ts b/src/codegen/cosmos/feegrant/v1beta1/query.lcd.ts index c486edb..6ecda48 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryAllowanceRequest, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -15,42 +14,31 @@ export class LCDQueryClient { this.allowancesByGranter = this.allowancesByGranter.bind(this); } /* Allowance returns fee granted to the grantee by the granter. */ - - async allowance(params: QueryAllowanceRequest): Promise { const endpoint = `cosmos/feegrant/v1beta1/allowance/${params.granter}/${params.grantee}`; return await this.req.get(endpoint); } /* Allowances returns all the grants for address. */ - - async allowances(params: QueryAllowancesRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/feegrant/v1beta1/allowances/${params.grantee}`; return await this.req.get(endpoint, options); } /* AllowancesByGranter returns all the grants given by an address Since v0.46 */ - - async allowancesByGranter(params: QueryAllowancesByGranterRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/feegrant/v1beta1/issued/${params.granter}`; return await this.req.get(endpoint, options); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/feegrant/v1beta1/query.rpc.Query.ts index a23808d..610becf 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/query.rpc.Query.ts @@ -1,50 +1,42 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAllowanceRequest, QueryAllowanceResponse, QueryAllowancesRequest, QueryAllowancesResponse, QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** Allowance returns fee granted to the grantee by the granter. */ allowance(request: QueryAllowanceRequest): Promise; /** Allowances returns all the grants for address. */ - allowances(request: QueryAllowancesRequest): Promise; /** * AllowancesByGranter returns all the grants given by an address * Since v0.46 */ - allowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.feegrant.v1beta1.Query", "Allowance", data); - return promise.then(data => QueryAllowanceResponse.decode(new _m0.Reader(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("cosmos.feegrant.v1beta1.Query", "Allowances", data); - return promise.then(data => QueryAllowancesResponse.decode(new _m0.Reader(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("cosmos.feegrant.v1beta1.Query", "AllowancesByGranter", data); - return promise.then(data => QueryAllowancesByGranterResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAllowancesByGranterResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -53,14 +45,11 @@ export const createRpcQueryExtension = (base: QueryClient) => { allowance(request: QueryAllowanceRequest): Promise { return queryService.allowance(request); }, - allowances(request: QueryAllowancesRequest): Promise { return queryService.allowances(request); }, - allowancesByGranter(request: QueryAllowancesByGranterRequest): Promise { return queryService.allowancesByGranter(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/query.ts b/src/codegen/cosmos/feegrant/v1beta1/query.ts index 0f2c955..48dfd45 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/query.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/query.ts @@ -1,422 +1,634 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Grant, GrantSDKType } from "./feegrant"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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; } +export interface QueryAllowanceRequestProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest"; + value: Uint8Array; +} /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ - -export interface QueryAllowanceRequestSDKType { +export interface QueryAllowanceRequestAmino { /** granter is the address of the user granting an allowance of their funds. */ - granter: string; + granter?: string; /** grantee is the address of the user being granted an allowance of another user's funds. */ - + grantee?: string; +} +export interface QueryAllowanceRequestAminoMsg { + type: "cosmos-sdk/QueryAllowanceRequest"; + value: QueryAllowanceRequestAmino; +} +/** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ +export interface QueryAllowanceRequestSDKType { + granter: string; 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; } +export interface QueryAllowanceResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse"; + value: Uint8Array; +} /** QueryAllowanceResponse is the response type for the Query/Allowance RPC method. */ - -export interface QueryAllowanceResponseSDKType { +export interface QueryAllowanceResponseAmino { /** allowance is a allowance granted for grantee by granter. */ + allowance?: GrantAmino; +} +export interface QueryAllowanceResponseAminoMsg { + type: "cosmos-sdk/QueryAllowanceResponse"; + value: QueryAllowanceResponseAmino; +} +/** QueryAllowanceResponse is the response type for the Query/Allowance RPC method. */ +export interface QueryAllowanceResponseSDKType { allowance?: GrantSDKType; } /** 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; } +export interface QueryAllowancesRequestProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest"; + value: Uint8Array; +} +/** QueryAllowancesRequest is the request type for the Query/Allowances RPC method. */ +export interface QueryAllowancesRequestAmino { + grantee?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAllowancesRequestAminoMsg { + type: "cosmos-sdk/QueryAllowancesRequest"; + value: QueryAllowancesRequestAmino; +} /** QueryAllowancesRequest is the request type for the Query/Allowances RPC method. */ - export interface QueryAllowancesRequestSDKType { grantee: string; - /** pagination defines an pagination for the request. */ - pagination?: PageRequestSDKType; } /** 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; } +export interface QueryAllowancesResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse"; + value: Uint8Array; +} /** QueryAllowancesResponse is the response type for the Query/Allowances RPC method. */ - -export interface QueryAllowancesResponseSDKType { +export interface QueryAllowancesResponseAmino { /** allowances are allowance's granted for grantee by granter. */ - allowances: GrantSDKType[]; + allowances?: GrantAmino[]; /** pagination defines an pagination for the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryAllowancesResponseAminoMsg { + type: "cosmos-sdk/QueryAllowancesResponse"; + value: QueryAllowancesResponseAmino; +} +/** QueryAllowancesResponse is the response type for the Query/Allowances RPC method. */ +export interface QueryAllowancesResponseSDKType { + allowances: GrantSDKType[]; pagination?: PageResponseSDKType; } /** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */ - export interface QueryAllowancesByGranterRequest { granter: string; /** pagination defines an pagination for the request. */ - pagination?: PageRequest; } +export interface QueryAllowancesByGranterRequestProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest"; + value: Uint8Array; +} +/** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */ +export interface QueryAllowancesByGranterRequestAmino { + granter?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAllowancesByGranterRequestAminoMsg { + type: "cosmos-sdk/QueryAllowancesByGranterRequest"; + value: QueryAllowancesByGranterRequestAmino; +} /** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */ - export interface QueryAllowancesByGranterRequestSDKType { granter: string; - /** pagination defines an pagination for the request. */ - pagination?: PageRequestSDKType; } /** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */ - export interface QueryAllowancesByGranterResponse { /** allowances that have been issued by the granter. */ allowances: Grant[]; /** pagination defines an pagination for the response. */ - pagination?: PageResponse; } +export interface QueryAllowancesByGranterResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse"; + value: Uint8Array; +} /** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */ - -export interface QueryAllowancesByGranterResponseSDKType { +export interface QueryAllowancesByGranterResponseAmino { /** allowances that have been issued by the granter. */ - allowances: GrantSDKType[]; + allowances?: GrantAmino[]; /** pagination defines an pagination for the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryAllowancesByGranterResponseAminoMsg { + type: "cosmos-sdk/QueryAllowancesByGranterResponse"; + value: QueryAllowancesByGranterResponseAmino; +} +/** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */ +export interface QueryAllowancesByGranterResponseSDKType { + allowances: GrantSDKType[]; pagination?: PageResponseSDKType; } - function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { return { granter: "", grantee: "" }; } - export const QueryAllowanceRequest = { - encode(message: QueryAllowanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", + encode(message: QueryAllowanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.grantee !== "") { writer.uint32(18).string(message.grantee); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowanceRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.granter = reader.string(); break; - case 2: message.grantee = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllowanceRequest { + fromPartial(object: Partial): QueryAllowanceRequest { const message = createBaseQueryAllowanceRequest(); message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; return message; + }, + fromAmino(object: QueryAllowanceRequestAmino): QueryAllowanceRequest { + const message = createBaseQueryAllowanceRequest(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + return obj; + }, + fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { + return QueryAllowanceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowanceRequest): QueryAllowanceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllowanceRequest", + value: QueryAllowanceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowanceRequestProtoMsg): QueryAllowanceRequest { + return QueryAllowanceRequest.decode(message.value); + }, + toProto(message: QueryAllowanceRequest): Uint8Array { + return QueryAllowanceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowanceRequest): QueryAllowanceRequestProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", + value: QueryAllowanceRequest.encode(message).finish() + }; } - }; - function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { return { allowance: undefined }; } - export const QueryAllowanceResponse = { - encode(message: QueryAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", + encode(message: QueryAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowance !== undefined) { Grant.encode(message.allowance, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowanceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.allowance = Grant.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllowanceResponse { + fromPartial(object: Partial): QueryAllowanceResponse { const message = createBaseQueryAllowanceResponse(); message.allowance = object.allowance !== undefined && object.allowance !== null ? Grant.fromPartial(object.allowance) : undefined; return message; + }, + fromAmino(object: QueryAllowanceResponseAmino): QueryAllowanceResponse { + const message = createBaseQueryAllowanceResponse(); + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = Grant.fromAmino(object.allowance); + } + return message; + }, + toAmino(message: QueryAllowanceResponse): QueryAllowanceResponseAmino { + const obj: any = {}; + obj.allowance = message.allowance ? Grant.toAmino(message.allowance) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowanceResponseAminoMsg): QueryAllowanceResponse { + return QueryAllowanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowanceResponse): QueryAllowanceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllowanceResponse", + value: QueryAllowanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowanceResponseProtoMsg): QueryAllowanceResponse { + return QueryAllowanceResponse.decode(message.value); + }, + toProto(message: QueryAllowanceResponse): Uint8Array { + return QueryAllowanceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowanceResponse): QueryAllowanceResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", + value: QueryAllowanceResponse.encode(message).finish() + }; } - }; - function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { return { grantee: "", pagination: undefined }; } - export const QueryAllowancesRequest = { - encode(message: QueryAllowancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", + encode(message: QueryAllowancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.grantee = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllowancesRequest { + fromPartial(object: Partial): QueryAllowancesRequest { const message = createBaseQueryAllowancesRequest(); message.grantee = object.grantee ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryAllowancesRequestAmino): QueryAllowancesRequest { + const message = createBaseQueryAllowancesRequest(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { + const obj: any = {}; + obj.grantee = message.grantee; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowancesRequestAminoMsg): QueryAllowancesRequest { + return QueryAllowancesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowancesRequest): QueryAllowancesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllowancesRequest", + value: QueryAllowancesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowancesRequestProtoMsg): QueryAllowancesRequest { + return QueryAllowancesRequest.decode(message.value); + }, + toProto(message: QueryAllowancesRequest): Uint8Array { + return QueryAllowancesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowancesRequest): QueryAllowancesRequestProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", + value: QueryAllowancesRequest.encode(message).finish() + }; } - }; - function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { return { allowances: [], pagination: undefined }; } - export const QueryAllowancesResponse = { - encode(message: QueryAllowancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", + encode(message: QueryAllowancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.allowances.push(Grant.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllowancesResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryAllowancesResponseAmino): QueryAllowancesResponse { + const message = createBaseQueryAllowancesResponse(); + message.allowances = object.allowances?.map(e => Grant.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllowancesResponse): QueryAllowancesResponseAmino { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); + } else { + obj.allowances = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowancesResponseAminoMsg): QueryAllowancesResponse { + return QueryAllowancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowancesResponse): QueryAllowancesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllowancesResponse", + value: QueryAllowancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowancesResponseProtoMsg): QueryAllowancesResponse { + return QueryAllowancesResponse.decode(message.value); + }, + toProto(message: QueryAllowancesResponse): Uint8Array { + return QueryAllowancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowancesResponse): QueryAllowancesResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", + value: QueryAllowancesResponse.encode(message).finish() + }; } - }; - function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRequest { return { granter: "", pagination: undefined }; } - export const QueryAllowancesByGranterRequest = { - encode(message: QueryAllowancesByGranterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", + encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.granter = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllowancesByGranterRequest { + fromPartial(object: Partial): QueryAllowancesByGranterRequest { const message = createBaseQueryAllowancesByGranterRequest(); message.granter = object.granter ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryAllowancesByGranterRequestAmino): QueryAllowancesByGranterRequest { + const message = createBaseQueryAllowancesByGranterRequest(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowancesByGranterRequestAminoMsg): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllowancesByGranterRequest", + value: QueryAllowancesByGranterRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowancesByGranterRequestProtoMsg): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.decode(message.value); + }, + toProto(message: QueryAllowancesByGranterRequest): Uint8Array { + return QueryAllowancesByGranterRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", + value: QueryAllowancesByGranterRequest.encode(message).finish() + }; } - }; - function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterResponse { return { allowances: [], pagination: undefined }; } - export const QueryAllowancesByGranterResponse = { - encode(message: QueryAllowancesByGranterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", + encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.allowances.push(Grant.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAllowancesByGranterResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryAllowancesByGranterResponseAmino): QueryAllowancesByGranterResponse { + const message = createBaseQueryAllowancesByGranterResponse(); + message.allowances = object.allowances?.map(e => Grant.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllowancesByGranterResponse): QueryAllowancesByGranterResponseAmino { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); + } else { + obj.allowances = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowancesByGranterResponseAminoMsg): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowancesByGranterResponse): QueryAllowancesByGranterResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllowancesByGranterResponse", + value: QueryAllowancesByGranterResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowancesByGranterResponseProtoMsg): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.decode(message.value); + }, + toProto(message: QueryAllowancesByGranterResponse): Uint8Array { + return QueryAllowancesByGranterResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowancesByGranterResponse): QueryAllowancesByGranterResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", + value: QueryAllowancesByGranterResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/tx.amino.ts b/src/codegen/cosmos/feegrant/v1beta1/tx.amino.ts index 72aa6e5..1a5cbbb 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/tx.amino.ts @@ -1,74 +1,13 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; -export interface AminoMsgGrantAllowance extends AminoMsg { - type: "cosmos-sdk/MsgGrantAllowance"; - value: { - granter: string; - grantee: string; - allowance: { - type_url: string; - value: Uint8Array; - }; - }; -} -export interface AminoMsgRevokeAllowance extends AminoMsg { - type: "cosmos-sdk/MsgRevokeAllowance"; - value: { - granter: string; - grantee: string; - }; -} export const AminoConverter = { "/cosmos.feegrant.v1beta1.MsgGrantAllowance": { aminoType: "cosmos-sdk/MsgGrantAllowance", - toAmino: ({ - granter, - grantee, - allowance - }: MsgGrantAllowance): AminoMsgGrantAllowance["value"] => { - return { - granter, - grantee, - allowance: { - type_url: allowance.typeUrl, - value: allowance.value - } - }; - }, - fromAmino: ({ - granter, - grantee, - allowance - }: AminoMsgGrantAllowance["value"]): MsgGrantAllowance => { - return { - granter, - grantee, - allowance: { - typeUrl: allowance.type_url, - value: allowance.value - } - }; - } + toAmino: MsgGrantAllowance.toAmino, + fromAmino: MsgGrantAllowance.fromAmino }, "/cosmos.feegrant.v1beta1.MsgRevokeAllowance": { aminoType: "cosmos-sdk/MsgRevokeAllowance", - toAmino: ({ - granter, - grantee - }: MsgRevokeAllowance): AminoMsgRevokeAllowance["value"] => { - return { - granter, - grantee - }; - }, - fromAmino: ({ - granter, - grantee - }: AminoMsgRevokeAllowance["value"]): MsgRevokeAllowance => { - return { - granter, - grantee - }; - } + toAmino: MsgRevokeAllowance.toAmino, + fromAmino: MsgRevokeAllowance.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/tx.registry.ts b/src/codegen/cosmos/feegrant/v1beta1/tx.registry.ts index 71c8e6e..db2faf6 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/tx.registry.ts @@ -14,14 +14,12 @@ export const MessageComposer = { value: MsgGrantAllowance.encode(value).finish() }; }, - revokeAllowance(value: MsgRevokeAllowance) { return { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.encode(value).finish() }; } - }, withTypeUrl: { grantAllowance(value: MsgGrantAllowance) { @@ -30,14 +28,12 @@ export const MessageComposer = { value }; }, - revokeAllowance(value: MsgRevokeAllowance) { return { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value }; } - }, fromPartial: { grantAllowance(value: MsgGrantAllowance) { @@ -46,13 +42,11 @@ export const MessageComposer = { value: MsgGrantAllowance.fromPartial(value) }; }, - revokeAllowance(value: MsgRevokeAllowance) { return { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/feegrant/v1beta1/tx.rpc.msg.ts index 1bc315e..34b6550 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgGrantAllowance, MsgGrantAllowanceResponse, MsgRevokeAllowance, MsgRevokeAllowanceResponse } from "./tx"; /** Msg defines the feegrant msg service. */ - export interface Msg { /** * GrantAllowance grants fee allowance to the grantee on the granter's @@ -13,28 +12,23 @@ export interface Msg { * RevokeAllowance revokes any fee allowance of granter's account that * has been granted to the grantee. */ - revokeAllowance(request: MsgRevokeAllowance): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.grantAllowance = this.grantAllowance.bind(this); this.revokeAllowance = this.revokeAllowance.bind(this); } - grantAllowance(request: MsgGrantAllowance): Promise { const data = MsgGrantAllowance.encode(request).finish(); const promise = this.rpc.request("cosmos.feegrant.v1beta1.Msg", "GrantAllowance", data); - return promise.then(data => MsgGrantAllowanceResponse.decode(new _m0.Reader(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("cosmos.feegrant.v1beta1.Msg", "RevokeAllowance", data); - return promise.then(data => MsgRevokeAllowanceResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgRevokeAllowanceResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/feegrant/v1beta1/tx.ts b/src/codegen/cosmos/feegrant/v1beta1/tx.ts index b0141b2..adc17cf 100644 --- a/src/codegen/cosmos/feegrant/v1beta1/tx.ts +++ b/src/codegen/cosmos/feegrant/v1beta1/tx.ts @@ -1,67 +1,101 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * 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; } +export interface MsgGrantAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance"; + value: Uint8Array; +} /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance * of fees from the account of Granter. */ - -export interface MsgGrantAllowanceSDKType { +export interface MsgGrantAllowanceAmino { /** granter is the address of the user granting an allowance of their funds. */ - granter: string; + granter?: string; /** grantee is the address of the user being granted an allowance of another user's funds. */ - - grantee: string; + grantee?: string; /** allowance can be any of basic, periodic, allowed fee allowance. */ - + allowance?: AnyAmino; +} +export interface MsgGrantAllowanceAminoMsg { + type: "cosmos-sdk/MsgGrantAllowance"; + value: MsgGrantAllowanceAmino; +} +/** + * MsgGrantAllowance adds permission for Grantee to spend up to Allowance + * of fees from the account of Granter. + */ +export interface MsgGrantAllowanceSDKType { + granter: string; + grantee: string; allowance?: AnySDKType; } /** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ - export interface MsgGrantAllowanceResponse {} +export interface MsgGrantAllowanceResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse"; + value: Uint8Array; +} +/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ +export interface MsgGrantAllowanceResponseAmino {} +export interface MsgGrantAllowanceResponseAminoMsg { + type: "cosmos-sdk/MsgGrantAllowanceResponse"; + value: MsgGrantAllowanceResponseAmino; +} /** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ - export interface MsgGrantAllowanceResponseSDKType {} /** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ - export interface MsgRevokeAllowance { /** granter is the address of the user granting an allowance of their funds. */ granter: string; /** grantee is the address of the user being granted an allowance of another user's funds. */ - grantee: string; } +export interface MsgRevokeAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance"; + value: Uint8Array; +} /** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ - -export interface MsgRevokeAllowanceSDKType { +export interface MsgRevokeAllowanceAmino { /** granter is the address of the user granting an allowance of their funds. */ - granter: string; + granter?: string; /** grantee is the address of the user being granted an allowance of another user's funds. */ - + grantee?: string; +} +export interface MsgRevokeAllowanceAminoMsg { + type: "cosmos-sdk/MsgRevokeAllowance"; + value: MsgRevokeAllowanceAmino; +} +/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ +export interface MsgRevokeAllowanceSDKType { + granter: string; grantee: string; } /** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ - export interface MsgRevokeAllowanceResponse {} +export interface MsgRevokeAllowanceResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse"; + value: Uint8Array; +} +/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ +export interface MsgRevokeAllowanceResponseAmino {} +export interface MsgRevokeAllowanceResponseAminoMsg { + type: "cosmos-sdk/MsgRevokeAllowanceResponse"; + value: MsgRevokeAllowanceResponseAmino; +} /** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ - export interface MsgRevokeAllowanceResponseSDKType {} - function createBaseMsgGrantAllowance(): MsgGrantAllowance { return { granter: "", @@ -69,183 +103,282 @@ function createBaseMsgGrantAllowance(): MsgGrantAllowance { allowance: undefined }; } - export const MsgGrantAllowance = { - encode(message: MsgGrantAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + encode(message: MsgGrantAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.grantee !== "") { writer.uint32(18).string(message.grantee); } - if (message.allowance !== undefined) { Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantAllowance { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgGrantAllowance(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.granter = reader.string(); break; - case 2: message.grantee = reader.string(); break; - case 3: message.allowance = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgGrantAllowance { + fromPartial(object: Partial): 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; + }, + fromAmino(object: MsgGrantAllowanceAmino): MsgGrantAllowance { + const message = createBaseMsgGrantAllowance(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = Any.fromAmino(object.allowance); + } + return message; + }, + toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGrantAllowanceAminoMsg): MsgGrantAllowance { + return MsgGrantAllowance.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantAllowance): MsgGrantAllowanceAminoMsg { + return { + type: "cosmos-sdk/MsgGrantAllowance", + value: MsgGrantAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantAllowanceProtoMsg): MsgGrantAllowance { + return MsgGrantAllowance.decode(message.value); + }, + toProto(message: MsgGrantAllowance): Uint8Array { + return MsgGrantAllowance.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantAllowance): MsgGrantAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + value: MsgGrantAllowance.encode(message).finish() + }; } - }; - function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { return {}; } - export const MsgGrantAllowanceResponse = { - encode(_: MsgGrantAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantAllowanceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgGrantAllowanceResponse { + fromPartial(_: Partial): MsgGrantAllowanceResponse { const message = createBaseMsgGrantAllowanceResponse(); return message; + }, + fromAmino(_: MsgGrantAllowanceResponseAmino): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, + toAmino(_: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGrantAllowanceResponseAminoMsg): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAminoMsg { + return { + type: "cosmos-sdk/MsgGrantAllowanceResponse", + value: MsgGrantAllowanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantAllowanceResponseProtoMsg): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.decode(message.value); + }, + toProto(message: MsgGrantAllowanceResponse): Uint8Array { + return MsgGrantAllowanceResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", + value: MsgGrantAllowanceResponse.encode(message).finish() + }; } - }; - function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { return { granter: "", grantee: "" }; } - export const MsgRevokeAllowance = { - encode(message: MsgRevokeAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + encode(message: MsgRevokeAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); } - if (message.grantee !== "") { writer.uint32(18).string(message.grantee); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeAllowance { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.granter = reader.string(); break; - case 2: message.grantee = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgRevokeAllowance { + fromPartial(object: Partial): MsgRevokeAllowance { const message = createBaseMsgRevokeAllowance(); message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; return message; + }, + fromAmino(object: MsgRevokeAllowanceAmino): MsgRevokeAllowance { + const message = createBaseMsgRevokeAllowance(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + return obj; + }, + fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { + return MsgRevokeAllowance.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeAllowance", + value: MsgRevokeAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeAllowanceProtoMsg): MsgRevokeAllowance { + return MsgRevokeAllowance.decode(message.value); + }, + toProto(message: MsgRevokeAllowance): Uint8Array { + return MsgRevokeAllowance.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + value: MsgRevokeAllowance.encode(message).finish() + }; } - }; - function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { return {}; } - export const MsgRevokeAllowanceResponse = { - encode(_: MsgRevokeAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgRevokeAllowanceResponse { + fromPartial(_: Partial): MsgRevokeAllowanceResponse { const message = createBaseMsgRevokeAllowanceResponse(); return message; + }, + fromAmino(_: MsgRevokeAllowanceResponseAmino): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, + toAmino(_: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRevokeAllowanceResponseAminoMsg): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeAllowanceResponse", + value: MsgRevokeAllowanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeAllowanceResponseProtoMsg): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.decode(message.value); + }, + toProto(message: MsgRevokeAllowanceResponse): Uint8Array { + return MsgRevokeAllowanceResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", + value: MsgRevokeAllowanceResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/genutil/v1beta1/genesis.ts b/src/codegen/cosmos/genutil/v1beta1/genesis.ts index 1b7ea85..ad9c6a8 100644 --- a/src/codegen/cosmos/genutil/v1beta1/genesis.ts +++ b/src/codegen/cosmos/genutil/v1beta1/genesis.ts @@ -1,59 +1,95 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** GenesisState defines the raw genesis transaction in JSON. */ - export interface GenesisState { /** gen_txs defines the genesis transactions. */ genTxs: Uint8Array[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.genutil.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the raw genesis transaction in JSON. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** gen_txs defines the genesis transactions. */ + gen_txs?: string[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the raw genesis transaction in JSON. */ +export interface GenesisStateSDKType { gen_txs: Uint8Array[]; } - function createBaseGenesisState(): GenesisState { return { genTxs: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.genutil.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.genTxs) { writer.uint32(10).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.genTxs.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.genTxs = object.genTxs?.map(e => e) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.genTxs = object.gen_txs?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.genTxs) { + obj.gen_txs = message.genTxs.map(e => base64FromBytes(e)); + } else { + obj.gen_txs = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.genutil.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/genesis.ts b/src/codegen/cosmos/gov/v1/genesis.ts index 7931163..cc0ed61 100644 --- a/src/codegen/cosmos/gov/v1/genesis.ts +++ b/src/codegen/cosmos/gov/v1/genesis.ts @@ -1,58 +1,60 @@ -import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the gov module's genesis state. */ - export interface GenesisState { /** starting_proposal_id is the ID of the starting proposal. */ - startingProposalId: Long; + startingProposalId: bigint; /** deposits defines all the deposits present at genesis. */ - deposits: Deposit[]; /** votes defines all the votes present at genesis. */ - votes: Vote[]; /** proposals defines all the proposals present at genesis. */ - proposals: Proposal[]; /** params defines all the paramaters of related to deposit. */ - depositParams?: DepositParams; /** params defines all the paramaters of related to voting. */ - votingParams?: VotingParams; /** params defines all the paramaters of related to tally. */ - tallyParams?: TallyParams; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.gov.v1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the gov module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** starting_proposal_id is the ID of the starting proposal. */ - starting_proposal_id: Long; + starting_proposal_id?: string; /** deposits defines all the deposits present at genesis. */ - - deposits: DepositSDKType[]; + deposits?: DepositAmino[]; /** votes defines all the votes present at genesis. */ - - votes: VoteSDKType[]; + votes?: VoteAmino[]; /** proposals defines all the proposals present at genesis. */ - - proposals: ProposalSDKType[]; + proposals?: ProposalAmino[]; /** params defines all the paramaters of related to deposit. */ - - deposit_params?: DepositParamsSDKType; + deposit_params?: DepositParamsAmino; /** params defines all the paramaters of related to voting. */ - - voting_params?: VotingParamsSDKType; + voting_params?: VotingParamsAmino; /** params defines all the paramaters of related to tally. */ - + tally_params?: TallyParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/v1/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisStateSDKType { + starting_proposal_id: bigint; + deposits: DepositSDKType[]; + votes: VoteSDKType[]; + proposals: ProposalSDKType[]; + deposit_params?: DepositParamsSDKType; + voting_params?: VotingParamsSDKType; tally_params?: TallyParamsSDKType; } - function createBaseGenesisState(): GenesisState { return { - startingProposalId: Long.UZERO, + startingProposalId: BigInt(0), deposits: [], votes: [], proposals: [], @@ -61,89 +63,70 @@ function createBaseGenesisState(): GenesisState { tallyParams: undefined }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.startingProposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.startingProposalId !== BigInt(0)) { writer.uint32(8).uint64(message.startingProposalId); } - for (const v of message.deposits) { Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.votes) { Vote.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.depositParams !== undefined) { DepositParams.encode(message.depositParams, writer.uint32(42).fork()).ldelim(); } - if (message.votingParams !== undefined) { VotingParams.encode(message.votingParams, writer.uint32(50).fork()).ldelim(); } - if (message.tallyParams !== undefined) { TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.startingProposalId = (reader.uint64() as Long); + message.startingProposalId = reader.uint64(); break; - case 2: message.deposits.push(Deposit.decode(reader, reader.uint32())); break; - case 3: message.votes.push(Vote.decode(reader, reader.uint32())); break; - case 4: message.proposals.push(Proposal.decode(reader, reader.uint32())); break; - case 5: message.depositParams = DepositParams.decode(reader, reader.uint32()); break; - case 6: message.votingParams = VotingParams.decode(reader, reader.uint32()); break; - case 7: message.tallyParams = TallyParams.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); - message.startingProposalId = object.startingProposalId !== undefined && object.startingProposalId !== null ? Long.fromValue(object.startingProposalId) : Long.UZERO; + message.startingProposalId = object.startingProposalId !== undefined && object.startingProposalId !== null ? BigInt(object.startingProposalId.toString()) : BigInt(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)) || []; @@ -151,6 +134,68 @@ export const GenesisState = { 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; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.starting_proposal_id !== undefined && object.starting_proposal_id !== null) { + message.startingProposalId = BigInt(object.starting_proposal_id); + } + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = []; + } + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/v1/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/gov.ts b/src/codegen/cosmos/gov/v1/gov.ts index e131c4a..0194c25 100644 --- a/src/codegen/cosmos/gov/v1/gov.ts +++ b/src/codegen/cosmos/gov/v1/gov.ts @@ -1,69 +1,42 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long, toTimestamp, fromTimestamp } from "../../../helpers"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ - export enum VoteOption { /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ VOTE_OPTION_UNSPECIFIED = 0, - /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ VOTE_OPTION_YES = 1, - /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ VOTE_OPTION_ABSTAIN = 2, - /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ VOTE_OPTION_NO = 3, - - /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ - VOTE_OPTION_NO_WITH_VETO = 4, - UNRECOGNIZED = -1, -} -/** VoteOption enumerates the valid vote options for a given governance proposal. */ - -export enum VoteOptionSDKType { - /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ - VOTE_OPTION_UNSPECIFIED = 0, - - /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ - VOTE_OPTION_YES = 1, - - /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ - VOTE_OPTION_ABSTAIN = 2, - - /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ - VOTE_OPTION_NO = 3, - /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ VOTE_OPTION_NO_WITH_VETO = 4, UNRECOGNIZED = -1, } +export const VoteOptionSDKType = VoteOption; +export const VoteOptionAmino = VoteOption; export function voteOptionFromJSON(object: any): VoteOption { switch (object) { case 0: case "VOTE_OPTION_UNSPECIFIED": return VoteOption.VOTE_OPTION_UNSPECIFIED; - case 1: case "VOTE_OPTION_YES": return VoteOption.VOTE_OPTION_YES; - case 2: case "VOTE_OPTION_ABSTAIN": return VoteOption.VOTE_OPTION_ABSTAIN; - case 3: case "VOTE_OPTION_NO": return VoteOption.VOTE_OPTION_NO; - case 4: case "VOTE_OPTION_NO_WITH_VETO": return VoteOption.VOTE_OPTION_NO_WITH_VETO; - case -1: case "UNRECOGNIZED": default: @@ -74,91 +47,43 @@ export function voteOptionToJSON(object: VoteOption): string { switch (object) { case VoteOption.VOTE_OPTION_UNSPECIFIED: return "VOTE_OPTION_UNSPECIFIED"; - case VoteOption.VOTE_OPTION_YES: return "VOTE_OPTION_YES"; - case VoteOption.VOTE_OPTION_ABSTAIN: return "VOTE_OPTION_ABSTAIN"; - case VoteOption.VOTE_OPTION_NO: return "VOTE_OPTION_NO"; - case VoteOption.VOTE_OPTION_NO_WITH_VETO: return "VOTE_OPTION_NO_WITH_VETO"; - case VoteOption.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** ProposalStatus enumerates the valid statuses of a proposal. */ - export enum ProposalStatus { /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. */ PROPOSAL_STATUS_UNSPECIFIED = 0, - /** * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit * period. */ PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, - /** * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting * period. */ PROPOSAL_STATUS_VOTING_PERIOD = 2, - /** * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has * passed. */ PROPOSAL_STATUS_PASSED = 3, - /** * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has * been rejected. */ PROPOSAL_STATUS_REJECTED = 4, - - /** - * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - * failed. - */ - PROPOSAL_STATUS_FAILED = 5, - UNRECOGNIZED = -1, -} -/** ProposalStatus enumerates the valid statuses of a proposal. */ - -export enum ProposalStatusSDKType { - /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. */ - PROPOSAL_STATUS_UNSPECIFIED = 0, - - /** - * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - * period. - */ - PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, - - /** - * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - * period. - */ - PROPOSAL_STATUS_VOTING_PERIOD = 2, - - /** - * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - * passed. - */ - PROPOSAL_STATUS_PASSED = 3, - - /** - * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - * been rejected. - */ - PROPOSAL_STATUS_REJECTED = 4, - /** * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has * failed. @@ -166,32 +91,28 @@ export enum ProposalStatusSDKType { PROPOSAL_STATUS_FAILED = 5, UNRECOGNIZED = -1, } +export const ProposalStatusSDKType = ProposalStatus; +export const ProposalStatusAmino = ProposalStatus; export function proposalStatusFromJSON(object: any): ProposalStatus { switch (object) { case 0: case "PROPOSAL_STATUS_UNSPECIFIED": return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; - case 1: case "PROPOSAL_STATUS_DEPOSIT_PERIOD": return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; - case 2: case "PROPOSAL_STATUS_VOTING_PERIOD": return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; - case 3: case "PROPOSAL_STATUS_PASSED": return ProposalStatus.PROPOSAL_STATUS_PASSED; - case 4: case "PROPOSAL_STATUS_REJECTED": return ProposalStatus.PROPOSAL_STATUS_REJECTED; - case 5: case "PROPOSAL_STATUS_FAILED": return ProposalStatus.PROPOSAL_STATUS_FAILED; - case -1: case "UNRECOGNIZED": default: @@ -202,63 +123,82 @@ export function proposalStatusToJSON(object: ProposalStatus): string { switch (object) { case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: return "PROPOSAL_STATUS_UNSPECIFIED"; - case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; - case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: return "PROPOSAL_STATUS_VOTING_PERIOD"; - case ProposalStatus.PROPOSAL_STATUS_PASSED: return "PROPOSAL_STATUS_PASSED"; - case ProposalStatus.PROPOSAL_STATUS_REJECTED: return "PROPOSAL_STATUS_REJECTED"; - case ProposalStatus.PROPOSAL_STATUS_FAILED: return "PROPOSAL_STATUS_FAILED"; - case ProposalStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** WeightedVoteOption defines a unit of vote for vote split. */ - export interface WeightedVoteOption { option: VoteOption; weight: string; } +export interface WeightedVoteOptionProtoMsg { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption"; + value: Uint8Array; +} +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOptionAmino { + option?: VoteOption; + weight?: string; +} +export interface WeightedVoteOptionAminoMsg { + type: "cosmos-sdk/v1/WeightedVoteOption"; + value: WeightedVoteOptionAmino; +} /** WeightedVoteOption defines a unit of vote for vote split. */ - export interface WeightedVoteOptionSDKType { - option: VoteOptionSDKType; + option: VoteOption; weight: string; } /** * Deposit defines an amount deposited by an account address to an active * proposal. */ - export interface Deposit { - proposalId: Long; + proposalId: bigint; depositor: string; amount: Coin[]; } +export interface DepositProtoMsg { + typeUrl: "/cosmos.gov.v1.Deposit"; + value: Uint8Array; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositAmino { + proposal_id?: string; + depositor?: string; + amount?: CoinAmino[]; +} +export interface DepositAminoMsg { + type: "cosmos-sdk/v1/Deposit"; + value: DepositAmino; +} /** * Deposit defines an amount deposited by an account address to an active * proposal. */ - export interface DepositSDKType { - proposal_id: Long; + proposal_id: bigint; depositor: string; amount: CoinSDKType[]; } /** Proposal defines the core field members of a governance proposal. */ - export interface Proposal { - id: Long; + id: bigint; messages: Any[]; status: ProposalStatus; /** @@ -266,7 +206,6 @@ export interface Proposal { * querying a proposal via gRPC, this field is not populated until the * proposal's voting period has ended. */ - finalTallyResult?: TallyResult; submitTime?: Date; depositEndTime?: Date; @@ -274,41 +213,71 @@ export interface Proposal { votingStartTime?: Date; votingEndTime?: Date; /** metadata is any arbitrary metadata attached to the proposal. */ - metadata: string; } +export interface ProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.Proposal"; + value: Uint8Array; +} /** Proposal defines the core field members of a governance proposal. */ - -export interface ProposalSDKType { - id: Long; - messages: AnySDKType[]; - status: ProposalStatusSDKType; +export interface ProposalAmino { + id?: string; + messages?: AnyAmino[]; + status?: ProposalStatus; /** * final_tally_result is the final tally result of the proposal. When * querying a proposal via gRPC, this field is not populated until the * proposal's voting period has ended. */ - + final_tally_result?: TallyResultAmino; + submit_time?: string; + deposit_end_time?: string; + total_deposit?: CoinAmino[]; + voting_start_time?: string; + voting_end_time?: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata?: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/v1/Proposal"; + value: ProposalAmino; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalSDKType { + id: bigint; + messages: AnySDKType[]; + status: ProposalStatus; final_tally_result?: TallyResultSDKType; submit_time?: Date; deposit_end_time?: Date; total_deposit: CoinSDKType[]; voting_start_time?: Date; voting_end_time?: Date; - /** metadata is any arbitrary metadata attached to the proposal. */ - metadata: string; } /** TallyResult defines a standard tally for a governance proposal. */ - export interface TallyResult { yesCount: string; abstainCount: string; noCount: string; noWithVetoCount: string; } +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.gov.v1.TallyResult"; + value: Uint8Array; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultAmino { + yes_count?: string; + abstain_count?: string; + no_count?: string; + no_with_veto_count?: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/v1/TallyResult"; + value: TallyResultAmino; +} /** TallyResult defines a standard tally for a governance proposal. */ - export interface TallyResultSDKType { yes_count: string; abstain_count: string; @@ -319,30 +288,43 @@ export interface TallyResultSDKType { * Vote defines a vote on a governance proposal. * A Vote consists of a proposal ID, the voter, and the vote option. */ - export interface Vote { - proposalId: Long; + proposalId: bigint; voter: string; options: WeightedVoteOption[]; /** metadata is any arbitrary metadata to attached to the vote. */ - metadata: string; } +export interface VoteProtoMsg { + typeUrl: "/cosmos.gov.v1.Vote"; + value: Uint8Array; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteAmino { + proposal_id?: string; + voter?: string; + options?: WeightedVoteOptionAmino[]; + /** metadata is any arbitrary metadata to attached to the vote. */ + metadata?: string; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/v1/Vote"; + value: VoteAmino; +} /** * Vote defines a vote on a governance proposal. * A Vote consists of a proposal ID, the voter, and the vote option. */ - export interface VoteSDKType { - proposal_id: Long; + proposal_id: bigint; voter: string; options: WeightedVoteOptionSDKType[]; - /** metadata is any arbitrary metadata to attached to the vote. */ - metadata: string; } /** DepositParams defines the params for deposits on governance proposals. */ - export interface DepositParams { /** Minimum deposit for a proposal to enter voting period. */ minDeposit: Coin[]; @@ -350,35 +332,54 @@ export interface DepositParams { * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 * months. */ - maxDepositPeriod?: Duration; } +export interface DepositParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.DepositParams"; + value: Uint8Array; +} /** DepositParams defines the params for deposits on governance proposals. */ - -export interface DepositParamsSDKType { +export interface DepositParamsAmino { /** Minimum deposit for a proposal to enter voting period. */ - min_deposit: CoinSDKType[]; + min_deposit?: CoinAmino[]; /** * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 * months. */ - + max_deposit_period?: DurationAmino; +} +export interface DepositParamsAminoMsg { + type: "cosmos-sdk/v1/DepositParams"; + value: DepositParamsAmino; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsSDKType { + min_deposit: CoinSDKType[]; max_deposit_period?: DurationSDKType; } /** VotingParams defines the params for voting on governance proposals. */ - export interface VotingParams { /** Length of the voting period. */ votingPeriod?: Duration; } +export interface VotingParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.VotingParams"; + value: Uint8Array; +} /** VotingParams defines the params for voting on governance proposals. */ - -export interface VotingParamsSDKType { +export interface VotingParamsAmino { /** Length of the voting period. */ + voting_period?: DurationAmino; +} +export interface VotingParamsAminoMsg { + type: "cosmos-sdk/v1/VotingParams"; + value: VotingParamsAmino; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsSDKType { voting_period?: DurationSDKType; } /** 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 @@ -386,157 +387,221 @@ export interface TallyParams { */ quorum: string; /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ - threshold: string; /** * Minimum value of Veto votes to Total votes ratio for proposal to be * vetoed. Default value: 1/3. */ - vetoThreshold: string; } +export interface TallyParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.TallyParams"; + value: Uint8Array; +} /** TallyParams defines the params for tallying votes on governance proposals. */ - -export interface TallyParamsSDKType { +export interface TallyParamsAmino { /** * Minimum percentage of total stake needed to vote for a result to be * considered valid. */ - quorum: string; + quorum?: string; /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ - - threshold: string; + threshold?: string; /** * Minimum value of Veto votes to Total votes ratio for proposal to be * vetoed. Default value: 1/3. */ - + veto_threshold?: string; +} +export interface TallyParamsAminoMsg { + type: "cosmos-sdk/v1/TallyParams"; + value: TallyParamsAmino; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsSDKType { + quorum: string; + threshold: string; veto_threshold: string; } - function createBaseWeightedVoteOption(): WeightedVoteOption { return { option: 0, weight: "" }; } - export const WeightedVoteOption = { - encode(message: WeightedVoteOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption", + encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.option !== 0) { writer.uint32(8).int32(message.option); } - if (message.weight !== "") { writer.uint32(18).string(message.weight); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseWeightedVoteOption(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.option = (reader.int32() as any); break; - case 2: message.weight = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): WeightedVoteOption { + fromPartial(object: Partial): WeightedVoteOption { const message = createBaseWeightedVoteOption(); message.option = object.option ?? 0; message.weight = object.weight ?? ""; return message; + }, + fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + if (object.option !== undefined && object.option !== null) { + message.option = voteOptionFromJSON(object.option); + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + return message; + }, + toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { + const obj: any = {}; + obj.option = voteOptionToJSON(message.option); + obj.weight = message.weight; + return obj; + }, + fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { + return WeightedVoteOption.fromAmino(object.value); + }, + toAminoMsg(message: WeightedVoteOption): WeightedVoteOptionAminoMsg { + return { + type: "cosmos-sdk/v1/WeightedVoteOption", + value: WeightedVoteOption.toAmino(message) + }; + }, + fromProtoMsg(message: WeightedVoteOptionProtoMsg): WeightedVoteOption { + return WeightedVoteOption.decode(message.value); + }, + toProto(message: WeightedVoteOption): Uint8Array { + return WeightedVoteOption.encode(message).finish(); + }, + toProtoMsg(message: WeightedVoteOption): WeightedVoteOptionProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption", + value: WeightedVoteOption.encode(message).finish() + }; } - }; - function createBaseDeposit(): Deposit { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), depositor: "", amount: [] }; } - export const Deposit = { - encode(message: Deposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.Deposit", + encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.depositor !== "") { writer.uint32(18).string(message.depositor); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Deposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDeposit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.depositor = reader.string(); break; - case 3: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Deposit { + fromPartial(object: Partial): Deposit { const message = createBaseDeposit(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.depositor = object.depositor ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: DepositAmino): Deposit { + const message = createBaseDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Deposit): DepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: DepositAminoMsg): Deposit { + return Deposit.fromAmino(object.value); + }, + toAminoMsg(message: Deposit): DepositAminoMsg { + return { + type: "cosmos-sdk/v1/Deposit", + value: Deposit.toAmino(message) + }; + }, + fromProtoMsg(message: DepositProtoMsg): Deposit { + return Deposit.decode(message.value); + }, + toProto(message: Deposit): Uint8Array { + return Deposit.encode(message).finish(); + }, + toProtoMsg(message: Deposit): DepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Deposit", + value: Deposit.encode(message).finish() + }; } - }; - function createBaseProposal(): Proposal { return { - id: Long.UZERO, + id: BigInt(0), messages: [], status: 0, finalTallyResult: undefined, @@ -548,113 +613,88 @@ function createBaseProposal(): Proposal { metadata: "" }; } - export const Proposal = { - encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.id.isZero()) { + typeUrl: "/cosmos.gov.v1.Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); } - for (const v of message.messages) { Any.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.status !== 0) { writer.uint32(24).int32(message.status); } - if (message.finalTallyResult !== undefined) { TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).ldelim(); } - if (message.submitTime !== undefined) { Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); } - if (message.depositEndTime !== undefined) { Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).ldelim(); } - for (const v of message.totalDeposit) { Coin.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.votingStartTime !== undefined) { Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).ldelim(); } - if (message.votingEndTime !== undefined) { Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).ldelim(); } - if (message.metadata !== "") { writer.uint32(82).string(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.id = (reader.uint64() as Long); + message.id = reader.uint64(); break; - case 2: message.messages.push(Any.decode(reader, reader.uint32())); break; - case 3: message.status = (reader.int32() as any); break; - case 4: message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); break; - case 5: message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 6: message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 7: message.totalDeposit.push(Coin.decode(reader, reader.uint32())); break; - case 8: message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 9: message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 10: message.metadata = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Proposal { + fromPartial(object: Partial): Proposal { const message = createBaseProposal(); - message.id = object.id !== undefined && object.id !== null ? Long.fromValue(object.id) : Long.UZERO; + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; message.status = object.status ?? 0; message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; @@ -665,10 +705,81 @@ export const Proposal = { message.votingEndTime = object.votingEndTime ?? undefined; message.metadata = object.metadata ?? ""; return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.status !== undefined && object.status !== null) { + message.status = proposalStatusFromJSON(object.status); + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.deposit_end_time !== undefined && object.deposit_end_time !== null) { + message.depositEndTime = fromTimestamp(Timestamp.fromAmino(object.deposit_end_time)); + } + message.totalDeposit = object.total_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.voting_start_time !== undefined && object.voting_start_time !== null) { + message.votingStartTime = fromTimestamp(Timestamp.fromAmino(object.voting_start_time)); + } + if (object.voting_end_time !== undefined && object.voting_end_time !== null) { + message.votingEndTime = fromTimestamp(Timestamp.fromAmino(object.voting_end_time)); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.id = message.id ? message.id.toString() : undefined; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = []; + } + obj.status = proposalStatusToJSON(message.status); + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; + obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; + if (message.totalDeposit) { + obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_deposit = []; + } + obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; + obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/v1/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Proposal", + value: Proposal.encode(message).finish() + }; } - }; - function createBaseTallyResult(): TallyResult { return { yesCount: "", @@ -677,248 +788,362 @@ function createBaseTallyResult(): TallyResult { noWithVetoCount: "" }; } - export const TallyResult = { - encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.TallyResult", + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yesCount !== "") { writer.uint32(10).string(message.yesCount); } - if (message.abstainCount !== "") { writer.uint32(18).string(message.abstainCount); } - if (message.noCount !== "") { writer.uint32(26).string(message.noCount); } - if (message.noWithVetoCount !== "") { writer.uint32(34).string(message.noWithVetoCount); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTallyResult(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.yesCount = reader.string(); break; - case 2: message.abstainCount = reader.string(); break; - case 3: message.noCount = reader.string(); break; - case 4: message.noWithVetoCount = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TallyResult { + fromPartial(object: Partial): TallyResult { const message = createBaseTallyResult(); message.yesCount = object.yesCount ?? ""; message.abstainCount = object.abstainCount ?? ""; message.noCount = object.noCount ?? ""; message.noWithVetoCount = object.noWithVetoCount ?? ""; return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes_count !== undefined && object.yes_count !== null) { + message.yesCount = object.yes_count; + } + if (object.abstain_count !== undefined && object.abstain_count !== null) { + message.abstainCount = object.abstain_count; + } + if (object.no_count !== undefined && object.no_count !== null) { + message.noCount = object.no_count; + } + if (object.no_with_veto_count !== undefined && object.no_with_veto_count !== null) { + message.noWithVetoCount = object.no_with_veto_count; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes_count = message.yesCount; + obj.abstain_count = message.abstainCount; + obj.no_count = message.noCount; + obj.no_with_veto_count = message.noWithVetoCount; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/v1/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.TallyResult", + value: TallyResult.encode(message).finish() + }; } - }; - function createBaseVote(): Vote { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "", options: [], metadata: "" }; } - export const Vote = { - encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - for (const v of message.options) { WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.metadata !== "") { writer.uint32(42).string(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Vote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - case 4: message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); break; - case 5: message.metadata = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Vote { + fromPartial(object: Partial): Vote { const message = createBaseVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; message.metadata = object.metadata ?? ""; return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = []; + } + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/v1/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Vote", + value: Vote.encode(message).finish() + }; } - }; - function createBaseDepositParams(): DepositParams { return { minDeposit: [], maxDepositPeriod: undefined }; } - export const DepositParams = { - encode(message: DepositParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.DepositParams", + encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minDeposit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.maxDepositPeriod !== undefined) { Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDepositParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.minDeposit.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DepositParams { + fromPartial(object: Partial): DepositParams { const message = createBaseDepositParams(); message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; return message; + }, + fromAmino(object: DepositParamsAmino): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + return message; + }, + toAmino(message: DepositParams): DepositParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = []; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: DepositParamsAminoMsg): DepositParams { + return DepositParams.fromAmino(object.value); + }, + toAminoMsg(message: DepositParams): DepositParamsAminoMsg { + return { + type: "cosmos-sdk/v1/DepositParams", + value: DepositParams.toAmino(message) + }; + }, + fromProtoMsg(message: DepositParamsProtoMsg): DepositParams { + return DepositParams.decode(message.value); + }, + toProto(message: DepositParams): Uint8Array { + return DepositParams.encode(message).finish(); + }, + toProtoMsg(message: DepositParams): DepositParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.DepositParams", + value: DepositParams.encode(message).finish() + }; } - }; - function createBaseVotingParams(): VotingParams { return { votingPeriod: undefined }; } - export const VotingParams = { - encode(message: VotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.VotingParams", + encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVotingParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.votingPeriod = Duration.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): VotingParams { + fromPartial(object: Partial): VotingParams { const message = createBaseVotingParams(); message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; return message; + }, + fromAmino(object: VotingParamsAmino): VotingParams { + const message = createBaseVotingParams(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + return message; + }, + toAmino(message: VotingParams): VotingParamsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: VotingParamsAminoMsg): VotingParams { + return VotingParams.fromAmino(object.value); + }, + toAminoMsg(message: VotingParams): VotingParamsAminoMsg { + return { + type: "cosmos-sdk/v1/VotingParams", + value: VotingParams.toAmino(message) + }; + }, + fromProtoMsg(message: VotingParamsProtoMsg): VotingParams { + return VotingParams.decode(message.value); + }, + toProto(message: VotingParams): Uint8Array { + return VotingParams.encode(message).finish(); + }, + toProtoMsg(message: VotingParams): VotingParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.VotingParams", + value: VotingParams.encode(message).finish() + }; } - }; - function createBaseTallyParams(): TallyParams { return { quorum: "", @@ -926,60 +1151,89 @@ function createBaseTallyParams(): TallyParams { vetoThreshold: "" }; } - export const TallyParams = { - encode(message: TallyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.TallyParams", + encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quorum !== "") { writer.uint32(10).string(message.quorum); } - if (message.threshold !== "") { writer.uint32(18).string(message.threshold); } - if (message.vetoThreshold !== "") { writer.uint32(26).string(message.vetoThreshold); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTallyParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.quorum = reader.string(); break; - case 2: message.threshold = reader.string(); break; - case 3: message.vetoThreshold = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TallyParams { + fromPartial(object: Partial): TallyParams { const message = createBaseTallyParams(); message.quorum = object.quorum ?? ""; message.threshold = object.threshold ?? ""; message.vetoThreshold = object.vetoThreshold ?? ""; return message; + }, + fromAmino(object: TallyParamsAmino): TallyParams { + const message = createBaseTallyParams(); + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = object.quorum; + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = object.veto_threshold; + } + return message; + }, + toAmino(message: TallyParams): TallyParamsAmino { + const obj: any = {}; + obj.quorum = message.quorum; + obj.threshold = message.threshold; + obj.veto_threshold = message.vetoThreshold; + return obj; + }, + fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { + return TallyParams.fromAmino(object.value); + }, + toAminoMsg(message: TallyParams): TallyParamsAminoMsg { + return { + type: "cosmos-sdk/v1/TallyParams", + value: TallyParams.toAmino(message) + }; + }, + fromProtoMsg(message: TallyParamsProtoMsg): TallyParams { + return TallyParams.decode(message.value); + }, + toProto(message: TallyParams): Uint8Array { + return TallyParams.encode(message).finish(); + }, + toProtoMsg(message: TallyParams): TallyParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.TallyParams", + value: TallyParams.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/query.lcd.ts b/src/codegen/cosmos/gov/v1/query.lcd.ts index c70703b..5dafe47 100644 --- a/src/codegen/cosmos/gov/v1/query.lcd.ts +++ b/src/codegen/cosmos/gov/v1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -20,96 +19,70 @@ export class LCDQueryClient { this.tallyResult = this.tallyResult.bind(this); } /* Proposal queries proposal details based on ProposalID. */ - - async proposal(params: QueryProposalRequest): Promise { const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}`; return await this.req.get(endpoint); } /* Proposals queries all proposals based on given status. */ - - async proposals(params: QueryProposalsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.proposalStatus !== "undefined") { options.params.proposal_status = params.proposalStatus; } - if (typeof params?.voter !== "undefined") { options.params.voter = params.voter; } - if (typeof params?.depositor !== "undefined") { options.params.depositor = params.depositor; } - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/gov/v1/proposals`; return await this.req.get(endpoint, options); } /* Vote queries voted information based on proposalID, voterAddr. */ - - async vote(params: QueryVoteRequest): Promise { - const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}votes/${params.voter}`; + const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/votes/${params.voter}`; return await this.req.get(endpoint); } /* Votes queries votes of a given proposal. */ - - async votes(params: QueryVotesRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/votes`; return await this.req.get(endpoint, options); } /* Params queries all parameters of the gov module. */ - - async params(params: QueryParamsRequest): Promise { const endpoint = `cosmos/gov/v1/params/${params.paramsType}`; return await this.req.get(endpoint); } /* Deposit queries single deposit information based proposalID, depositAddr. */ - - async deposit(params: QueryDepositRequest): Promise { - const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}deposits/${params.depositor}`; + const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/deposits/${params.depositor}`; return await this.req.get(endpoint); } /* Deposits queries all deposits of a single proposal. */ - - async deposits(params: QueryDepositsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/deposits`; return await this.req.get(endpoint, options); } /* TallyResult queries the tally of a proposal vote. */ - - async tallyResult(params: QueryTallyResultRequest): Promise { const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/tally`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/query.rpc.Query.ts b/src/codegen/cosmos/gov/v1/query.rpc.Query.ts index 3578423..c4ff3fe 100644 --- a/src/codegen/cosmos/gov/v1/query.rpc.Query.ts +++ b/src/codegen/cosmos/gov/v1/query.rpc.Query.ts @@ -1,37 +1,28 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; /** Query defines the gRPC querier service for gov module */ - export interface Query { /** Proposal queries proposal details based on ProposalID. */ proposal(request: QueryProposalRequest): Promise; /** Proposals queries all proposals based on given status. */ - proposals(request: QueryProposalsRequest): Promise; /** Vote queries voted information based on proposalID, voterAddr. */ - vote(request: QueryVoteRequest): Promise; /** Votes queries votes of a given proposal. */ - votes(request: QueryVotesRequest): Promise; /** Params queries all parameters of the gov module. */ - params(request: QueryParamsRequest): Promise; /** Deposit queries single deposit information based proposalID, depositAddr. */ - deposit(request: QueryDepositRequest): Promise; /** Deposits queries all deposits of a single proposal. */ - deposits(request: QueryDepositsRequest): Promise; /** TallyResult queries the tally of a proposal vote. */ - tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.proposal = this.proposal.bind(this); @@ -43,55 +34,46 @@ export class QueryClientImpl implements Query { 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("cosmos.gov.v1.Query", "Proposal", data); - return promise.then(data => QueryProposalResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Query", "Proposals", data); - return promise.then(data => QueryProposalsResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Query", "Vote", data); - return promise.then(data => QueryVoteResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Query", "Votes", data); - return promise.then(data => QueryVotesResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Query", "Deposit", data); - return promise.then(data => QueryDepositResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Query", "Deposits", data); - return promise.then(data => QueryDepositsResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Query", "TallyResult", data); - return promise.then(data => QueryTallyResultResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryTallyResultResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -100,34 +82,26 @@ export const createRpcQueryExtension = (base: QueryClient) => { proposal(request: QueryProposalRequest): Promise { return queryService.proposal(request); }, - proposals(request: QueryProposalsRequest): Promise { return queryService.proposals(request); }, - vote(request: QueryVoteRequest): Promise { return queryService.vote(request); }, - votes(request: QueryVotesRequest): Promise { return queryService.votes(request); }, - params(request: QueryParamsRequest): Promise { return queryService.params(request); }, - deposit(request: QueryDepositRequest): Promise { return queryService.deposit(request); }, - deposits(request: QueryDepositsRequest): Promise { return queryService.deposits(request); }, - tallyResult(request: QueryTallyResultRequest): Promise { return queryService.tallyResult(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/query.ts b/src/codegen/cosmos/gov/v1/query.ts index 65d54d2..17e71b3 100644 --- a/src/codegen/cosmos/gov/v1/query.ts +++ b/src/codegen/cosmos/gov/v1/query.ts @@ -1,149 +1,223 @@ -import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { ProposalStatus, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ - export interface QueryProposalRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalRequest"; + value: Uint8Array; } /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ - -export interface QueryProposalRequestSDKType { +export interface QueryProposalRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/v1/QueryProposalRequest"; + value: QueryProposalRequestAmino; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestSDKType { + proposal_id: bigint; } /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ - export interface QueryProposalResponse { proposal?: Proposal; } +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalResponse"; + value: Uint8Array; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseAmino { + proposal?: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/v1/QueryProposalResponse"; + value: QueryProposalResponseAmino; +} /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ - export interface QueryProposalResponseSDKType { proposal?: ProposalSDKType; } /** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ - export interface QueryProposalsRequest { /** proposal_status defines the status of the proposals. */ proposalStatus: ProposalStatus; /** voter defines the voter address for the proposals. */ - voter: string; /** depositor defines the deposit addresses from the proposals. */ - depositor: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryProposalsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalsRequest"; + value: Uint8Array; +} /** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ - -export interface QueryProposalsRequestSDKType { +export interface QueryProposalsRequestAmino { /** proposal_status defines the status of the proposals. */ - proposal_status: ProposalStatusSDKType; + proposal_status?: ProposalStatus; /** voter defines the voter address for the proposals. */ - - voter: string; + voter?: string; /** depositor defines the deposit addresses from the proposals. */ - - depositor: string; + depositor?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryProposalsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryProposalsRequest"; + value: QueryProposalsRequestAmino; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestSDKType { + proposal_status: ProposalStatus; + voter: string; + depositor: string; pagination?: PageRequestSDKType; } /** * QueryProposalsResponse is the response type for the Query/Proposals RPC * method. */ - export interface QueryProposalsResponse { proposals: Proposal[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryProposalsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalsResponse"; + value: Uint8Array; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseAmino { + proposals?: ProposalAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryProposalsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryProposalsResponse"; + value: QueryProposalsResponseAmino; +} /** * QueryProposalsResponse is the response type for the Query/Proposals RPC * method. */ - export interface QueryProposalsResponseSDKType { proposals: ProposalSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } /** QueryVoteRequest is the request type for the Query/Vote RPC method. */ - export interface QueryVoteRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; /** voter defines the oter address for the proposals. */ - voter: string; } +export interface QueryVoteRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVoteRequest"; + value: Uint8Array; +} /** QueryVoteRequest is the request type for the Query/Vote RPC method. */ - -export interface QueryVoteRequestSDKType { +export interface QueryVoteRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** voter defines the oter address for the proposals. */ - + voter?: string; +} +export interface QueryVoteRequestAminoMsg { + type: "cosmos-sdk/v1/QueryVoteRequest"; + value: QueryVoteRequestAmino; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestSDKType { + proposal_id: bigint; voter: string; } /** QueryVoteResponse is the response type for the Query/Vote RPC method. */ - export interface QueryVoteResponse { /** vote defined the queried vote. */ vote?: Vote; } +export interface QueryVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVoteResponse"; + value: Uint8Array; +} /** QueryVoteResponse is the response type for the Query/Vote RPC method. */ - -export interface QueryVoteResponseSDKType { +export interface QueryVoteResponseAmino { /** vote defined the queried vote. */ + vote?: VoteAmino; +} +export interface QueryVoteResponseAminoMsg { + type: "cosmos-sdk/v1/QueryVoteResponse"; + value: QueryVoteResponseAmino; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseSDKType { vote?: VoteSDKType; } /** QueryVotesRequest is the request type for the Query/Votes RPC method. */ - export interface QueryVotesRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryVotesRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVotesRequest"; + value: Uint8Array; +} /** QueryVotesRequest is the request type for the Query/Votes RPC method. */ - -export interface QueryVotesRequestSDKType { +export interface QueryVotesRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryVotesRequestAminoMsg { + type: "cosmos-sdk/v1/QueryVotesRequest"; + value: QueryVotesRequestAmino; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestSDKType { + proposal_id: bigint; pagination?: PageRequestSDKType; } /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ - export interface QueryVotesResponse { /** votes defined the queried votes. */ votes: Vote[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryVotesResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVotesResponse"; + value: Uint8Array; +} /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ - -export interface QueryVotesResponseSDKType { +export interface QueryVotesResponseAmino { /** votes defined the queried votes. */ - votes: VoteSDKType[]; + votes?: VoteAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryVotesResponseAminoMsg { + type: "cosmos-sdk/v1/QueryVotesResponse"; + value: QueryVotesResponseAmino; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseSDKType { + votes: VoteSDKType[]; pagination?: PageResponseSDKType; } /** 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", @@ -151,218 +225,341 @@ export interface QueryParamsRequest { */ paramsType: string; } +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryParamsRequest"; + value: Uint8Array; +} /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - -export interface QueryParamsRequestSDKType { +export interface QueryParamsRequestAmino { /** * params_type defines which parameters to query for, can be one of "voting", * "tallying" or "deposit". */ + params_type?: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType { params_type: string; } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** voting_params defines the parameters related to voting. */ votingParams?: VotingParams; /** deposit_params defines the parameters related to deposit. */ - depositParams?: DepositParams; /** tally_params defines the parameters related to tally. */ - tallyParams?: TallyParams; } +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryParamsResponse"; + value: Uint8Array; +} /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** voting_params defines the parameters related to voting. */ - voting_params?: VotingParamsSDKType; + voting_params?: VotingParamsAmino; /** deposit_params defines the parameters related to deposit. */ - - deposit_params?: DepositParamsSDKType; + deposit_params?: DepositParamsAmino; /** tally_params defines the parameters related to tally. */ - + tally_params?: TallyParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + voting_params?: VotingParamsSDKType; + deposit_params?: DepositParamsSDKType; tally_params?: TallyParamsSDKType; } /** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ - export interface QueryDepositRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; /** depositor defines the deposit addresses from the proposals. */ - depositor: string; } +export interface QueryDepositRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositRequest"; + value: Uint8Array; +} /** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ - -export interface QueryDepositRequestSDKType { +export interface QueryDepositRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** depositor defines the deposit addresses from the proposals. */ - + depositor?: string; +} +export interface QueryDepositRequestAminoMsg { + type: "cosmos-sdk/v1/QueryDepositRequest"; + value: QueryDepositRequestAmino; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestSDKType { + proposal_id: bigint; depositor: string; } /** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ - export interface QueryDepositResponse { /** deposit defines the requested deposit. */ deposit?: Deposit; } +export interface QueryDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositResponse"; + value: Uint8Array; +} /** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ - -export interface QueryDepositResponseSDKType { +export interface QueryDepositResponseAmino { /** deposit defines the requested deposit. */ + deposit?: DepositAmino; +} +export interface QueryDepositResponseAminoMsg { + type: "cosmos-sdk/v1/QueryDepositResponse"; + value: QueryDepositResponseAmino; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseSDKType { deposit?: DepositSDKType; } /** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ - export interface QueryDepositsRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryDepositsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositsRequest"; + value: Uint8Array; +} /** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ - -export interface QueryDepositsRequestSDKType { +export interface QueryDepositsRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryDepositsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryDepositsRequest"; + value: QueryDepositsRequestAmino; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestSDKType { + proposal_id: bigint; pagination?: PageRequestSDKType; } /** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ - export interface QueryDepositsResponse { deposits: Deposit[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryDepositsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositsResponse"; + value: Uint8Array; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseAmino { + deposits?: DepositAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDepositsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryDepositsResponse"; + value: QueryDepositsResponseAmino; +} /** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ - export interface QueryDepositsResponseSDKType { deposits: DepositSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } /** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ - export interface QueryTallyResultRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest"; + value: Uint8Array; } /** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ - -export interface QueryTallyResultRequestSDKType { +export interface QueryTallyResultRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/v1/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestSDKType { + proposal_id: bigint; } /** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ - export interface QueryTallyResultResponse { /** tally defines the requested tally. */ tally?: TallyResult; } +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse"; + value: Uint8Array; +} /** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ - -export interface QueryTallyResultResponseSDKType { +export interface QueryTallyResultResponseAmino { /** tally defines the requested tally. */ + tally?: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/v1/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseSDKType { tally?: TallyResultSDKType; } - function createBaseQueryProposalRequest(): QueryProposalRequest { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const QueryProposalRequest = { - encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.QueryProposalRequest", + encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalRequest { + fromPartial(object: Partial): QueryProposalRequest { const message = createBaseQueryProposalRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish() + }; } - }; - function createBaseQueryProposalResponse(): QueryProposalResponse { return { proposal: undefined }; } - export const QueryProposalResponse = { - encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryProposalResponse", + encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.proposal = Proposal.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalResponse { + fromPartial(object: Partial): QueryProposalResponse { const message = createBaseQueryProposalResponse(); message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + return message; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish() + }; } - }; - function createBaseQueryProposalsRequest(): QueryProposalsRequest { return { proposalStatus: 0, @@ -371,383 +568,569 @@ function createBaseQueryProposalsRequest(): QueryProposalsRequest { pagination: undefined }; } - export const QueryProposalsRequest = { - encode(message: QueryProposalsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", + encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalStatus !== 0) { writer.uint32(8).int32(message.proposalStatus); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - if (message.depositor !== "") { writer.uint32(26).string(message.depositor); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.proposalStatus = (reader.int32() as any); break; - case 2: message.voter = reader.string(); break; - case 3: message.depositor = reader.string(); break; - case 4: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalsRequest { + fromPartial(object: Partial): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); message.proposalStatus = object.proposalStatus ?? 0; message.voter = object.voter ?? ""; message.depositor = object.depositor ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + if (object.proposal_status !== undefined && object.proposal_status !== null) { + message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { + const obj: any = {}; + obj.proposal_status = proposalStatusToJSON(message.proposalStatus); + obj.voter = message.voter; + obj.depositor = message.depositor; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsRequestAminoMsg): QueryProposalsRequest { + return QueryProposalsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsRequest): QueryProposalsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalsRequest", + value: QueryProposalsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsRequestProtoMsg): QueryProposalsRequest { + return QueryProposalsRequest.decode(message.value); + }, + toProto(message: QueryProposalsRequest): Uint8Array { + return QueryProposalsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsRequest): QueryProposalsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", + value: QueryProposalsRequest.encode(message).finish() + }; } - }; - function createBaseQueryProposalsResponse(): QueryProposalsResponse { return { proposals: [], pagination: undefined }; } - export const QueryProposalsResponse = { - encode(message: QueryProposalsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", + encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.proposals.push(Proposal.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalsResponse { + fromPartial(object: Partial): QueryProposalsResponse { const message = createBaseQueryProposalsResponse(); message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryProposalsResponseAmino): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsResponse): QueryProposalsResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsResponseAminoMsg): QueryProposalsResponse { + return QueryProposalsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsResponse): QueryProposalsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalsResponse", + value: QueryProposalsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsResponseProtoMsg): QueryProposalsResponse { + return QueryProposalsResponse.decode(message.value); + }, + toProto(message: QueryProposalsResponse): Uint8Array { + return QueryProposalsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsResponse): QueryProposalsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", + value: QueryProposalsResponse.encode(message).finish() + }; } - }; - function createBaseQueryVoteRequest(): QueryVoteRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "" }; } - export const QueryVoteRequest = { - encode(message: QueryVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.QueryVoteRequest", + encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVoteRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVoteRequest { + fromPartial(object: Partial): QueryVoteRequest { const message = createBaseQueryVoteRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; return message; + }, + fromAmino(object: QueryVoteRequestAmino): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + return message; + }, + toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { + return QueryVoteRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteRequest): QueryVoteRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVoteRequest", + value: QueryVoteRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteRequestProtoMsg): QueryVoteRequest { + return QueryVoteRequest.decode(message.value); + }, + toProto(message: QueryVoteRequest): Uint8Array { + return QueryVoteRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteRequest): QueryVoteRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVoteRequest", + value: QueryVoteRequest.encode(message).finish() + }; } - }; - function createBaseQueryVoteResponse(): QueryVoteResponse { return { vote: undefined }; } - export const QueryVoteResponse = { - encode(message: QueryVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryVoteResponse", + encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.vote = Vote.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVoteResponse { + fromPartial(object: Partial): QueryVoteResponse { const message = createBaseQueryVoteResponse(); message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; return message; + }, + fromAmino(object: QueryVoteResponseAmino): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + return message; + }, + toAmino(message: QueryVoteResponse): QueryVoteResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVoteResponseAminoMsg): QueryVoteResponse { + return QueryVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteResponse): QueryVoteResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVoteResponse", + value: QueryVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteResponseProtoMsg): QueryVoteResponse { + return QueryVoteResponse.decode(message.value); + }, + toProto(message: QueryVoteResponse): Uint8Array { + return QueryVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteResponse): QueryVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVoteResponse", + value: QueryVoteResponse.encode(message).finish() + }; } - }; - function createBaseQueryVotesRequest(): QueryVotesRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), pagination: undefined }; } - export const QueryVotesRequest = { - encode(message: QueryVotesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.QueryVotesRequest", + encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVotesRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVotesRequest { + fromPartial(object: Partial): QueryVotesRequest { const message = createBaseQueryVotesRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryVotesRequestAmino): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesRequestAminoMsg): QueryVotesRequest { + return QueryVotesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesRequest): QueryVotesRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVotesRequest", + value: QueryVotesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesRequestProtoMsg): QueryVotesRequest { + return QueryVotesRequest.decode(message.value); + }, + toProto(message: QueryVotesRequest): Uint8Array { + return QueryVotesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesRequest): QueryVotesRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVotesRequest", + value: QueryVotesRequest.encode(message).finish() + }; } - }; - function createBaseQueryVotesResponse(): QueryVotesResponse { return { votes: [], pagination: undefined }; } - export const QueryVotesResponse = { - encode(message: QueryVotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryVotesResponse", + encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVotesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.votes.push(Vote.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVotesResponse { + fromPartial(object: Partial): QueryVotesResponse { const message = createBaseQueryVotesResponse(); message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryVotesResponseAmino): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesResponse): QueryVotesResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesResponseAminoMsg): QueryVotesResponse { + return QueryVotesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesResponse): QueryVotesResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVotesResponse", + value: QueryVotesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesResponseProtoMsg): QueryVotesResponse { + return QueryVotesResponse.decode(message.value); + }, + toProto(message: QueryVotesResponse): Uint8Array { + return QueryVotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesResponse): QueryVotesResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVotesResponse", + value: QueryVotesResponse.encode(message).finish() + }; } - }; - function createBaseQueryParamsRequest(): QueryParamsRequest { return { paramsType: "" }; } - export const QueryParamsRequest = { - encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryParamsRequest", + encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.paramsType !== "") { writer.uint32(10).string(message.paramsType); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.paramsType = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsRequest { + fromPartial(object: Partial): QueryParamsRequest { const message = createBaseQueryParamsRequest(); message.paramsType = object.paramsType ?? ""; return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + if (object.params_type !== undefined && object.params_type !== null) { + message.paramsType = object.params_type; + } + return message; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.params_type = message.paramsType; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { votingParams: undefined, @@ -755,360 +1138,541 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { tallyParams: undefined }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingParams !== undefined) { VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); } - if (message.depositParams !== undefined) { DepositParams.encode(message.depositParams, writer.uint32(18).fork()).ldelim(); } - if (message.tallyParams !== undefined) { TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.votingParams = VotingParams.decode(reader, reader.uint32()); break; - case 2: message.depositParams = DepositParams.decode(reader, reader.uint32()); break; - case 3: message.tallyParams = TallyParams.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDepositRequest(): QueryDepositRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), depositor: "" }; } - export const QueryDepositRequest = { - encode(message: QueryDepositRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.QueryDepositRequest", + encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.depositor !== "") { writer.uint32(18).string(message.depositor); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDepositRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.depositor = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDepositRequest { + fromPartial(object: Partial): QueryDepositRequest { const message = createBaseQueryDepositRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.depositor = object.depositor ?? ""; return message; + }, + fromAmino(object: QueryDepositRequestAmino): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + return message; + }, + toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor; + return obj; + }, + fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { + return QueryDepositRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositRequest): QueryDepositRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositRequest", + value: QueryDepositRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositRequestProtoMsg): QueryDepositRequest { + return QueryDepositRequest.decode(message.value); + }, + toProto(message: QueryDepositRequest): Uint8Array { + return QueryDepositRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositRequest): QueryDepositRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositRequest", + value: QueryDepositRequest.encode(message).finish() + }; } - }; - function createBaseQueryDepositResponse(): QueryDepositResponse { return { deposit: undefined }; } - export const QueryDepositResponse = { - encode(message: QueryDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryDepositResponse", + encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deposit !== undefined) { Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDepositResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.deposit = Deposit.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDepositResponse { + fromPartial(object: Partial): QueryDepositResponse { const message = createBaseQueryDepositResponse(); message.deposit = object.deposit !== undefined && object.deposit !== null ? Deposit.fromPartial(object.deposit) : undefined; return message; + }, + fromAmino(object: QueryDepositResponseAmino): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + if (object.deposit !== undefined && object.deposit !== null) { + message.deposit = Deposit.fromAmino(object.deposit); + } + return message; + }, + toAmino(message: QueryDepositResponse): QueryDepositResponseAmino { + const obj: any = {}; + obj.deposit = message.deposit ? Deposit.toAmino(message.deposit) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositResponseAminoMsg): QueryDepositResponse { + return QueryDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositResponse): QueryDepositResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositResponse", + value: QueryDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositResponseProtoMsg): QueryDepositResponse { + return QueryDepositResponse.decode(message.value); + }, + toProto(message: QueryDepositResponse): Uint8Array { + return QueryDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositResponse): QueryDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositResponse", + value: QueryDepositResponse.encode(message).finish() + }; } - }; - function createBaseQueryDepositsRequest(): QueryDepositsRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), pagination: undefined }; } - export const QueryDepositsRequest = { - encode(message: QueryDepositsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", + encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDepositsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDepositsRequest { + fromPartial(object: Partial): QueryDepositsRequest { const message = createBaseQueryDepositsRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDepositsRequestAmino): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsRequestAminoMsg): QueryDepositsRequest { + return QueryDepositsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsRequest): QueryDepositsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositsRequest", + value: QueryDepositsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsRequestProtoMsg): QueryDepositsRequest { + return QueryDepositsRequest.decode(message.value); + }, + toProto(message: QueryDepositsRequest): Uint8Array { + return QueryDepositsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsRequest): QueryDepositsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", + value: QueryDepositsRequest.encode(message).finish() + }; } - }; - function createBaseQueryDepositsResponse(): QueryDepositsResponse { return { deposits: [], pagination: undefined }; } - export const QueryDepositsResponse = { - encode(message: QueryDepositsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", + encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deposits) { Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDepositsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.deposits.push(Deposit.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDepositsResponse { + fromPartial(object: Partial): QueryDepositsResponse { const message = createBaseQueryDepositsResponse(); message.deposits = object.deposits?.map(e => Deposit.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDepositsResponseAmino): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsResponse): QueryDepositsResponseAmino { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsResponseAminoMsg): QueryDepositsResponse { + return QueryDepositsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsResponse): QueryDepositsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositsResponse", + value: QueryDepositsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsResponseProtoMsg): QueryDepositsResponse { + return QueryDepositsResponse.decode(message.value); + }, + toProto(message: QueryDepositsResponse): Uint8Array { + return QueryDepositsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsResponse): QueryDepositsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", + value: QueryDepositsResponse.encode(message).finish() + }; } - }; - function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const QueryTallyResultRequest = { - encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", + encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTallyResultRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryTallyResultRequest { + fromPartial(object: Partial): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { const message = createBaseQueryTallyResultRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } return message; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultRequestProtoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish() + }; } - }; - function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { tally: undefined }; } - export const QueryTallyResultResponse = { - encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", + encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTallyResultResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.tally = TallyResult.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryTallyResultResponse { + fromPartial(object: Partial): QueryTallyResultResponse { const message = createBaseQueryTallyResultResponse(); message.tally = object.tally !== undefined && object.tally !== null ? TallyResult.fromPartial(object.tally) : undefined; return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + if (object.tally !== undefined && object.tally !== null) { + message.tally = TallyResult.fromAmino(object.tally); + } + return message; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultResponseProtoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/tx.amino.ts b/src/codegen/cosmos/gov/v1/tx.amino.ts index 3b7ec12..33fcf20 100644 --- a/src/codegen/cosmos/gov/v1/tx.amino.ts +++ b/src/codegen/cosmos/gov/v1/tx.amino.ts @@ -1,226 +1,28 @@ -import { voteOptionFromJSON } from "./gov"; -import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; -export interface AminoMsgSubmitProposal extends AminoMsg { - type: "cosmos-sdk/v1/MsgSubmitProposal"; - value: { - messages: { - type_url: string; - value: Uint8Array; - }[]; - initial_deposit: { - denom: string; - amount: string; - }[]; - proposer: string; - metadata: string; - }; -} -export interface AminoMsgExecLegacyContent extends AminoMsg { - type: "cosmos-sdk/v1/MsgExecLegacyContent"; - value: { - content: { - type_url: string; - value: Uint8Array; - }; - authority: string; - }; -} -export interface AminoMsgVote extends AminoMsg { - type: "cosmos-sdk/v1/MsgVote"; - value: { - proposal_id: string; - voter: string; - option: number; - metadata: string; - }; -} -export interface AminoMsgVoteWeighted extends AminoMsg { - type: "cosmos-sdk/v1/MsgVoteWeighted"; - value: { - proposal_id: string; - voter: string; - options: { - option: number; - weight: string; - }[]; - metadata: string; - }; -} -export interface AminoMsgDeposit extends AminoMsg { - type: "cosmos-sdk/v1/MsgDeposit"; - value: { - proposal_id: string; - depositor: string; - amount: { - denom: string; - amount: string; - }[]; - }; -} export const AminoConverter = { "/cosmos.gov.v1.MsgSubmitProposal": { aminoType: "cosmos-sdk/v1/MsgSubmitProposal", - toAmino: ({ - messages, - initialDeposit, - proposer, - metadata - }: MsgSubmitProposal): AminoMsgSubmitProposal["value"] => { - return { - messages: messages.map(el0 => ({ - type_url: el0.typeUrl, - value: el0.value - })), - initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })), - proposer, - metadata - }; - }, - fromAmino: ({ - messages, - initial_deposit, - proposer, - metadata - }: AminoMsgSubmitProposal["value"]): MsgSubmitProposal => { - return { - messages: messages.map(el0 => ({ - typeUrl: el0.type_url, - value: el0.value - })), - initialDeposit: initial_deposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })), - proposer, - metadata - }; - } + toAmino: MsgSubmitProposal.toAmino, + fromAmino: MsgSubmitProposal.fromAmino }, "/cosmos.gov.v1.MsgExecLegacyContent": { aminoType: "cosmos-sdk/v1/MsgExecLegacyContent", - toAmino: ({ - content, - authority - }: MsgExecLegacyContent): AminoMsgExecLegacyContent["value"] => { - return { - content: { - type_url: content.typeUrl, - value: content.value - }, - authority - }; - }, - fromAmino: ({ - content, - authority - }: AminoMsgExecLegacyContent["value"]): MsgExecLegacyContent => { - return { - content: { - typeUrl: content.type_url, - value: content.value - }, - authority - }; - } + toAmino: MsgExecLegacyContent.toAmino, + fromAmino: MsgExecLegacyContent.fromAmino }, "/cosmos.gov.v1.MsgVote": { aminoType: "cosmos-sdk/v1/MsgVote", - toAmino: ({ - proposalId, - voter, - option, - metadata - }: MsgVote): AminoMsgVote["value"] => { - return { - proposal_id: proposalId.toString(), - voter, - option, - metadata - }; - }, - fromAmino: ({ - proposal_id, - voter, - option, - metadata - }: AminoMsgVote["value"]): MsgVote => { - return { - proposalId: Long.fromString(proposal_id), - voter, - option: voteOptionFromJSON(option), - metadata - }; - } + toAmino: MsgVote.toAmino, + fromAmino: MsgVote.fromAmino }, "/cosmos.gov.v1.MsgVoteWeighted": { aminoType: "cosmos-sdk/v1/MsgVoteWeighted", - toAmino: ({ - proposalId, - voter, - options, - metadata - }: MsgVoteWeighted): AminoMsgVoteWeighted["value"] => { - return { - proposal_id: proposalId.toString(), - voter, - options: options.map(el0 => ({ - option: el0.option, - weight: el0.weight - })), - metadata - }; - }, - fromAmino: ({ - proposal_id, - voter, - options, - metadata - }: AminoMsgVoteWeighted["value"]): MsgVoteWeighted => { - return { - proposalId: Long.fromString(proposal_id), - voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), - weight: el0.weight - })), - metadata - }; - } + toAmino: MsgVoteWeighted.toAmino, + fromAmino: MsgVoteWeighted.fromAmino }, "/cosmos.gov.v1.MsgDeposit": { aminoType: "cosmos-sdk/v1/MsgDeposit", - toAmino: ({ - proposalId, - depositor, - amount - }: MsgDeposit): AminoMsgDeposit["value"] => { - return { - proposal_id: proposalId.toString(), - depositor, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })) - }; - }, - fromAmino: ({ - proposal_id, - depositor, - amount - }: AminoMsgDeposit["value"]): MsgDeposit => { - return { - proposalId: Long.fromString(proposal_id), - depositor, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })) - }; - } + toAmino: MsgDeposit.toAmino, + fromAmino: MsgDeposit.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/tx.registry.ts b/src/codegen/cosmos/gov/v1/tx.registry.ts index 37ce8ff..3cdef1e 100644 --- a/src/codegen/cosmos/gov/v1/tx.registry.ts +++ b/src/codegen/cosmos/gov/v1/tx.registry.ts @@ -14,35 +14,30 @@ export const MessageComposer = { value: MsgSubmitProposal.encode(value).finish() }; }, - execLegacyContent(value: MsgExecLegacyContent) { return { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", value: MsgExecLegacyContent.encode(value).finish() }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.gov.v1.MsgVote", value: MsgVote.encode(value).finish() }; }, - voteWeighted(value: MsgVoteWeighted) { return { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value: MsgVoteWeighted.encode(value).finish() }; }, - deposit(value: MsgDeposit) { return { typeUrl: "/cosmos.gov.v1.MsgDeposit", value: MsgDeposit.encode(value).finish() }; } - }, withTypeUrl: { submitProposal(value: MsgSubmitProposal) { @@ -51,35 +46,30 @@ export const MessageComposer = { value }; }, - execLegacyContent(value: MsgExecLegacyContent) { return { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", value }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.gov.v1.MsgVote", value }; }, - voteWeighted(value: MsgVoteWeighted) { return { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value }; }, - deposit(value: MsgDeposit) { return { typeUrl: "/cosmos.gov.v1.MsgDeposit", value }; } - }, fromPartial: { submitProposal(value: MsgSubmitProposal) { @@ -88,34 +78,29 @@ export const MessageComposer = { value: MsgSubmitProposal.fromPartial(value) }; }, - execLegacyContent(value: MsgExecLegacyContent) { return { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", value: MsgExecLegacyContent.fromPartial(value) }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.gov.v1.MsgVote", value: MsgVote.fromPartial(value) }; }, - voteWeighted(value: MsgVoteWeighted) { return { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial(value) }; }, - deposit(value: MsgDeposit) { return { typeUrl: "/cosmos.gov.v1.MsgDeposit", value: MsgDeposit.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/tx.rpc.msg.ts b/src/codegen/cosmos/gov/v1/tx.rpc.msg.ts index 2bd32ee..2a8605e 100644 --- a/src/codegen/cosmos/gov/v1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/gov/v1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalResponse, MsgExecLegacyContent, MsgExecLegacyContentResponse, MsgVote, MsgVoteResponse, MsgVoteWeighted, MsgVoteWeightedResponse, MsgDeposit, MsgDepositResponse } from "./tx"; /** Msg defines the gov Msg service. */ - export interface Msg { /** SubmitProposal defines a method to create new proposal given a content. */ submitProposal(request: MsgSubmitProposal): Promise; @@ -10,21 +9,16 @@ export interface Msg { * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal * to execute a legacy content-based proposal. */ - execLegacyContent(request: MsgExecLegacyContent): Promise; /** Vote defines a method to add a vote on a specific proposal. */ - vote(request: MsgVote): Promise; /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ - voteWeighted(request: MsgVoteWeighted): Promise; /** Deposit defines a method to add deposit on a specific proposal. */ - deposit(request: MsgDeposit): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.submitProposal = this.submitProposal.bind(this); @@ -33,35 +27,29 @@ export class MsgClientImpl implements Msg { 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("cosmos.gov.v1.Msg", "SubmitProposal", data); - return promise.then(data => MsgSubmitProposalResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Msg", "ExecLegacyContent", data); - return promise.then(data => MsgExecLegacyContentResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Msg", "Vote", data); - return promise.then(data => MsgVoteResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgVoteResponse.decode(new BinaryReader(data))); } - voteWeighted(request: MsgVoteWeighted): Promise { const data = MsgVoteWeighted.encode(request).finish(); const promise = this.rpc.request("cosmos.gov.v1.Msg", "VoteWeighted", data); - return promise.then(data => MsgVoteWeightedResponse.decode(new _m0.Reader(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("cosmos.gov.v1.Msg", "Deposit", data); - return promise.then(data => MsgDepositResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1/tx.ts b/src/codegen/cosmos/gov/v1/tx.ts index 79744b8..d3201af 100644 --- a/src/codegen/cosmos/gov/v1/tx.ts +++ b/src/codegen/cosmos/gov/v1/tx.ts @@ -1,139 +1,243 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary * proposal Content. */ - export interface MsgSubmitProposal { messages: Any[]; initialDeposit: Coin[]; proposer: string; /** metadata is any arbitrary metadata attached to the proposal. */ - metadata: string; } +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal"; + value: Uint8Array; +} +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalAmino { + messages?: AnyAmino[]; + initial_deposit?: CoinAmino[]; + proposer?: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata?: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/v1/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary * proposal Content. */ - export interface MsgSubmitProposalSDKType { messages: AnySDKType[]; initial_deposit: CoinSDKType[]; proposer: string; - /** metadata is any arbitrary metadata attached to the proposal. */ - metadata: string; } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ - export interface MsgSubmitProposalResponse { - proposalId: Long; + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + proposal_id?: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/v1/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ - export interface MsgSubmitProposalResponseSDKType { - proposal_id: Long; + proposal_id: bigint; } /** * MsgExecLegacyContent is used to wrap the legacy content field into a message. * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. */ - export interface MsgExecLegacyContent { /** content is the proposal's content. */ content?: Any; /** authority must be the gov module address. */ - authority: string; } +export interface MsgExecLegacyContentProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent"; + value: Uint8Array; +} /** * MsgExecLegacyContent is used to wrap the legacy content field into a message. * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. */ - -export interface MsgExecLegacyContentSDKType { +export interface MsgExecLegacyContentAmino { /** content is the proposal's content. */ - content?: AnySDKType; + content?: AnyAmino; /** authority must be the gov module address. */ - + authority?: string; +} +export interface MsgExecLegacyContentAminoMsg { + type: "cosmos-sdk/v1/MsgExecLegacyContent"; + value: MsgExecLegacyContentAmino; +} +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContentSDKType { + content?: AnySDKType; authority: string; } /** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ - export interface MsgExecLegacyContentResponse {} +export interface MsgExecLegacyContentResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse"; + value: Uint8Array; +} +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponseAmino {} +export interface MsgExecLegacyContentResponseAminoMsg { + type: "cosmos-sdk/v1/MsgExecLegacyContentResponse"; + value: MsgExecLegacyContentResponseAmino; +} /** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ - export interface MsgExecLegacyContentResponseSDKType {} /** MsgVote defines a message to cast a vote. */ - export interface MsgVote { - proposalId: Long; + proposalId: bigint; voter: string; option: VoteOption; metadata: string; } +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVote"; + value: Uint8Array; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteAmino { + proposal_id?: string; + voter?: string; + option?: VoteOption; + metadata?: string; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/v1/MsgVote"; + value: MsgVoteAmino; +} /** MsgVote defines a message to cast a vote. */ - export interface MsgVoteSDKType { - proposal_id: Long; + proposal_id: bigint; voter: string; - option: VoteOptionSDKType; + option: VoteOption; metadata: string; } /** MsgVoteResponse defines the Msg/Vote response type. */ - export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/v1/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} /** MsgVoteResponse defines the Msg/Vote response type. */ - export interface MsgVoteResponseSDKType {} /** MsgVoteWeighted defines a message to cast a vote. */ - export interface MsgVoteWeighted { - proposalId: Long; + proposalId: bigint; voter: string; options: WeightedVoteOption[]; metadata: string; } +export interface MsgVoteWeightedProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted"; + value: Uint8Array; +} +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeightedAmino { + proposal_id?: string; + voter?: string; + options?: WeightedVoteOptionAmino[]; + metadata?: string; +} +export interface MsgVoteWeightedAminoMsg { + type: "cosmos-sdk/v1/MsgVoteWeighted"; + value: MsgVoteWeightedAmino; +} /** MsgVoteWeighted defines a message to cast a vote. */ - export interface MsgVoteWeightedSDKType { - proposal_id: Long; + proposal_id: bigint; voter: string; options: WeightedVoteOptionSDKType[]; metadata: string; } /** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ - export interface MsgVoteWeightedResponse {} +export interface MsgVoteWeightedResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse"; + value: Uint8Array; +} +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponseAmino {} +export interface MsgVoteWeightedResponseAminoMsg { + type: "cosmos-sdk/v1/MsgVoteWeightedResponse"; + value: MsgVoteWeightedResponseAmino; +} /** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ - export interface MsgVoteWeightedResponseSDKType {} /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ - export interface MsgDeposit { - proposalId: Long; + proposalId: bigint; depositor: string; amount: Coin[]; } +export interface MsgDepositProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgDeposit"; + value: Uint8Array; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositAmino { + proposal_id?: string; + depositor?: string; + amount?: CoinAmino[]; +} +export interface MsgDepositAminoMsg { + type: "cosmos-sdk/v1/MsgDeposit"; + value: MsgDepositAmino; +} /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ - export interface MsgDepositSDKType { - proposal_id: Long; + proposal_id: bigint; depositor: string; amount: CoinSDKType[]; } /** MsgDepositResponse defines the Msg/Deposit response type. */ - export interface MsgDepositResponse {} +export interface MsgDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse"; + value: Uint8Array; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseAmino {} +export interface MsgDepositResponseAminoMsg { + type: "cosmos-sdk/v1/MsgDepositResponse"; + value: MsgDepositResponseAmino; +} /** MsgDepositResponse defines the Msg/Deposit response type. */ - export interface MsgDepositResponseSDKType {} - function createBaseMsgSubmitProposal(): MsgSubmitProposal { return { messages: [], @@ -142,520 +246,785 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { metadata: "" }; } - export const MsgSubmitProposal = { - encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.messages) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.initialDeposit) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.proposer !== "") { writer.uint32(26).string(message.proposer); } - if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.messages.push(Any.decode(reader, reader.uint32())); break; - case 2: message.initialDeposit.push(Coin.decode(reader, reader.uint32())); break; - case 3: message.proposer = reader.string(); break; - case 4: message.metadata = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitProposal { + fromPartial(object: Partial): 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 ?? ""; return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = []; + } + if (message.initialDeposit) { + obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.initial_deposit = []; + } + obj.proposer = message.proposer; + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/v1/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; } - }; - function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const MsgSubmitProposalResponse = { - encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitProposalResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + fromPartial(object: Partial): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { const message = createBaseMsgSubmitProposalResponse(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; } - }; - function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { return { content: undefined, authority: "" }; } - export const MsgExecLegacyContent = { - encode(message: MsgExecLegacyContent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + encode(message: MsgExecLegacyContent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.content !== undefined) { Any.encode(message.content, writer.uint32(10).fork()).ldelim(); } - if (message.authority !== "") { writer.uint32(18).string(message.authority); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContent { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgExecLegacyContent(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.content = Any.decode(reader, reader.uint32()); break; - case 2: message.authority = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgExecLegacyContent { + fromPartial(object: Partial): MsgExecLegacyContent { const message = createBaseMsgExecLegacyContent(); message.content = object.content !== undefined && object.content !== null ? Any.fromPartial(object.content) : undefined; message.authority = object.authority ?? ""; return message; + }, + fromAmino(object: MsgExecLegacyContentAmino): MsgExecLegacyContent { + const message = createBaseMsgExecLegacyContent(); + if (object.content !== undefined && object.content !== null) { + message.content = Any.fromAmino(object.content); + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { + const obj: any = {}; + obj.content = message.content ? Any.toAmino(message.content) : undefined; + obj.authority = message.authority; + return obj; + }, + fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { + return MsgExecLegacyContent.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecLegacyContent): MsgExecLegacyContentAminoMsg { + return { + type: "cosmos-sdk/v1/MsgExecLegacyContent", + value: MsgExecLegacyContent.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecLegacyContentProtoMsg): MsgExecLegacyContent { + return MsgExecLegacyContent.decode(message.value); + }, + toProto(message: MsgExecLegacyContent): Uint8Array { + return MsgExecLegacyContent.encode(message).finish(); + }, + toProtoMsg(message: MsgExecLegacyContent): MsgExecLegacyContentProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.encode(message).finish() + }; } - }; - function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { return {}; } - export const MsgExecLegacyContentResponse = { - encode(_: MsgExecLegacyContentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", + encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContentResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgExecLegacyContentResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgExecLegacyContentResponse { + fromPartial(_: Partial): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, + fromAmino(_: MsgExecLegacyContentResponseAmino): MsgExecLegacyContentResponse { const message = createBaseMsgExecLegacyContentResponse(); return message; + }, + toAmino(_: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgExecLegacyContentResponseAminoMsg): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgExecLegacyContentResponse", + value: MsgExecLegacyContentResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecLegacyContentResponseProtoMsg): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.decode(message.value); + }, + toProto(message: MsgExecLegacyContentResponse): Uint8Array { + return MsgExecLegacyContentResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", + value: MsgExecLegacyContentResponse.encode(message).finish() + }; } - }; - function createBaseMsgVote(): MsgVote { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "", option: 0, metadata: "" }; } - export const MsgVote = { - encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.MsgVote", + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - if (message.option !== 0) { writer.uint32(24).int32(message.option); } - if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - case 3: message.option = (reader.int32() as any); break; - case 4: message.metadata = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgVote { + fromPartial(object: Partial): MsgVote { const message = createBaseMsgVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.option = object.option ?? 0; message.metadata = object.metadata ?? ""; return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = voteOptionFromJSON(object.option); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + obj.option = voteOptionToJSON(message.option); + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.encode(message).finish() + }; } - }; - function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; } - export const MsgVoteResponse = { - encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse", + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgVoteResponse { + fromPartial(_: Partial): MsgVoteResponse { const message = createBaseMsgVoteResponse(); return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; } - }; - function createBaseMsgVoteWeighted(): MsgVoteWeighted { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "", options: [], metadata: "" }; } - export const MsgVoteWeighted = { - encode(message: MsgVoteWeighted, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - for (const v of message.options) { WeightedVoteOption.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVoteWeighted(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - case 3: message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); break; - case 4: message.metadata = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgVoteWeighted { + fromPartial(object: Partial): MsgVoteWeighted { const message = createBaseMsgVoteWeighted(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; message.metadata = object.metadata ?? ""; return message; + }, + fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = []; + } + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { + return MsgVoteWeighted.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeighted): MsgVoteWeightedAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteWeighted", + value: MsgVoteWeighted.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedProtoMsg): MsgVoteWeighted { + return MsgVoteWeighted.decode(message.value); + }, + toProto(message: MsgVoteWeighted): Uint8Array { + return MsgVoteWeighted.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeighted): MsgVoteWeightedProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(message).finish() + }; } - }; - function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { return {}; } - export const MsgVoteWeightedResponse = { - encode(_: MsgVoteWeightedResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeightedResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVoteWeightedResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgVoteWeightedResponse { + fromPartial(_: Partial): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + fromAmino(_: MsgVoteWeightedResponseAmino): MsgVoteWeightedResponse { const message = createBaseMsgVoteWeightedResponse(); return message; + }, + toAmino(_: MsgVoteWeightedResponse): MsgVoteWeightedResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedResponseAminoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedResponseProtoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.decode(message.value); + }, + toProto(message: MsgVoteWeightedResponse): Uint8Array { + return MsgVoteWeightedResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.encode(message).finish() + }; } - }; - function createBaseMsgDeposit(): MsgDeposit { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), depositor: "", amount: [] }; } - export const MsgDeposit = { - encode(message: MsgDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.depositor !== "") { writer.uint32(18).string(message.depositor); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDeposit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.depositor = reader.string(); break; - case 3: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgDeposit { + fromPartial(object: Partial): MsgDeposit { const message = createBaseMsgDeposit(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.depositor = object.depositor ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgDepositAmino): MsgDeposit { + const message = createBaseMsgDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgDeposit): MsgDepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgDepositAminoMsg): MsgDeposit { + return MsgDeposit.fromAmino(object.value); + }, + toAminoMsg(message: MsgDeposit): MsgDepositAminoMsg { + return { + type: "cosmos-sdk/v1/MsgDeposit", + value: MsgDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositProtoMsg): MsgDeposit { + return MsgDeposit.decode(message.value); + }, + toProto(message: MsgDeposit): Uint8Array { + return MsgDeposit.encode(message).finish(); + }, + toProtoMsg(message: MsgDeposit): MsgDepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.encode(message).finish() + }; } - }; - function createBaseMsgDepositResponse(): MsgDepositResponse { return {}; } - export const MsgDepositResponse = { - encode(_: MsgDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse", + encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDepositResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgDepositResponse { + fromPartial(_: Partial): MsgDepositResponse { const message = createBaseMsgDepositResponse(); return message; + }, + fromAmino(_: MsgDepositResponseAmino): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + toAmino(_: MsgDepositResponse): MsgDepositResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositResponseAminoMsg): MsgDepositResponse { + return MsgDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositResponse): MsgDepositResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgDepositResponse", + value: MsgDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositResponseProtoMsg): MsgDepositResponse { + return MsgDepositResponse.decode(message.value); + }, + toProto(message: MsgDepositResponse): Uint8Array { + return MsgDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositResponse): MsgDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse", + value: MsgDepositResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/genesis.ts b/src/codegen/cosmos/gov/v1beta1/genesis.ts index 7931163..f082fdf 100644 --- a/src/codegen/cosmos/gov/v1beta1/genesis.ts +++ b/src/codegen/cosmos/gov/v1beta1/genesis.ts @@ -1,149 +1,132 @@ -import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the gov module's genesis state. */ - export interface GenesisState { /** starting_proposal_id is the ID of the starting proposal. */ - startingProposalId: Long; + startingProposalId: bigint; /** deposits defines all the deposits present at genesis. */ - deposits: Deposit[]; /** votes defines all the votes present at genesis. */ - votes: Vote[]; /** proposals defines all the proposals present at genesis. */ - proposals: Proposal[]; /** params defines all the paramaters of related to deposit. */ - - depositParams?: DepositParams; + depositParams: DepositParams; /** params defines all the paramaters of related to voting. */ - - votingParams?: VotingParams; + votingParams: VotingParams; /** params defines all the paramaters of related to tally. */ - - tallyParams?: TallyParams; + tallyParams: TallyParams; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.GenesisState"; + value: Uint8Array; } /** GenesisState defines the gov module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** starting_proposal_id is the ID of the starting proposal. */ - starting_proposal_id: Long; + starting_proposal_id?: string; /** deposits defines all the deposits present at genesis. */ - - deposits: DepositSDKType[]; + deposits?: DepositAmino[]; /** votes defines all the votes present at genesis. */ - - votes: VoteSDKType[]; + votes?: VoteAmino[]; /** proposals defines all the proposals present at genesis. */ - - proposals: ProposalSDKType[]; + proposals?: ProposalAmino[]; /** params defines all the paramaters of related to deposit. */ - - deposit_params?: DepositParamsSDKType; + deposit_params?: DepositParamsAmino; /** params defines all the paramaters of related to voting. */ - - voting_params?: VotingParamsSDKType; + voting_params?: VotingParamsAmino; /** params defines all the paramaters of related to tally. */ - - tally_params?: TallyParamsSDKType; + tally_params?: TallyParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisStateSDKType { + starting_proposal_id: bigint; + deposits: DepositSDKType[]; + votes: VoteSDKType[]; + proposals: ProposalSDKType[]; + deposit_params: DepositParamsSDKType; + voting_params: VotingParamsSDKType; + tally_params: TallyParamsSDKType; } - function createBaseGenesisState(): GenesisState { return { - startingProposalId: Long.UZERO, + startingProposalId: BigInt(0), deposits: [], votes: [], proposals: [], - depositParams: undefined, - votingParams: undefined, - tallyParams: undefined + depositParams: DepositParams.fromPartial({}), + votingParams: VotingParams.fromPartial({}), + tallyParams: TallyParams.fromPartial({}) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.startingProposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.startingProposalId !== BigInt(0)) { writer.uint32(8).uint64(message.startingProposalId); } - for (const v of message.deposits) { Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.votes) { Vote.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.depositParams !== undefined) { DepositParams.encode(message.depositParams, writer.uint32(42).fork()).ldelim(); } - if (message.votingParams !== undefined) { VotingParams.encode(message.votingParams, writer.uint32(50).fork()).ldelim(); } - if (message.tallyParams !== undefined) { TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.startingProposalId = (reader.uint64() as Long); + message.startingProposalId = reader.uint64(); break; - case 2: message.deposits.push(Deposit.decode(reader, reader.uint32())); break; - case 3: message.votes.push(Vote.decode(reader, reader.uint32())); break; - case 4: message.proposals.push(Proposal.decode(reader, reader.uint32())); break; - case 5: message.depositParams = DepositParams.decode(reader, reader.uint32()); break; - case 6: message.votingParams = VotingParams.decode(reader, reader.uint32()); break; - case 7: message.tallyParams = TallyParams.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); - message.startingProposalId = object.startingProposalId !== undefined && object.startingProposalId !== null ? Long.fromValue(object.startingProposalId) : Long.UZERO; + message.startingProposalId = object.startingProposalId !== undefined && object.startingProposalId !== null ? BigInt(object.startingProposalId.toString()) : BigInt(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)) || []; @@ -151,6 +134,68 @@ export const GenesisState = { 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; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.starting_proposal_id !== undefined && object.starting_proposal_id !== null) { + message.startingProposalId = BigInt(object.starting_proposal_id); + } + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = []; + } + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/gov.ts b/src/codegen/cosmos/gov/v1beta1/gov.ts index fa8cf81..e286d7f 100644 --- a/src/codegen/cosmos/gov/v1beta1/gov.ts +++ b/src/codegen/cosmos/gov/v1beta1/gov.ts @@ -1,69 +1,43 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long, toTimestamp, fromTimestamp } from "../../../helpers"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ - export enum VoteOption { /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ VOTE_OPTION_UNSPECIFIED = 0, - /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ VOTE_OPTION_YES = 1, - /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ VOTE_OPTION_ABSTAIN = 2, - /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ VOTE_OPTION_NO = 3, - - /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ - VOTE_OPTION_NO_WITH_VETO = 4, - UNRECOGNIZED = -1, -} -/** VoteOption enumerates the valid vote options for a given governance proposal. */ - -export enum VoteOptionSDKType { - /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ - VOTE_OPTION_UNSPECIFIED = 0, - - /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ - VOTE_OPTION_YES = 1, - - /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ - VOTE_OPTION_ABSTAIN = 2, - - /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ - VOTE_OPTION_NO = 3, - /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ VOTE_OPTION_NO_WITH_VETO = 4, UNRECOGNIZED = -1, } +export const VoteOptionSDKType = VoteOption; +export const VoteOptionAmino = VoteOption; export function voteOptionFromJSON(object: any): VoteOption { switch (object) { case 0: case "VOTE_OPTION_UNSPECIFIED": return VoteOption.VOTE_OPTION_UNSPECIFIED; - case 1: case "VOTE_OPTION_YES": return VoteOption.VOTE_OPTION_YES; - case 2: case "VOTE_OPTION_ABSTAIN": return VoteOption.VOTE_OPTION_ABSTAIN; - case 3: case "VOTE_OPTION_NO": return VoteOption.VOTE_OPTION_NO; - case 4: case "VOTE_OPTION_NO_WITH_VETO": return VoteOption.VOTE_OPTION_NO_WITH_VETO; - case -1: case "UNRECOGNIZED": default: @@ -74,91 +48,43 @@ export function voteOptionToJSON(object: VoteOption): string { switch (object) { case VoteOption.VOTE_OPTION_UNSPECIFIED: return "VOTE_OPTION_UNSPECIFIED"; - case VoteOption.VOTE_OPTION_YES: return "VOTE_OPTION_YES"; - case VoteOption.VOTE_OPTION_ABSTAIN: return "VOTE_OPTION_ABSTAIN"; - case VoteOption.VOTE_OPTION_NO: return "VOTE_OPTION_NO"; - case VoteOption.VOTE_OPTION_NO_WITH_VETO: return "VOTE_OPTION_NO_WITH_VETO"; - case VoteOption.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** ProposalStatus enumerates the valid statuses of a proposal. */ - export enum ProposalStatus { /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. */ PROPOSAL_STATUS_UNSPECIFIED = 0, - /** * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit * period. */ PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, - /** * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting * period. */ PROPOSAL_STATUS_VOTING_PERIOD = 2, - /** * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has * passed. */ PROPOSAL_STATUS_PASSED = 3, - /** * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has * been rejected. */ PROPOSAL_STATUS_REJECTED = 4, - - /** - * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - * failed. - */ - PROPOSAL_STATUS_FAILED = 5, - UNRECOGNIZED = -1, -} -/** ProposalStatus enumerates the valid statuses of a proposal. */ - -export enum ProposalStatusSDKType { - /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. */ - PROPOSAL_STATUS_UNSPECIFIED = 0, - - /** - * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - * period. - */ - PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, - - /** - * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - * period. - */ - PROPOSAL_STATUS_VOTING_PERIOD = 2, - - /** - * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - * passed. - */ - PROPOSAL_STATUS_PASSED = 3, - - /** - * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - * been rejected. - */ - PROPOSAL_STATUS_REJECTED = 4, - /** * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has * failed. @@ -166,32 +92,28 @@ export enum ProposalStatusSDKType { PROPOSAL_STATUS_FAILED = 5, UNRECOGNIZED = -1, } +export const ProposalStatusSDKType = ProposalStatus; +export const ProposalStatusAmino = ProposalStatus; export function proposalStatusFromJSON(object: any): ProposalStatus { switch (object) { case 0: case "PROPOSAL_STATUS_UNSPECIFIED": return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; - case 1: case "PROPOSAL_STATUS_DEPOSIT_PERIOD": return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; - case 2: case "PROPOSAL_STATUS_VOTING_PERIOD": return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; - case 3: case "PROPOSAL_STATUS_PASSED": return ProposalStatus.PROPOSAL_STATUS_PASSED; - case 4: case "PROPOSAL_STATUS_REJECTED": return ProposalStatus.PROPOSAL_STATUS_REJECTED; - case 5: case "PROPOSAL_STATUS_FAILED": return ProposalStatus.PROPOSAL_STATUS_FAILED; - case -1: case "UNRECOGNIZED": default: @@ -202,22 +124,16 @@ 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"; @@ -228,35 +144,64 @@ export function proposalStatusToJSON(object: ProposalStatus): string { * * Since: cosmos-sdk 0.43 */ - export interface WeightedVoteOption { option: VoteOption; weight: string; } +export interface WeightedVoteOptionProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption"; + value: Uint8Array; +} +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOptionAmino { + option?: VoteOption; + weight?: string; +} +export interface WeightedVoteOptionAminoMsg { + type: "cosmos-sdk/WeightedVoteOption"; + value: WeightedVoteOptionAmino; +} /** * WeightedVoteOption defines a unit of vote for vote split. * * Since: cosmos-sdk 0.43 */ - export interface WeightedVoteOptionSDKType { - option: VoteOptionSDKType; + option: VoteOption; weight: string; } /** * TextProposal defines a standard text proposal whose changes need to be * manually updated in case of approval. */ - export interface TextProposal { title: string; description: string; } +export interface TextProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TextProposal"; + value: Uint8Array; +} +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposalAmino { + title?: string; + description?: string; +} +export interface TextProposalAminoMsg { + type: "cosmos-sdk/TextProposal"; + value: TextProposalAmino; +} /** * TextProposal defines a standard text proposal whose changes need to be * manually updated in case of approval. */ - export interface TextProposalSDKType { title: string; description: string; @@ -265,26 +210,40 @@ export interface TextProposalSDKType { * Deposit defines an amount deposited by an account address to an active * proposal. */ - export interface Deposit { - proposalId: Long; + proposalId: bigint; depositor: string; amount: Coin[]; } +export interface DepositProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Deposit"; + value: Uint8Array; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositAmino { + proposal_id?: string; + depositor?: string; + amount?: CoinAmino[]; +} +export interface DepositAminoMsg { + type: "cosmos-sdk/Deposit"; + value: DepositAmino; +} /** * Deposit defines an amount deposited by an account address to an active * proposal. */ - export interface DepositSDKType { - proposal_id: Long; + proposal_id: bigint; depositor: string; amount: CoinSDKType[]; } /** Proposal defines the core field members of a governance proposal. */ - export interface Proposal { - proposalId: Long; + proposalId: bigint; content?: Any; status: ProposalStatus; /** @@ -292,43 +251,73 @@ export interface Proposal { * querying a proposal via gRPC, this field is not populated until the * proposal's voting period has ended. */ - - finalTallyResult?: TallyResult; - submitTime?: Date; - depositEndTime?: Date; + finalTallyResult: TallyResult; + submitTime: Date; + depositEndTime: Date; totalDeposit: Coin[]; - votingStartTime?: Date; - votingEndTime?: Date; + votingStartTime: Date; + votingEndTime: Date; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Proposal"; + value: Uint8Array; } /** Proposal defines the core field members of a governance proposal. */ - -export interface ProposalSDKType { - proposal_id: Long; - content?: AnySDKType; - status: ProposalStatusSDKType; +export interface ProposalAmino { + proposal_id?: string; + content?: AnyAmino; + status?: ProposalStatus; /** * final_tally_result is the final tally result of the proposal. When * querying a proposal via gRPC, this field is not populated until the * proposal's voting period has ended. */ - - final_tally_result?: TallyResultSDKType; - submit_time?: Date; - deposit_end_time?: Date; + final_tally_result?: TallyResultAmino; + submit_time?: string; + deposit_end_time?: string; + total_deposit?: CoinAmino[]; + voting_start_time?: string; + voting_end_time?: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/Proposal"; + value: ProposalAmino; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalSDKType { + proposal_id: bigint; + content?: AnySDKType; + status: ProposalStatus; + final_tally_result: TallyResultSDKType; + submit_time: Date; + deposit_end_time: Date; total_deposit: CoinSDKType[]; - voting_start_time?: Date; - voting_end_time?: Date; + voting_start_time: Date; + voting_end_time: Date; } /** TallyResult defines a standard tally for a governance proposal. */ - export interface TallyResult { yes: string; abstain: string; no: string; noWithVeto: string; } +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TallyResult"; + value: Uint8Array; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultAmino { + yes?: string; + abstain?: string; + no?: string; + no_with_veto?: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/TallyResult"; + value: TallyResultAmino; +} /** TallyResult defines a standard tally for a governance proposal. */ - export interface TallyResultSDKType { yes: string; abstain: string; @@ -339,46 +328,56 @@ export interface TallyResultSDKType { * Vote defines a vote on a governance proposal. * A Vote consists of a proposal ID, the voter, and the vote option. */ - export interface Vote { - proposalId: Long; + proposalId: bigint; voter: string; /** * Deprecated: Prefer to use `options` instead. This field is set in queries * if and only if `len(options) == 1` and that option has weight 1. In all * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. */ - /** @deprecated */ - option: VoteOption; /** Since: cosmos-sdk 0.43 */ - options: WeightedVoteOption[]; } +export interface VoteProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Vote"; + value: Uint8Array; +} /** * Vote defines a vote on a governance proposal. * A Vote consists of a proposal ID, the voter, and the vote option. */ - -export interface VoteSDKType { - proposal_id: Long; - voter: string; +export interface VoteAmino { + proposal_id?: string; + voter?: string; /** * Deprecated: Prefer to use `options` instead. This field is set in queries * if and only if `len(options) == 1` and that option has weight 1. In all * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. */ - /** @deprecated */ - - option: VoteOptionSDKType; + option?: VoteOption; /** Since: cosmos-sdk 0.43 */ - + options?: WeightedVoteOptionAmino[]; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/Vote"; + value: VoteAmino; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteSDKType { + proposal_id: bigint; + voter: string; + /** @deprecated */ + option: VoteOption; options: WeightedVoteOptionSDKType[]; } /** DepositParams defines the params for deposits on governance proposals. */ - export interface DepositParams { /** Minimum deposit for a proposal to enter voting period. */ minDeposit: Coin[]; @@ -386,35 +385,54 @@ export interface DepositParams { * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 * months. */ - - maxDepositPeriod?: Duration; + maxDepositPeriod: Duration; +} +export interface DepositParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.DepositParams"; + value: Uint8Array; } /** DepositParams defines the params for deposits on governance proposals. */ - -export interface DepositParamsSDKType { +export interface DepositParamsAmino { /** Minimum deposit for a proposal to enter voting period. */ - min_deposit: CoinSDKType[]; + min_deposit?: CoinAmino[]; /** * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 * months. */ - - max_deposit_period?: DurationSDKType; + max_deposit_period?: DurationAmino; +} +export interface DepositParamsAminoMsg { + type: "cosmos-sdk/DepositParams"; + value: DepositParamsAmino; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsSDKType { + min_deposit: CoinSDKType[]; + max_deposit_period: DurationSDKType; } /** VotingParams defines the params for voting on governance proposals. */ - export interface VotingParams { /** Length of the voting period. */ - votingPeriod?: Duration; + votingPeriod: Duration; +} +export interface VotingParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.VotingParams"; + value: Uint8Array; } /** VotingParams defines the params for voting on governance proposals. */ - -export interface VotingParamsSDKType { +export interface VotingParamsAmino { /** Length of the voting period. */ - voting_period?: DurationSDKType; + voting_period?: DurationAmino; +} +export interface VotingParamsAminoMsg { + type: "cosmos-sdk/VotingParams"; + value: VotingParamsAmino; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsSDKType { + voting_period: DurationSDKType; } /** 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 @@ -422,321 +440,388 @@ export interface TallyParams { */ quorum: Uint8Array; /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ - threshold: Uint8Array; /** * Minimum value of Veto votes to Total votes ratio for proposal to be * vetoed. Default value: 1/3. */ - vetoThreshold: Uint8Array; } +export interface TallyParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TallyParams"; + value: Uint8Array; +} /** TallyParams defines the params for tallying votes on governance proposals. */ - -export interface TallyParamsSDKType { +export interface TallyParamsAmino { /** * Minimum percentage of total stake needed to vote for a result to be * considered valid. */ - quorum: Uint8Array; + quorum?: string; /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ - - threshold: Uint8Array; + threshold?: string; /** * Minimum value of Veto votes to Total votes ratio for proposal to be * vetoed. Default value: 1/3. */ - + veto_threshold?: string; +} +export interface TallyParamsAminoMsg { + type: "cosmos-sdk/TallyParams"; + value: TallyParamsAmino; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsSDKType { + quorum: Uint8Array; + threshold: Uint8Array; veto_threshold: Uint8Array; } - function createBaseWeightedVoteOption(): WeightedVoteOption { return { option: 0, weight: "" }; } - export const WeightedVoteOption = { - encode(message: WeightedVoteOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", + encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.option !== 0) { writer.uint32(8).int32(message.option); } - if (message.weight !== "") { - writer.uint32(18).string(message.weight); + writer.uint32(18).string(Decimal.fromUserInput(message.weight, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseWeightedVoteOption(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.option = (reader.int32() as any); break; - case 2: - message.weight = reader.string(); + message.weight = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): WeightedVoteOption { + fromPartial(object: Partial): WeightedVoteOption { const message = createBaseWeightedVoteOption(); message.option = object.option ?? 0; message.weight = object.weight ?? ""; return message; + }, + fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + if (object.option !== undefined && object.option !== null) { + message.option = voteOptionFromJSON(object.option); + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + return message; + }, + toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { + const obj: any = {}; + obj.option = voteOptionToJSON(message.option); + obj.weight = message.weight; + return obj; + }, + fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { + return WeightedVoteOption.fromAmino(object.value); + }, + toAminoMsg(message: WeightedVoteOption): WeightedVoteOptionAminoMsg { + return { + type: "cosmos-sdk/WeightedVoteOption", + value: WeightedVoteOption.toAmino(message) + }; + }, + fromProtoMsg(message: WeightedVoteOptionProtoMsg): WeightedVoteOption { + return WeightedVoteOption.decode(message.value); + }, + toProto(message: WeightedVoteOption): Uint8Array { + return WeightedVoteOption.encode(message).finish(); + }, + toProtoMsg(message: WeightedVoteOption): WeightedVoteOptionProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", + value: WeightedVoteOption.encode(message).finish() + }; } - }; - function createBaseTextProposal(): TextProposal { return { title: "", description: "" }; } - export const TextProposal = { - encode(message: TextProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + encode(message: TextProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TextProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTextProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.title = reader.string(); break; - case 2: message.description = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TextProposal { + fromPartial(object: Partial): TextProposal { const message = createBaseTextProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; return message; + }, + fromAmino(object: TextProposalAmino): TextProposal { + const message = createBaseTextProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: TextProposal): TextProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + return obj; + }, + fromAminoMsg(object: TextProposalAminoMsg): TextProposal { + return TextProposal.fromAmino(object.value); + }, + toAminoMsg(message: TextProposal): TextProposalAminoMsg { + return { + type: "cosmos-sdk/TextProposal", + value: TextProposal.toAmino(message) + }; + }, + fromProtoMsg(message: TextProposalProtoMsg): TextProposal { + return TextProposal.decode(message.value); + }, + toProto(message: TextProposal): Uint8Array { + return TextProposal.encode(message).finish(); + }, + toProtoMsg(message: TextProposal): TextProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(message).finish() + }; } - }; - function createBaseDeposit(): Deposit { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), depositor: "", amount: [] }; } - export const Deposit = { - encode(message: Deposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.Deposit", + encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.depositor !== "") { writer.uint32(18).string(message.depositor); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Deposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDeposit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.depositor = reader.string(); break; - case 3: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Deposit { + fromPartial(object: Partial): Deposit { const message = createBaseDeposit(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.depositor = object.depositor ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: DepositAmino): Deposit { + const message = createBaseDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Deposit): DepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: DepositAminoMsg): Deposit { + return Deposit.fromAmino(object.value); + }, + toAminoMsg(message: Deposit): DepositAminoMsg { + return { + type: "cosmos-sdk/Deposit", + value: Deposit.toAmino(message) + }; + }, + fromProtoMsg(message: DepositProtoMsg): Deposit { + return Deposit.decode(message.value); + }, + toProto(message: Deposit): Uint8Array { + return Deposit.encode(message).finish(); + }, + toProtoMsg(message: Deposit): DepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Deposit", + value: Deposit.encode(message).finish() + }; } - }; - function createBaseProposal(): Proposal { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), content: undefined, status: 0, - finalTallyResult: undefined, - submitTime: undefined, - depositEndTime: undefined, + finalTallyResult: TallyResult.fromPartial({}), + submitTime: new Date(), + depositEndTime: new Date(), totalDeposit: [], - votingStartTime: undefined, - votingEndTime: undefined + votingStartTime: new Date(), + votingEndTime: new Date() }; } - export const Proposal = { - encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.content !== undefined) { Any.encode(message.content, writer.uint32(18).fork()).ldelim(); } - if (message.status !== 0) { writer.uint32(24).int32(message.status); } - if (message.finalTallyResult !== undefined) { TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).ldelim(); } - if (message.submitTime !== undefined) { Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); } - if (message.depositEndTime !== undefined) { Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).ldelim(); } - for (const v of message.totalDeposit) { Coin.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.votingStartTime !== undefined) { Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).ldelim(); } - if (message.votingEndTime !== undefined) { Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.content = Any.decode(reader, reader.uint32()); break; - case 3: message.status = (reader.int32() as any); break; - case 4: message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); break; - case 5: message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 6: message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 7: message.totalDeposit.push(Coin.decode(reader, reader.uint32())); break; - case 8: message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 9: message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Proposal { + fromPartial(object: Partial): Proposal { const message = createBaseProposal(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(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; @@ -746,10 +831,75 @@ export const Proposal = { message.votingStartTime = object.votingStartTime ?? undefined; message.votingEndTime = object.votingEndTime ?? undefined; return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.content !== undefined && object.content !== null) { + message.content = Any.fromAmino(object.content); + } + if (object.status !== undefined && object.status !== null) { + message.status = proposalStatusFromJSON(object.status); + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.deposit_end_time !== undefined && object.deposit_end_time !== null) { + message.depositEndTime = fromTimestamp(Timestamp.fromAmino(object.deposit_end_time)); + } + message.totalDeposit = object.total_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.voting_start_time !== undefined && object.voting_start_time !== null) { + message.votingStartTime = fromTimestamp(Timestamp.fromAmino(object.voting_start_time)); + } + if (object.voting_end_time !== undefined && object.voting_end_time !== null) { + message.votingEndTime = fromTimestamp(Timestamp.fromAmino(object.voting_end_time)); + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.content = message.content ? Any.toAmino(message.content) : undefined; + obj.status = proposalStatusToJSON(message.status); + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; + obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; + if (message.totalDeposit) { + obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_deposit = []; + } + obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; + obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Proposal", + value: Proposal.encode(message).finish() + }; } - }; - function createBaseTallyResult(): TallyResult { return { yes: "", @@ -758,248 +908,362 @@ function createBaseTallyResult(): TallyResult { noWithVeto: "" }; } - export const TallyResult = { - encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.TallyResult", + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yes !== "") { writer.uint32(10).string(message.yes); } - if (message.abstain !== "") { writer.uint32(18).string(message.abstain); } - if (message.no !== "") { writer.uint32(26).string(message.no); } - if (message.noWithVeto !== "") { writer.uint32(34).string(message.noWithVeto); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTallyResult(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.yes = reader.string(); break; - case 2: message.abstain = reader.string(); break; - case 3: message.no = reader.string(); break; - case 4: message.noWithVeto = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TallyResult { + fromPartial(object: Partial): TallyResult { const message = createBaseTallyResult(); message.yes = object.yes ?? ""; message.abstain = object.abstain ?? ""; message.no = object.no ?? ""; message.noWithVeto = object.noWithVeto ?? ""; return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes !== undefined && object.yes !== null) { + message.yes = object.yes; + } + if (object.abstain !== undefined && object.abstain !== null) { + message.abstain = object.abstain; + } + if (object.no !== undefined && object.no !== null) { + message.no = object.no; + } + if (object.no_with_veto !== undefined && object.no_with_veto !== null) { + message.noWithVeto = object.no_with_veto; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes = message.yes; + obj.abstain = message.abstain; + obj.no = message.no; + obj.no_with_veto = message.noWithVeto; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TallyResult", + value: TallyResult.encode(message).finish() + }; } - }; - function createBaseVote(): Vote { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "", option: 0, options: [] }; } - export const Vote = { - encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - if (message.option !== 0) { writer.uint32(24).int32(message.option); } - for (const v of message.options) { WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Vote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - case 3: message.option = (reader.int32() as any); break; - case 4: message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Vote { + fromPartial(object: Partial): Vote { const message = createBaseVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.option = object.option ?? 0; message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = voteOptionFromJSON(object.option); + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + obj.option = voteOptionToJSON(message.option); + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = []; + } + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Vote", + value: Vote.encode(message).finish() + }; } - }; - function createBaseDepositParams(): DepositParams { return { minDeposit: [], - maxDepositPeriod: undefined + maxDepositPeriod: Duration.fromPartial({}) }; } - export const DepositParams = { - encode(message: DepositParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.DepositParams", + encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minDeposit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.maxDepositPeriod !== undefined) { Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDepositParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.minDeposit.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DepositParams { + fromPartial(object: Partial): DepositParams { const message = createBaseDepositParams(); message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; return message; + }, + fromAmino(object: DepositParamsAmino): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + return message; + }, + toAmino(message: DepositParams): DepositParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = []; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: DepositParamsAminoMsg): DepositParams { + return DepositParams.fromAmino(object.value); + }, + toAminoMsg(message: DepositParams): DepositParamsAminoMsg { + return { + type: "cosmos-sdk/DepositParams", + value: DepositParams.toAmino(message) + }; + }, + fromProtoMsg(message: DepositParamsProtoMsg): DepositParams { + return DepositParams.decode(message.value); + }, + toProto(message: DepositParams): Uint8Array { + return DepositParams.encode(message).finish(); + }, + toProtoMsg(message: DepositParams): DepositParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.DepositParams", + value: DepositParams.encode(message).finish() + }; } - }; - function createBaseVotingParams(): VotingParams { return { - votingPeriod: undefined + votingPeriod: Duration.fromPartial({}) }; } - export const VotingParams = { - encode(message: VotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.VotingParams", + encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVotingParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.votingPeriod = Duration.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): VotingParams { + fromPartial(object: Partial): VotingParams { const message = createBaseVotingParams(); message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; return message; + }, + fromAmino(object: VotingParamsAmino): VotingParams { + const message = createBaseVotingParams(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + return message; + }, + toAmino(message: VotingParams): VotingParamsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: VotingParamsAminoMsg): VotingParams { + return VotingParams.fromAmino(object.value); + }, + toAminoMsg(message: VotingParams): VotingParamsAminoMsg { + return { + type: "cosmos-sdk/VotingParams", + value: VotingParams.toAmino(message) + }; + }, + fromProtoMsg(message: VotingParamsProtoMsg): VotingParams { + return VotingParams.decode(message.value); + }, + toProto(message: VotingParams): Uint8Array { + return VotingParams.encode(message).finish(); + }, + toProtoMsg(message: VotingParams): VotingParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.VotingParams", + value: VotingParams.encode(message).finish() + }; } - }; - function createBaseTallyParams(): TallyParams { return { quorum: new Uint8Array(), @@ -1007,60 +1271,89 @@ function createBaseTallyParams(): TallyParams { vetoThreshold: new Uint8Array() }; } - export const TallyParams = { - encode(message: TallyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.TallyParams", + encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quorum.length !== 0) { writer.uint32(10).bytes(message.quorum); } - if (message.threshold.length !== 0) { writer.uint32(18).bytes(message.threshold); } - if (message.vetoThreshold.length !== 0) { writer.uint32(26).bytes(message.vetoThreshold); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTallyParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.quorum = reader.bytes(); break; - case 2: message.threshold = reader.bytes(); break; - case 3: message.vetoThreshold = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TallyParams { + fromPartial(object: Partial): TallyParams { const message = createBaseTallyParams(); message.quorum = object.quorum ?? new Uint8Array(); message.threshold = object.threshold ?? new Uint8Array(); message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(); return message; + }, + fromAmino(object: TallyParamsAmino): TallyParams { + const message = createBaseTallyParams(); + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = bytesFromBase64(object.quorum); + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = bytesFromBase64(object.threshold); + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = bytesFromBase64(object.veto_threshold); + } + return message; + }, + toAmino(message: TallyParams): TallyParamsAmino { + const obj: any = {}; + obj.quorum = message.quorum ? base64FromBytes(message.quorum) : undefined; + obj.threshold = message.threshold ? base64FromBytes(message.threshold) : undefined; + obj.veto_threshold = message.vetoThreshold ? base64FromBytes(message.vetoThreshold) : undefined; + return obj; + }, + fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { + return TallyParams.fromAmino(object.value); + }, + toAminoMsg(message: TallyParams): TallyParamsAminoMsg { + return { + type: "cosmos-sdk/TallyParams", + value: TallyParams.toAmino(message) + }; + }, + fromProtoMsg(message: TallyParamsProtoMsg): TallyParams { + return TallyParams.decode(message.value); + }, + toProto(message: TallyParams): Uint8Array { + return TallyParams.encode(message).finish(); + }, + toProtoMsg(message: TallyParams): TallyParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TallyParams", + value: TallyParams.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/query.lcd.ts b/src/codegen/cosmos/gov/v1beta1/query.lcd.ts index 642759d..eeaf06a 100644 --- a/src/codegen/cosmos/gov/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/gov/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -20,96 +19,70 @@ export class LCDQueryClient { this.tallyResult = this.tallyResult.bind(this); } /* Proposal queries proposal details based on ProposalID. */ - - async proposal(params: QueryProposalRequest): Promise { const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}`; return await this.req.get(endpoint); } /* Proposals queries all proposals based on given status. */ - - async proposals(params: QueryProposalsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.proposalStatus !== "undefined") { options.params.proposal_status = params.proposalStatus; } - if (typeof params?.voter !== "undefined") { options.params.voter = params.voter; } - if (typeof params?.depositor !== "undefined") { options.params.depositor = params.depositor; } - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/gov/v1beta1/proposals`; return await this.req.get(endpoint, options); } /* Vote queries voted information based on proposalID, voterAddr. */ - - async vote(params: QueryVoteRequest): Promise { - const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}votes/${params.voter}`; + const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/votes/${params.voter}`; return await this.req.get(endpoint); } /* Votes queries votes of a given proposal. */ - - async votes(params: QueryVotesRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/votes`; return await this.req.get(endpoint, options); } /* Params queries all parameters of the gov module. */ - - async params(params: QueryParamsRequest): Promise { const endpoint = `cosmos/gov/v1beta1/params/${params.paramsType}`; return await this.req.get(endpoint); } /* Deposit queries single deposit information based proposalID, depositAddr. */ - - async deposit(params: QueryDepositRequest): Promise { - const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}deposits/${params.depositor}`; + const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/deposits/${params.depositor}`; return await this.req.get(endpoint); } /* Deposits queries all deposits of a single proposal. */ - - async deposits(params: QueryDepositsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/deposits`; return await this.req.get(endpoint, options); } /* TallyResult queries the tally of a proposal vote. */ - - async tallyResult(params: QueryTallyResultRequest): Promise { const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/tally`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/gov/v1beta1/query.rpc.Query.ts index 246d7da..ead5910 100644 --- a/src/codegen/cosmos/gov/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/gov/v1beta1/query.rpc.Query.ts @@ -1,37 +1,28 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; /** Query defines the gRPC querier service for gov module */ - export interface Query { /** Proposal queries proposal details based on ProposalID. */ proposal(request: QueryProposalRequest): Promise; /** Proposals queries all proposals based on given status. */ - proposals(request: QueryProposalsRequest): Promise; /** Vote queries voted information based on proposalID, voterAddr. */ - vote(request: QueryVoteRequest): Promise; /** Votes queries votes of a given proposal. */ - votes(request: QueryVotesRequest): Promise; /** Params queries all parameters of the gov module. */ - params(request: QueryParamsRequest): Promise; /** Deposit queries single deposit information based proposalID, depositAddr. */ - deposit(request: QueryDepositRequest): Promise; /** Deposits queries all deposits of a single proposal. */ - deposits(request: QueryDepositsRequest): Promise; /** TallyResult queries the tally of a proposal vote. */ - tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.proposal = this.proposal.bind(this); @@ -43,55 +34,46 @@ export class QueryClientImpl implements Query { 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("cosmos.gov.v1beta1.Query", "Proposal", data); - return promise.then(data => QueryProposalResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Query", "Proposals", data); - return promise.then(data => QueryProposalsResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Query", "Vote", data); - return promise.then(data => QueryVoteResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Query", "Votes", data); - return promise.then(data => QueryVotesResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Query", "Deposit", data); - return promise.then(data => QueryDepositResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Query", "Deposits", data); - return promise.then(data => QueryDepositsResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Query", "TallyResult", data); - return promise.then(data => QueryTallyResultResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryTallyResultResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -100,34 +82,26 @@ export const createRpcQueryExtension = (base: QueryClient) => { proposal(request: QueryProposalRequest): Promise { return queryService.proposal(request); }, - proposals(request: QueryProposalsRequest): Promise { return queryService.proposals(request); }, - vote(request: QueryVoteRequest): Promise { return queryService.vote(request); }, - votes(request: QueryVotesRequest): Promise { return queryService.votes(request); }, - params(request: QueryParamsRequest): Promise { return queryService.params(request); }, - deposit(request: QueryDepositRequest): Promise { return queryService.deposit(request); }, - deposits(request: QueryDepositsRequest): Promise { return queryService.deposits(request); }, - tallyResult(request: QueryTallyResultRequest): Promise { return queryService.tallyResult(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/query.ts b/src/codegen/cosmos/gov/v1beta1/query.ts index 65d54d2..46f7ace 100644 --- a/src/codegen/cosmos/gov/v1beta1/query.ts +++ b/src/codegen/cosmos/gov/v1beta1/query.ts @@ -1,149 +1,223 @@ -import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { ProposalStatus, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ - export interface QueryProposalRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest"; + value: Uint8Array; } /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ - -export interface QueryProposalRequestSDKType { +export interface QueryProposalRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/QueryProposalRequest"; + value: QueryProposalRequestAmino; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestSDKType { + proposal_id: bigint; } /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ - export interface QueryProposalResponse { - proposal?: Proposal; + proposal: Proposal; +} +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse"; + value: Uint8Array; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseAmino { + proposal?: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/QueryProposalResponse"; + value: QueryProposalResponseAmino; } /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ - export interface QueryProposalResponseSDKType { - proposal?: ProposalSDKType; + proposal: ProposalSDKType; } /** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ - export interface QueryProposalsRequest { /** proposal_status defines the status of the proposals. */ proposalStatus: ProposalStatus; /** voter defines the voter address for the proposals. */ - voter: string; /** depositor defines the deposit addresses from the proposals. */ - depositor: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryProposalsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest"; + value: Uint8Array; +} /** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ - -export interface QueryProposalsRequestSDKType { +export interface QueryProposalsRequestAmino { /** proposal_status defines the status of the proposals. */ - proposal_status: ProposalStatusSDKType; + proposal_status?: ProposalStatus; /** voter defines the voter address for the proposals. */ - - voter: string; + voter?: string; /** depositor defines the deposit addresses from the proposals. */ - - depositor: string; + depositor?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryProposalsRequestAminoMsg { + type: "cosmos-sdk/QueryProposalsRequest"; + value: QueryProposalsRequestAmino; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestSDKType { + proposal_status: ProposalStatus; + voter: string; + depositor: string; pagination?: PageRequestSDKType; } /** * QueryProposalsResponse is the response type for the Query/Proposals RPC * method. */ - export interface QueryProposalsResponse { proposals: Proposal[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryProposalsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse"; + value: Uint8Array; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseAmino { + proposals?: ProposalAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryProposalsResponseAminoMsg { + type: "cosmos-sdk/QueryProposalsResponse"; + value: QueryProposalsResponseAmino; +} /** * QueryProposalsResponse is the response type for the Query/Proposals RPC * method. */ - export interface QueryProposalsResponseSDKType { proposals: ProposalSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } /** QueryVoteRequest is the request type for the Query/Vote RPC method. */ - export interface QueryVoteRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; /** voter defines the oter address for the proposals. */ - voter: string; } +export interface QueryVoteRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest"; + value: Uint8Array; +} /** QueryVoteRequest is the request type for the Query/Vote RPC method. */ - -export interface QueryVoteRequestSDKType { +export interface QueryVoteRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** voter defines the oter address for the proposals. */ - + voter?: string; +} +export interface QueryVoteRequestAminoMsg { + type: "cosmos-sdk/QueryVoteRequest"; + value: QueryVoteRequestAmino; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestSDKType { + proposal_id: bigint; voter: string; } /** QueryVoteResponse is the response type for the Query/Vote RPC method. */ - export interface QueryVoteResponse { /** vote defined the queried vote. */ - vote?: Vote; + vote: Vote; +} +export interface QueryVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse"; + value: Uint8Array; } /** QueryVoteResponse is the response type for the Query/Vote RPC method. */ - -export interface QueryVoteResponseSDKType { +export interface QueryVoteResponseAmino { /** vote defined the queried vote. */ - vote?: VoteSDKType; + vote?: VoteAmino; +} +export interface QueryVoteResponseAminoMsg { + type: "cosmos-sdk/QueryVoteResponse"; + value: QueryVoteResponseAmino; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseSDKType { + vote: VoteSDKType; } /** QueryVotesRequest is the request type for the Query/Votes RPC method. */ - export interface QueryVotesRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryVotesRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest"; + value: Uint8Array; +} /** QueryVotesRequest is the request type for the Query/Votes RPC method. */ - -export interface QueryVotesRequestSDKType { +export interface QueryVotesRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryVotesRequestAminoMsg { + type: "cosmos-sdk/QueryVotesRequest"; + value: QueryVotesRequestAmino; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestSDKType { + proposal_id: bigint; pagination?: PageRequestSDKType; } /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ - export interface QueryVotesResponse { /** votes defined the queried votes. */ votes: Vote[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryVotesResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse"; + value: Uint8Array; +} /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ - -export interface QueryVotesResponseSDKType { +export interface QueryVotesResponseAmino { /** votes defined the queried votes. */ - votes: VoteSDKType[]; + votes?: VoteAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryVotesResponseAminoMsg { + type: "cosmos-sdk/QueryVotesResponse"; + value: QueryVotesResponseAmino; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseSDKType { + votes: VoteSDKType[]; pagination?: PageResponseSDKType; } /** 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", @@ -151,218 +225,341 @@ export interface QueryParamsRequest { */ paramsType: string; } +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - -export interface QueryParamsRequestSDKType { +export interface QueryParamsRequestAmino { /** * params_type defines which parameters to query for, can be one of "voting", * "tallying" or "deposit". */ + params_type?: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType { params_type: string; } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** voting_params defines the parameters related to voting. */ - votingParams?: VotingParams; + votingParams: VotingParams; /** deposit_params defines the parameters related to deposit. */ - - depositParams?: DepositParams; + depositParams: DepositParams; /** tally_params defines the parameters related to tally. */ - - tallyParams?: TallyParams; + tallyParams: TallyParams; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse"; + value: Uint8Array; } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** voting_params defines the parameters related to voting. */ - voting_params?: VotingParamsSDKType; + voting_params?: VotingParamsAmino; /** deposit_params defines the parameters related to deposit. */ - - deposit_params?: DepositParamsSDKType; + deposit_params?: DepositParamsAmino; /** tally_params defines the parameters related to tally. */ - - tally_params?: TallyParamsSDKType; + tally_params?: TallyParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + voting_params: VotingParamsSDKType; + deposit_params: DepositParamsSDKType; + tally_params: TallyParamsSDKType; } /** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ - export interface QueryDepositRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; /** depositor defines the deposit addresses from the proposals. */ - depositor: string; } +export interface QueryDepositRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest"; + value: Uint8Array; +} /** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ - -export interface QueryDepositRequestSDKType { +export interface QueryDepositRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** depositor defines the deposit addresses from the proposals. */ - + depositor?: string; +} +export interface QueryDepositRequestAminoMsg { + type: "cosmos-sdk/QueryDepositRequest"; + value: QueryDepositRequestAmino; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestSDKType { + proposal_id: bigint; depositor: string; } /** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ - export interface QueryDepositResponse { /** deposit defines the requested deposit. */ - deposit?: Deposit; + deposit: Deposit; +} +export interface QueryDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse"; + value: Uint8Array; } /** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ - -export interface QueryDepositResponseSDKType { +export interface QueryDepositResponseAmino { /** deposit defines the requested deposit. */ - deposit?: DepositSDKType; + deposit?: DepositAmino; +} +export interface QueryDepositResponseAminoMsg { + type: "cosmos-sdk/QueryDepositResponse"; + value: QueryDepositResponseAmino; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseSDKType { + deposit: DepositSDKType; } /** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ - export interface QueryDepositsRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryDepositsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest"; + value: Uint8Array; +} /** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ - -export interface QueryDepositsRequestSDKType { +export interface QueryDepositsRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryDepositsRequestAminoMsg { + type: "cosmos-sdk/QueryDepositsRequest"; + value: QueryDepositsRequestAmino; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestSDKType { + proposal_id: bigint; pagination?: PageRequestSDKType; } /** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ - export interface QueryDepositsResponse { deposits: Deposit[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryDepositsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse"; + value: Uint8Array; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseAmino { + deposits?: DepositAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDepositsResponseAminoMsg { + type: "cosmos-sdk/QueryDepositsResponse"; + value: QueryDepositsResponseAmino; +} /** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ - export interface QueryDepositsResponseSDKType { deposits: DepositSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } /** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ - export interface QueryTallyResultRequest { /** proposal_id defines the unique id of the proposal. */ - proposalId: Long; + proposalId: bigint; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest"; + value: Uint8Array; } /** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ - -export interface QueryTallyResultRequestSDKType { +export interface QueryTallyResultRequestAmino { /** proposal_id defines the unique id of the proposal. */ - proposal_id: Long; + proposal_id?: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestSDKType { + proposal_id: bigint; } /** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ - export interface QueryTallyResultResponse { /** tally defines the requested tally. */ - tally?: TallyResult; + tally: TallyResult; +} +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse"; + value: Uint8Array; } /** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ - -export interface QueryTallyResultResponseSDKType { +export interface QueryTallyResultResponseAmino { /** tally defines the requested tally. */ - tally?: TallyResultSDKType; + tally?: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseSDKType { + tally: TallyResultSDKType; } - function createBaseQueryProposalRequest(): QueryProposalRequest { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const QueryProposalRequest = { - encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", + encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalRequest { + fromPartial(object: Partial): QueryProposalRequest { const message = createBaseQueryProposalRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish() + }; } - }; - function createBaseQueryProposalResponse(): QueryProposalResponse { return { - proposal: undefined + proposal: Proposal.fromPartial({}) }; } - export const QueryProposalResponse = { - encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", + encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.proposal = Proposal.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalResponse { + fromPartial(object: Partial): QueryProposalResponse { const message = createBaseQueryProposalResponse(); message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + return message; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish() + }; } - }; - function createBaseQueryProposalsRequest(): QueryProposalsRequest { return { proposalStatus: 0, @@ -371,744 +568,1111 @@ function createBaseQueryProposalsRequest(): QueryProposalsRequest { pagination: undefined }; } - export const QueryProposalsRequest = { - encode(message: QueryProposalsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", + encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalStatus !== 0) { writer.uint32(8).int32(message.proposalStatus); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - if (message.depositor !== "") { writer.uint32(26).string(message.depositor); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.proposalStatus = (reader.int32() as any); break; - case 2: message.voter = reader.string(); break; - case 3: message.depositor = reader.string(); break; - case 4: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalsRequest { + fromPartial(object: Partial): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); message.proposalStatus = object.proposalStatus ?? 0; message.voter = object.voter ?? ""; message.depositor = object.depositor ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + if (object.proposal_status !== undefined && object.proposal_status !== null) { + message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { + const obj: any = {}; + obj.proposal_status = proposalStatusToJSON(message.proposalStatus); + obj.voter = message.voter; + obj.depositor = message.depositor; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsRequestAminoMsg): QueryProposalsRequest { + return QueryProposalsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsRequest): QueryProposalsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsRequest", + value: QueryProposalsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsRequestProtoMsg): QueryProposalsRequest { + return QueryProposalsRequest.decode(message.value); + }, + toProto(message: QueryProposalsRequest): Uint8Array { + return QueryProposalsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsRequest): QueryProposalsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", + value: QueryProposalsRequest.encode(message).finish() + }; } - }; - function createBaseQueryProposalsResponse(): QueryProposalsResponse { return { proposals: [], pagination: undefined }; } - export const QueryProposalsResponse = { - encode(message: QueryProposalsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", + encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.proposals.push(Proposal.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalsResponse { + fromPartial(object: Partial): QueryProposalsResponse { const message = createBaseQueryProposalsResponse(); message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryProposalsResponseAmino): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsResponse): QueryProposalsResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsResponseAminoMsg): QueryProposalsResponse { + return QueryProposalsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsResponse): QueryProposalsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsResponse", + value: QueryProposalsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsResponseProtoMsg): QueryProposalsResponse { + return QueryProposalsResponse.decode(message.value); + }, + toProto(message: QueryProposalsResponse): Uint8Array { + return QueryProposalsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsResponse): QueryProposalsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", + value: QueryProposalsResponse.encode(message).finish() + }; } - }; - function createBaseQueryVoteRequest(): QueryVoteRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "" }; } - export const QueryVoteRequest = { - encode(message: QueryVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", + encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVoteRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVoteRequest { + fromPartial(object: Partial): QueryVoteRequest { const message = createBaseQueryVoteRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; return message; + }, + fromAmino(object: QueryVoteRequestAmino): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + return message; + }, + toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { + return QueryVoteRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteRequest): QueryVoteRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVoteRequest", + value: QueryVoteRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteRequestProtoMsg): QueryVoteRequest { + return QueryVoteRequest.decode(message.value); + }, + toProto(message: QueryVoteRequest): Uint8Array { + return QueryVoteRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteRequest): QueryVoteRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", + value: QueryVoteRequest.encode(message).finish() + }; } - }; - function createBaseQueryVoteResponse(): QueryVoteResponse { return { - vote: undefined + vote: Vote.fromPartial({}) }; } - export const QueryVoteResponse = { - encode(message: QueryVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", + encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.vote = Vote.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVoteResponse { + fromPartial(object: Partial): QueryVoteResponse { const message = createBaseQueryVoteResponse(); message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; return message; + }, + fromAmino(object: QueryVoteResponseAmino): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + return message; + }, + toAmino(message: QueryVoteResponse): QueryVoteResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVoteResponseAminoMsg): QueryVoteResponse { + return QueryVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteResponse): QueryVoteResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVoteResponse", + value: QueryVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteResponseProtoMsg): QueryVoteResponse { + return QueryVoteResponse.decode(message.value); + }, + toProto(message: QueryVoteResponse): Uint8Array { + return QueryVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteResponse): QueryVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", + value: QueryVoteResponse.encode(message).finish() + }; } - }; - function createBaseQueryVotesRequest(): QueryVotesRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), pagination: undefined }; } - export const QueryVotesRequest = { - encode(message: QueryVotesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", + encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVotesRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVotesRequest { + fromPartial(object: Partial): QueryVotesRequest { const message = createBaseQueryVotesRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryVotesRequestAmino): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesRequestAminoMsg): QueryVotesRequest { + return QueryVotesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesRequest): QueryVotesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVotesRequest", + value: QueryVotesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesRequestProtoMsg): QueryVotesRequest { + return QueryVotesRequest.decode(message.value); + }, + toProto(message: QueryVotesRequest): Uint8Array { + return QueryVotesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesRequest): QueryVotesRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", + value: QueryVotesRequest.encode(message).finish() + }; } - }; - function createBaseQueryVotesResponse(): QueryVotesResponse { return { votes: [], pagination: undefined }; } - export const QueryVotesResponse = { - encode(message: QueryVotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", + encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVotesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.votes.push(Vote.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVotesResponse { + fromPartial(object: Partial): QueryVotesResponse { const message = createBaseQueryVotesResponse(); message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryVotesResponseAmino): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesResponse): QueryVotesResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesResponseAminoMsg): QueryVotesResponse { + return QueryVotesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesResponse): QueryVotesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVotesResponse", + value: QueryVotesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesResponseProtoMsg): QueryVotesResponse { + return QueryVotesResponse.decode(message.value); + }, + toProto(message: QueryVotesResponse): Uint8Array { + return QueryVotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesResponse): QueryVotesResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", + value: QueryVotesResponse.encode(message).finish() + }; } - }; - function createBaseQueryParamsRequest(): QueryParamsRequest { return { paramsType: "" }; } - export const QueryParamsRequest = { - encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", + encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.paramsType !== "") { writer.uint32(10).string(message.paramsType); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.paramsType = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsRequest { + fromPartial(object: Partial): QueryParamsRequest { const message = createBaseQueryParamsRequest(); message.paramsType = object.paramsType ?? ""; return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + if (object.params_type !== undefined && object.params_type !== null) { + message.paramsType = object.params_type; + } + return message; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.params_type = message.paramsType; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - votingParams: undefined, - depositParams: undefined, - tallyParams: undefined + votingParams: VotingParams.fromPartial({}), + depositParams: DepositParams.fromPartial({}), + tallyParams: TallyParams.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingParams !== undefined) { VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); } - if (message.depositParams !== undefined) { DepositParams.encode(message.depositParams, writer.uint32(18).fork()).ldelim(); } - if (message.tallyParams !== undefined) { TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.votingParams = VotingParams.decode(reader, reader.uint32()); break; - case 2: message.depositParams = DepositParams.decode(reader, reader.uint32()); break; - case 3: message.tallyParams = TallyParams.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDepositRequest(): QueryDepositRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), depositor: "" }; } - export const QueryDepositRequest = { - encode(message: QueryDepositRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", + encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.depositor !== "") { writer.uint32(18).string(message.depositor); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDepositRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.depositor = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDepositRequest { + fromPartial(object: Partial): QueryDepositRequest { const message = createBaseQueryDepositRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.depositor = object.depositor ?? ""; return message; + }, + fromAmino(object: QueryDepositRequestAmino): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + return message; + }, + toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor; + return obj; + }, + fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { + return QueryDepositRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositRequest): QueryDepositRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDepositRequest", + value: QueryDepositRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositRequestProtoMsg): QueryDepositRequest { + return QueryDepositRequest.decode(message.value); + }, + toProto(message: QueryDepositRequest): Uint8Array { + return QueryDepositRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositRequest): QueryDepositRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", + value: QueryDepositRequest.encode(message).finish() + }; } - }; - function createBaseQueryDepositResponse(): QueryDepositResponse { return { - deposit: undefined + deposit: Deposit.fromPartial({}) }; } - export const QueryDepositResponse = { - encode(message: QueryDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", + encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deposit !== undefined) { Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDepositResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.deposit = Deposit.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDepositResponse { + fromPartial(object: Partial): QueryDepositResponse { const message = createBaseQueryDepositResponse(); message.deposit = object.deposit !== undefined && object.deposit !== null ? Deposit.fromPartial(object.deposit) : undefined; return message; + }, + fromAmino(object: QueryDepositResponseAmino): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + if (object.deposit !== undefined && object.deposit !== null) { + message.deposit = Deposit.fromAmino(object.deposit); + } + return message; + }, + toAmino(message: QueryDepositResponse): QueryDepositResponseAmino { + const obj: any = {}; + obj.deposit = message.deposit ? Deposit.toAmino(message.deposit) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositResponseAminoMsg): QueryDepositResponse { + return QueryDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositResponse): QueryDepositResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDepositResponse", + value: QueryDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositResponseProtoMsg): QueryDepositResponse { + return QueryDepositResponse.decode(message.value); + }, + toProto(message: QueryDepositResponse): Uint8Array { + return QueryDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositResponse): QueryDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", + value: QueryDepositResponse.encode(message).finish() + }; } - }; - function createBaseQueryDepositsRequest(): QueryDepositsRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), pagination: undefined }; } - export const QueryDepositsRequest = { - encode(message: QueryDepositsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", + encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDepositsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDepositsRequest { + fromPartial(object: Partial): QueryDepositsRequest { const message = createBaseQueryDepositsRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDepositsRequestAmino): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsRequestAminoMsg): QueryDepositsRequest { + return QueryDepositsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsRequest): QueryDepositsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDepositsRequest", + value: QueryDepositsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsRequestProtoMsg): QueryDepositsRequest { + return QueryDepositsRequest.decode(message.value); + }, + toProto(message: QueryDepositsRequest): Uint8Array { + return QueryDepositsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsRequest): QueryDepositsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", + value: QueryDepositsRequest.encode(message).finish() + }; } - }; - function createBaseQueryDepositsResponse(): QueryDepositsResponse { return { deposits: [], pagination: undefined }; } - export const QueryDepositsResponse = { - encode(message: QueryDepositsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", + encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deposits) { Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDepositsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.deposits.push(Deposit.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDepositsResponse { + fromPartial(object: Partial): QueryDepositsResponse { const message = createBaseQueryDepositsResponse(); message.deposits = object.deposits?.map(e => Deposit.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDepositsResponseAmino): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsResponse): QueryDepositsResponseAmino { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsResponseAminoMsg): QueryDepositsResponse { + return QueryDepositsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsResponse): QueryDepositsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDepositsResponse", + value: QueryDepositsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsResponseProtoMsg): QueryDepositsResponse { + return QueryDepositsResponse.decode(message.value); + }, + toProto(message: QueryDepositsResponse): Uint8Array { + return QueryDepositsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsResponse): QueryDepositsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", + value: QueryDepositsResponse.encode(message).finish() + }; } - }; - function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const QueryTallyResultRequest = { - encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", + encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTallyResultRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryTallyResultRequest { + fromPartial(object: Partial): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { const message = createBaseQueryTallyResultRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } return message; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultRequestProtoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish() + }; } - }; - function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { - tally: undefined + tally: TallyResult.fromPartial({}) }; } - export const QueryTallyResultResponse = { - encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", + encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTallyResultResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.tally = TallyResult.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryTallyResultResponse { + fromPartial(object: Partial): QueryTallyResultResponse { const message = createBaseQueryTallyResultResponse(); message.tally = object.tally !== undefined && object.tally !== null ? TallyResult.fromPartial(object.tally) : undefined; return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + if (object.tally !== undefined && object.tally !== null) { + message.tally = TallyResult.fromAmino(object.tally); + } + return message; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultResponseProtoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/tx.amino.ts b/src/codegen/cosmos/gov/v1beta1/tx.amino.ts index bdf2845..1d61890 100644 --- a/src/codegen/cosmos/gov/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/gov/v1beta1/tx.amino.ts @@ -1,174 +1,23 @@ -import { voteOptionFromJSON } from "./gov"; -import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; -export interface AminoMsgSubmitProposal extends AminoMsg { - type: "cosmos-sdk/MsgSubmitProposal"; - value: { - content: { - type_url: string; - value: Uint8Array; - }; - initial_deposit: { - denom: string; - amount: string; - }[]; - proposer: string; - }; -} -export interface AminoMsgVote extends AminoMsg { - type: "cosmos-sdk/MsgVote"; - value: { - proposal_id: string; - voter: string; - option: number; - }; -} -export interface AminoMsgVoteWeighted extends AminoMsg { - type: "cosmos-sdk/MsgVoteWeighted"; - value: { - proposal_id: string; - voter: string; - options: { - option: number; - weight: string; - }[]; - }; -} -export interface AminoMsgDeposit extends AminoMsg { - type: "cosmos-sdk/MsgDeposit"; - value: { - proposal_id: string; - depositor: string; - amount: { - denom: string; - amount: string; - }[]; - }; -} export const AminoConverter = { "/cosmos.gov.v1beta1.MsgSubmitProposal": { aminoType: "cosmos-sdk/MsgSubmitProposal", - toAmino: ({ - content, - initialDeposit, - proposer - }: MsgSubmitProposal): AminoMsgSubmitProposal["value"] => { - return { - content: { - type_url: content.typeUrl, - value: content.value - }, - initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })), - proposer - }; - }, - fromAmino: ({ - content, - initial_deposit, - proposer - }: AminoMsgSubmitProposal["value"]): MsgSubmitProposal => { - return { - content: { - typeUrl: content.type_url, - value: content.value - }, - initialDeposit: initial_deposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })), - proposer - }; - } + toAmino: MsgSubmitProposal.toAmino, + fromAmino: MsgSubmitProposal.fromAmino }, "/cosmos.gov.v1beta1.MsgVote": { aminoType: "cosmos-sdk/MsgVote", - toAmino: ({ - proposalId, - voter, - option - }: MsgVote): AminoMsgVote["value"] => { - return { - proposal_id: proposalId.toString(), - voter, - option - }; - }, - fromAmino: ({ - proposal_id, - voter, - option - }: AminoMsgVote["value"]): MsgVote => { - return { - proposalId: Long.fromString(proposal_id), - voter, - option: voteOptionFromJSON(option) - }; - } + toAmino: MsgVote.toAmino, + fromAmino: MsgVote.fromAmino }, "/cosmos.gov.v1beta1.MsgVoteWeighted": { aminoType: "cosmos-sdk/MsgVoteWeighted", - toAmino: ({ - proposalId, - voter, - options - }: MsgVoteWeighted): AminoMsgVoteWeighted["value"] => { - return { - proposal_id: proposalId.toString(), - voter, - options: options.map(el0 => ({ - option: el0.option, - weight: el0.weight - })) - }; - }, - fromAmino: ({ - proposal_id, - voter, - options - }: AminoMsgVoteWeighted["value"]): MsgVoteWeighted => { - return { - proposalId: Long.fromString(proposal_id), - voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), - weight: el0.weight - })) - }; - } + toAmino: MsgVoteWeighted.toAmino, + fromAmino: MsgVoteWeighted.fromAmino }, "/cosmos.gov.v1beta1.MsgDeposit": { aminoType: "cosmos-sdk/MsgDeposit", - toAmino: ({ - proposalId, - depositor, - amount - }: MsgDeposit): AminoMsgDeposit["value"] => { - return { - proposal_id: proposalId.toString(), - depositor, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })) - }; - }, - fromAmino: ({ - proposal_id, - depositor, - amount - }: AminoMsgDeposit["value"]): MsgDeposit => { - return { - proposalId: Long.fromString(proposal_id), - depositor, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })) - }; - } + toAmino: MsgDeposit.toAmino, + fromAmino: MsgDeposit.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/tx.registry.ts b/src/codegen/cosmos/gov/v1beta1/tx.registry.ts index 192c5e7..fbcb08a 100644 --- a/src/codegen/cosmos/gov/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/gov/v1beta1/tx.registry.ts @@ -14,28 +14,24 @@ export const MessageComposer = { value: MsgSubmitProposal.encode(value).finish() }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.encode(value).finish() }; }, - voteWeighted(value: MsgVoteWeighted) { return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value: MsgVoteWeighted.encode(value).finish() }; }, - deposit(value: MsgDeposit) { return { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.encode(value).finish() }; } - }, withTypeUrl: { submitProposal(value: MsgSubmitProposal) { @@ -44,28 +40,24 @@ export const MessageComposer = { value }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value }; }, - voteWeighted(value: MsgVoteWeighted) { return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value }; }, - deposit(value: MsgDeposit) { return { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value }; } - }, fromPartial: { submitProposal(value: MsgSubmitProposal) { @@ -74,27 +66,23 @@ export const MessageComposer = { value: MsgSubmitProposal.fromPartial(value) }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.fromPartial(value) }; }, - voteWeighted(value: MsgVoteWeighted) { return { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial(value) }; }, - deposit(value: MsgDeposit) { return { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/gov/v1beta1/tx.rpc.msg.ts index 4e4cc25..9298288 100644 --- a/src/codegen/cosmos/gov/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -1,28 +1,23 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalResponse, MsgVote, MsgVoteResponse, MsgVoteWeighted, MsgVoteWeightedResponse, MsgDeposit, MsgDepositResponse } from "./tx"; /** Msg defines the bank Msg service. */ - export interface Msg { /** SubmitProposal defines a method to create new proposal given a content. */ submitProposal(request: MsgSubmitProposal): Promise; /** Vote defines a method to add a vote on a specific proposal. */ - vote(request: MsgVote): Promise; /** * VoteWeighted defines a method to add a weighted vote on a specific proposal. * * Since: cosmos-sdk 0.43 */ - voteWeighted(request: MsgVoteWeighted): Promise; /** Deposit defines a method to add deposit on a specific proposal. */ - deposit(request: MsgDeposit): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.submitProposal = this.submitProposal.bind(this); @@ -30,29 +25,24 @@ export class MsgClientImpl implements Msg { 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("cosmos.gov.v1beta1.Msg", "SubmitProposal", data); - return promise.then(data => MsgSubmitProposalResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Msg", "Vote", data); - return promise.then(data => MsgVoteResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgVoteResponse.decode(new BinaryReader(data))); } - voteWeighted(request: MsgVoteWeighted): Promise { const data = MsgVoteWeighted.encode(request).finish(); const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "VoteWeighted", data); - return promise.then(data => MsgVoteWeightedResponse.decode(new _m0.Reader(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("cosmos.gov.v1beta1.Msg", "Deposit", data); - return promise.then(data => MsgDepositResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/gov/v1beta1/tx.ts b/src/codegen/cosmos/gov/v1beta1/tx.ts index 6186924..dd4806f 100644 --- a/src/codegen/cosmos/gov/v1beta1/tx.ts +++ b/src/codegen/cosmos/gov/v1beta1/tx.ts @@ -1,77 +1,137 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary * proposal Content. */ - export interface MsgSubmitProposal { content?: Any; initialDeposit: Coin[]; proposer: string; } +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal"; + value: Uint8Array; +} +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalAmino { + content?: AnyAmino; + initial_deposit?: CoinAmino[]; + proposer?: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary * proposal Content. */ - export interface MsgSubmitProposalSDKType { content?: AnySDKType; initial_deposit: CoinSDKType[]; proposer: string; } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ - export interface MsgSubmitProposalResponse { - proposalId: Long; + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + proposal_id?: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ - export interface MsgSubmitProposalResponseSDKType { - proposal_id: Long; + proposal_id: bigint; } /** MsgVote defines a message to cast a vote. */ - export interface MsgVote { - proposalId: Long; + proposalId: bigint; voter: string; option: VoteOption; } +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVote"; + value: Uint8Array; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteAmino { + proposal_id?: string; + voter?: string; + option?: VoteOption; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/MsgVote"; + value: MsgVoteAmino; +} /** MsgVote defines a message to cast a vote. */ - export interface MsgVoteSDKType { - proposal_id: Long; + proposal_id: bigint; voter: string; - option: VoteOptionSDKType; + option: VoteOption; } /** MsgVoteResponse defines the Msg/Vote response type. */ - export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} /** MsgVoteResponse defines the Msg/Vote response type. */ - export interface MsgVoteResponseSDKType {} /** * MsgVoteWeighted defines a message to cast a vote. * * Since: cosmos-sdk 0.43 */ - export interface MsgVoteWeighted { - proposalId: Long; + proposalId: bigint; voter: string; options: WeightedVoteOption[]; } +export interface MsgVoteWeightedProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted"; + value: Uint8Array; +} +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedAmino { + proposal_id?: string; + voter?: string; + options?: WeightedVoteOptionAmino[]; +} +export interface MsgVoteWeightedAminoMsg { + type: "cosmos-sdk/MsgVoteWeighted"; + value: MsgVoteWeightedAmino; +} /** * MsgVoteWeighted defines a message to cast a vote. * * Since: cosmos-sdk 0.43 */ - export interface MsgVoteWeightedSDKType { - proposal_id: Long; + proposal_id: bigint; voter: string; options: WeightedVoteOptionSDKType[]; } @@ -80,36 +140,67 @@ export interface MsgVoteWeightedSDKType { * * Since: cosmos-sdk 0.43 */ - export interface MsgVoteWeightedResponse {} +export interface MsgVoteWeightedResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse"; + value: Uint8Array; +} +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponseAmino {} +export interface MsgVoteWeightedResponseAminoMsg { + type: "cosmos-sdk/MsgVoteWeightedResponse"; + value: MsgVoteWeightedResponseAmino; +} /** * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. * * Since: cosmos-sdk 0.43 */ - export interface MsgVoteWeightedResponseSDKType {} /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ - export interface MsgDeposit { - proposalId: Long; + proposalId: bigint; depositor: string; amount: Coin[]; } +export interface MsgDepositProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit"; + value: Uint8Array; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositAmino { + proposal_id?: string; + depositor?: string; + amount?: CoinAmino[]; +} +export interface MsgDepositAminoMsg { + type: "cosmos-sdk/MsgDeposit"; + value: MsgDepositAmino; +} /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ - export interface MsgDepositSDKType { - proposal_id: Long; + proposal_id: bigint; depositor: string; amount: CoinSDKType[]; } /** MsgDepositResponse defines the Msg/Deposit response type. */ - export interface MsgDepositResponse {} +export interface MsgDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse"; + value: Uint8Array; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseAmino {} +export interface MsgDepositResponseAminoMsg { + type: "cosmos-sdk/MsgDepositResponse"; + value: MsgDepositResponseAmino; +} /** MsgDepositResponse defines the Msg/Deposit response type. */ - export interface MsgDepositResponseSDKType {} - function createBaseMsgSubmitProposal(): MsgSubmitProposal { return { content: undefined, @@ -117,402 +208,611 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { proposer: "" }; } - export const MsgSubmitProposal = { - encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.content !== undefined) { Any.encode(message.content, writer.uint32(10).fork()).ldelim(); } - for (const v of message.initialDeposit) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.proposer !== "") { writer.uint32(26).string(message.proposer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.content = Any.decode(reader, reader.uint32()); break; - case 2: message.initialDeposit.push(Coin.decode(reader, reader.uint32())); break; - case 3: message.proposer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitProposal { + fromPartial(object: Partial): 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; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + if (object.content !== undefined && object.content !== null) { + message.content = Any.fromAmino(object.content); + } + message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + obj.content = message.content ? Any.toAmino(message.content) : undefined; + if (message.initialDeposit) { + obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.initial_deposit = []; + } + obj.proposer = message.proposer; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; } - }; - function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const MsgSubmitProposalResponse = { - encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitProposalResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + fromPartial(object: Partial): MsgSubmitProposalResponse { const message = createBaseMsgSubmitProposalResponse(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; } - }; - function createBaseMsgVote(): MsgVote { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "", option: 0 }; } - export const MsgVote = { - encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - if (message.option !== 0) { writer.uint32(24).int32(message.option); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - case 3: message.option = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgVote { + fromPartial(object: Partial): MsgVote { const message = createBaseMsgVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.option = object.option ?? 0; return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = voteOptionFromJSON(object.option); + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + obj.option = voteOptionToJSON(message.option); + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.encode(message).finish() + }; } - }; - function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; } - export const MsgVoteResponse = { - encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgVoteResponse { + fromPartial(_: Partial): MsgVoteResponse { const message = createBaseMsgVoteResponse(); return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; } - }; - function createBaseMsgVoteWeighted(): MsgVoteWeighted { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "", options: [] }; } - export const MsgVoteWeighted = { - encode(message: MsgVoteWeighted, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - for (const v of message.options) { WeightedVoteOption.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVoteWeighted(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - case 3: message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgVoteWeighted { + fromPartial(object: Partial): MsgVoteWeighted { const message = createBaseMsgVoteWeighted(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = []; + } + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { + return MsgVoteWeighted.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeighted): MsgVoteWeightedAminoMsg { + return { + type: "cosmos-sdk/MsgVoteWeighted", + value: MsgVoteWeighted.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedProtoMsg): MsgVoteWeighted { + return MsgVoteWeighted.decode(message.value); + }, + toProto(message: MsgVoteWeighted): Uint8Array { + return MsgVoteWeighted.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeighted): MsgVoteWeightedProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(message).finish() + }; } - }; - function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { return {}; } - export const MsgVoteWeightedResponse = { - encode(_: MsgVoteWeightedResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeightedResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVoteWeightedResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgVoteWeightedResponse { + fromPartial(_: Partial): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + fromAmino(_: MsgVoteWeightedResponseAmino): MsgVoteWeightedResponse { const message = createBaseMsgVoteWeightedResponse(); return message; + }, + toAmino(_: MsgVoteWeightedResponse): MsgVoteWeightedResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedResponseAminoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedResponseProtoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.decode(message.value); + }, + toProto(message: MsgVoteWeightedResponse): Uint8Array { + return MsgVoteWeightedResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.encode(message).finish() + }; } - }; - function createBaseMsgDeposit(): MsgDeposit { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), depositor: "", amount: [] }; } - export const MsgDeposit = { - encode(message: MsgDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.depositor !== "") { writer.uint32(18).string(message.depositor); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDeposit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.depositor = reader.string(); break; - case 3: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgDeposit { + fromPartial(object: Partial): MsgDeposit { const message = createBaseMsgDeposit(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.depositor = object.depositor ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgDepositAmino): MsgDeposit { + const message = createBaseMsgDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgDeposit): MsgDepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgDepositAminoMsg): MsgDeposit { + return MsgDeposit.fromAmino(object.value); + }, + toAminoMsg(message: MsgDeposit): MsgDepositAminoMsg { + return { + type: "cosmos-sdk/MsgDeposit", + value: MsgDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositProtoMsg): MsgDeposit { + return MsgDeposit.decode(message.value); + }, + toProto(message: MsgDeposit): Uint8Array { + return MsgDeposit.encode(message).finish(); + }, + toProtoMsg(message: MsgDeposit): MsgDepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.encode(message).finish() + }; } - }; - function createBaseMsgDepositResponse(): MsgDepositResponse { return {}; } - export const MsgDepositResponse = { - encode(_: MsgDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", + encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDepositResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgDepositResponse { + fromPartial(_: Partial): MsgDepositResponse { const message = createBaseMsgDepositResponse(); return message; + }, + fromAmino(_: MsgDepositResponseAmino): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + toAmino(_: MsgDepositResponse): MsgDepositResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositResponseAminoMsg): MsgDepositResponse { + return MsgDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositResponse): MsgDepositResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDepositResponse", + value: MsgDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositResponseProtoMsg): MsgDepositResponse { + return MsgDepositResponse.decode(message.value); + }, + toProto(message: MsgDepositResponse): Uint8Array { + return MsgDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositResponse): MsgDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", + value: MsgDepositResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/events.ts b/src/codegen/cosmos/group/v1/events.ts index 5d7944b..4889d94 100644 --- a/src/codegen/cosmos/group/v1/events.ts +++ b/src/codegen/cosmos/group/v1/events.ts @@ -1,548 +1,855 @@ -import { ProposalExecutorResult, ProposalExecutorResultSDKType } from "./types"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { ProposalExecutorResult, proposalExecutorResultFromJSON, proposalExecutorResultToJSON } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** EventCreateGroup is an event emitted when a group is created. */ - export interface EventCreateGroup { /** group_id is the unique ID of the group. */ - groupId: Long; + groupId: bigint; +} +export interface EventCreateGroupProtoMsg { + typeUrl: "/cosmos.group.v1.EventCreateGroup"; + value: Uint8Array; } /** EventCreateGroup is an event emitted when a group is created. */ - -export interface EventCreateGroupSDKType { +export interface EventCreateGroupAmino { /** group_id is the unique ID of the group. */ - group_id: Long; + group_id?: string; +} +export interface EventCreateGroupAminoMsg { + type: "cosmos-sdk/EventCreateGroup"; + value: EventCreateGroupAmino; +} +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroupSDKType { + group_id: bigint; } /** EventUpdateGroup is an event emitted when a group is updated. */ - export interface EventUpdateGroup { /** group_id is the unique ID of the group. */ - groupId: Long; + groupId: bigint; +} +export interface EventUpdateGroupProtoMsg { + typeUrl: "/cosmos.group.v1.EventUpdateGroup"; + value: Uint8Array; } /** EventUpdateGroup is an event emitted when a group is updated. */ - -export interface EventUpdateGroupSDKType { +export interface EventUpdateGroupAmino { /** group_id is the unique ID of the group. */ - group_id: Long; + group_id?: string; +} +export interface EventUpdateGroupAminoMsg { + type: "cosmos-sdk/EventUpdateGroup"; + value: EventUpdateGroupAmino; +} +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroupSDKType { + group_id: bigint; } /** 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; } +export interface EventCreateGroupPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy"; + value: Uint8Array; +} /** EventCreateGroupPolicy is an event emitted when a group policy is created. */ - -export interface EventCreateGroupPolicySDKType { +export interface EventCreateGroupPolicyAmino { /** address is the account address of the group policy. */ + address?: string; +} +export interface EventCreateGroupPolicyAminoMsg { + type: "cosmos-sdk/EventCreateGroupPolicy"; + value: EventCreateGroupPolicyAmino; +} +/** EventCreateGroupPolicy is an event emitted when a group policy is created. */ +export interface EventCreateGroupPolicySDKType { 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; } +export interface EventUpdateGroupPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy"; + value: Uint8Array; +} /** EventUpdateGroupPolicy is an event emitted when a group policy is updated. */ - -export interface EventUpdateGroupPolicySDKType { +export interface EventUpdateGroupPolicyAmino { /** address is the account address of the group policy. */ + address?: string; +} +export interface EventUpdateGroupPolicyAminoMsg { + type: "cosmos-sdk/EventUpdateGroupPolicy"; + value: EventUpdateGroupPolicyAmino; +} +/** EventUpdateGroupPolicy is an event emitted when a group policy is updated. */ +export interface EventUpdateGroupPolicySDKType { 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: Long; + proposalId: bigint; +} +export interface EventSubmitProposalProtoMsg { + typeUrl: "/cosmos.group.v1.EventSubmitProposal"; + value: Uint8Array; } /** EventSubmitProposal is an event emitted when a proposal is created. */ - -export interface EventSubmitProposalSDKType { +export interface EventSubmitProposalAmino { /** proposal_id is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id?: string; +} +export interface EventSubmitProposalAminoMsg { + type: "cosmos-sdk/EventSubmitProposal"; + value: EventSubmitProposalAmino; +} +/** EventSubmitProposal is an event emitted when a proposal is created. */ +export interface EventSubmitProposalSDKType { + proposal_id: bigint; } /** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ - export interface EventWithdrawProposal { /** proposal_id is the unique ID of the proposal. */ - proposalId: Long; + proposalId: bigint; +} +export interface EventWithdrawProposalProtoMsg { + typeUrl: "/cosmos.group.v1.EventWithdrawProposal"; + value: Uint8Array; } /** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ - -export interface EventWithdrawProposalSDKType { +export interface EventWithdrawProposalAmino { /** proposal_id is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id?: string; +} +export interface EventWithdrawProposalAminoMsg { + type: "cosmos-sdk/EventWithdrawProposal"; + value: EventWithdrawProposalAmino; +} +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposalSDKType { + proposal_id: bigint; } /** 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: Long; + proposalId: bigint; +} +export interface EventVoteProtoMsg { + typeUrl: "/cosmos.group.v1.EventVote"; + value: Uint8Array; +} +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVoteAmino { + /** proposal_id is the unique ID of the proposal. */ + proposal_id?: string; +} +export interface EventVoteAminoMsg { + type: "cosmos-sdk/EventVote"; + value: EventVoteAmino; } /** EventVote is an event emitted when a voter votes on a proposal. */ - export interface EventVoteSDKType { - /** proposal_id is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id: bigint; } /** EventExec is an event emitted when a proposal is executed. */ - export interface EventExec { /** proposal_id is the unique ID of the proposal. */ - proposalId: Long; + proposalId: bigint; /** result is the proposal execution result. */ - result: ProposalExecutorResult; } +export interface EventExecProtoMsg { + typeUrl: "/cosmos.group.v1.EventExec"; + value: Uint8Array; +} /** EventExec is an event emitted when a proposal is executed. */ - -export interface EventExecSDKType { +export interface EventExecAmino { /** proposal_id is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** result is the proposal execution result. */ - - result: ProposalExecutorResultSDKType; + result?: ProposalExecutorResult; +} +export interface EventExecAminoMsg { + type: "cosmos-sdk/EventExec"; + value: EventExecAmino; +} +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExecSDKType { + proposal_id: bigint; + result: ProposalExecutorResult; } /** EventLeaveGroup is an event emitted when group member leaves the group. */ - export interface EventLeaveGroup { /** group_id is the unique ID of the group. */ - groupId: Long; + groupId: bigint; /** address is the account address of the group member. */ - address: string; } +export interface EventLeaveGroupProtoMsg { + typeUrl: "/cosmos.group.v1.EventLeaveGroup"; + value: Uint8Array; +} /** EventLeaveGroup is an event emitted when group member leaves the group. */ - -export interface EventLeaveGroupSDKType { +export interface EventLeaveGroupAmino { /** group_id is the unique ID of the group. */ - group_id: Long; + group_id?: string; /** address is the account address of the group member. */ - + address?: string; +} +export interface EventLeaveGroupAminoMsg { + type: "cosmos-sdk/EventLeaveGroup"; + value: EventLeaveGroupAmino; +} +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroupSDKType { + group_id: bigint; address: string; } - function createBaseEventCreateGroup(): EventCreateGroup { return { - groupId: Long.UZERO + groupId: BigInt(0) }; } - export const EventCreateGroup = { - encode(message: EventCreateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.EventCreateGroup", + encode(message: EventCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateGroup { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventCreateGroup { + fromPartial(object: Partial): EventCreateGroup { const message = createBaseEventCreateGroup(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); return message; + }, + fromAmino(object: EventCreateGroupAmino): EventCreateGroup { + const message = createBaseEventCreateGroup(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: EventCreateGroup): EventCreateGroupAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { + return EventCreateGroup.fromAmino(object.value); + }, + toAminoMsg(message: EventCreateGroup): EventCreateGroupAminoMsg { + return { + type: "cosmos-sdk/EventCreateGroup", + value: EventCreateGroup.toAmino(message) + }; + }, + fromProtoMsg(message: EventCreateGroupProtoMsg): EventCreateGroup { + return EventCreateGroup.decode(message.value); + }, + toProto(message: EventCreateGroup): Uint8Array { + return EventCreateGroup.encode(message).finish(); + }, + toProtoMsg(message: EventCreateGroup): EventCreateGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventCreateGroup", + value: EventCreateGroup.encode(message).finish() + }; } - }; - function createBaseEventUpdateGroup(): EventUpdateGroup { return { - groupId: Long.UZERO + groupId: BigInt(0) }; } - export const EventUpdateGroup = { - encode(message: EventUpdateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.EventUpdateGroup", + encode(message: EventUpdateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateGroup { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventUpdateGroup { + fromPartial(object: Partial): EventUpdateGroup { const message = createBaseEventUpdateGroup(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); return message; + }, + fromAmino(object: EventUpdateGroupAmino): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { + return EventUpdateGroup.fromAmino(object.value); + }, + toAminoMsg(message: EventUpdateGroup): EventUpdateGroupAminoMsg { + return { + type: "cosmos-sdk/EventUpdateGroup", + value: EventUpdateGroup.toAmino(message) + }; + }, + fromProtoMsg(message: EventUpdateGroupProtoMsg): EventUpdateGroup { + return EventUpdateGroup.decode(message.value); + }, + toProto(message: EventUpdateGroup): Uint8Array { + return EventUpdateGroup.encode(message).finish(); + }, + toProtoMsg(message: EventUpdateGroup): EventUpdateGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventUpdateGroup", + value: EventUpdateGroup.encode(message).finish() + }; } - }; - function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { return { address: "" }; } - export const EventCreateGroupPolicy = { - encode(message: EventCreateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", + encode(message: EventCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateGroupPolicy { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventCreateGroupPolicy { + fromPartial(object: Partial): EventCreateGroupPolicy { const message = createBaseEventCreateGroupPolicy(); message.address = object.address ?? ""; return message; + }, + fromAmino(object: EventCreateGroupPolicyAmino): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { + return EventCreateGroupPolicy.fromAmino(object.value); + }, + toAminoMsg(message: EventCreateGroupPolicy): EventCreateGroupPolicyAminoMsg { + return { + type: "cosmos-sdk/EventCreateGroupPolicy", + value: EventCreateGroupPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: EventCreateGroupPolicyProtoMsg): EventCreateGroupPolicy { + return EventCreateGroupPolicy.decode(message.value); + }, + toProto(message: EventCreateGroupPolicy): Uint8Array { + return EventCreateGroupPolicy.encode(message).finish(); + }, + toProtoMsg(message: EventCreateGroupPolicy): EventCreateGroupPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", + value: EventCreateGroupPolicy.encode(message).finish() + }; } - }; - function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { return { address: "" }; } - export const EventUpdateGroupPolicy = { - encode(message: EventUpdateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", + encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateGroupPolicy { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventUpdateGroupPolicy { + fromPartial(object: Partial): EventUpdateGroupPolicy { const message = createBaseEventUpdateGroupPolicy(); message.address = object.address ?? ""; return message; + }, + fromAmino(object: EventUpdateGroupPolicyAmino): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.fromAmino(object.value); + }, + toAminoMsg(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAminoMsg { + return { + type: "cosmos-sdk/EventUpdateGroupPolicy", + value: EventUpdateGroupPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: EventUpdateGroupPolicyProtoMsg): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.decode(message.value); + }, + toProto(message: EventUpdateGroupPolicy): Uint8Array { + return EventUpdateGroupPolicy.encode(message).finish(); + }, + toProtoMsg(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", + value: EventUpdateGroupPolicy.encode(message).finish() + }; } - }; - function createBaseEventSubmitProposal(): EventSubmitProposal { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const EventSubmitProposal = { - encode(message: EventSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.EventSubmitProposal", + encode(message: EventSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventSubmitProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventSubmitProposal { + fromPartial(object: Partial): EventSubmitProposal { const message = createBaseEventSubmitProposal(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; + }, + fromAmino(object: EventSubmitProposalAmino): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { + return EventSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: EventSubmitProposal): EventSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/EventSubmitProposal", + value: EventSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: EventSubmitProposalProtoMsg): EventSubmitProposal { + return EventSubmitProposal.decode(message.value); + }, + toProto(message: EventSubmitProposal): Uint8Array { + return EventSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: EventSubmitProposal): EventSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventSubmitProposal", + value: EventSubmitProposal.encode(message).finish() + }; } - }; - function createBaseEventWithdrawProposal(): EventWithdrawProposal { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const EventWithdrawProposal = { - encode(message: EventWithdrawProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.EventWithdrawProposal", + encode(message: EventWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventWithdrawProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventWithdrawProposal { + fromPartial(object: Partial): EventWithdrawProposal { const message = createBaseEventWithdrawProposal(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; + }, + fromAmino(object: EventWithdrawProposalAmino): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { + return EventWithdrawProposal.fromAmino(object.value); + }, + toAminoMsg(message: EventWithdrawProposal): EventWithdrawProposalAminoMsg { + return { + type: "cosmos-sdk/EventWithdrawProposal", + value: EventWithdrawProposal.toAmino(message) + }; + }, + fromProtoMsg(message: EventWithdrawProposalProtoMsg): EventWithdrawProposal { + return EventWithdrawProposal.decode(message.value); + }, + toProto(message: EventWithdrawProposal): Uint8Array { + return EventWithdrawProposal.encode(message).finish(); + }, + toProtoMsg(message: EventWithdrawProposal): EventWithdrawProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventWithdrawProposal", + value: EventWithdrawProposal.encode(message).finish() + }; } - }; - function createBaseEventVote(): EventVote { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const EventVote = { - encode(message: EventVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.EventVote", + encode(message: EventVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventVote { + fromPartial(object: Partial): EventVote { const message = createBaseEventVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; + }, + fromAmino(object: EventVoteAmino): EventVote { + const message = createBaseEventVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: EventVote): EventVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventVoteAminoMsg): EventVote { + return EventVote.fromAmino(object.value); + }, + toAminoMsg(message: EventVote): EventVoteAminoMsg { + return { + type: "cosmos-sdk/EventVote", + value: EventVote.toAmino(message) + }; + }, + fromProtoMsg(message: EventVoteProtoMsg): EventVote { + return EventVote.decode(message.value); + }, + toProto(message: EventVote): Uint8Array { + return EventVote.encode(message).finish(); + }, + toProtoMsg(message: EventVote): EventVoteProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventVote", + value: EventVote.encode(message).finish() + }; } - }; - function createBaseEventExec(): EventExec { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), result: 0 }; } - export const EventExec = { - encode(message: EventExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.EventExec", + encode(message: EventExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.result !== 0) { writer.uint32(16).int32(message.result); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventExec { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.result = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventExec { + fromPartial(object: Partial): EventExec { const message = createBaseEventExec(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.result = object.result ?? 0; return message; + }, + fromAmino(object: EventExecAmino): EventExec { + const message = createBaseEventExec(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.result !== undefined && object.result !== null) { + message.result = proposalExecutorResultFromJSON(object.result); + } + return message; + }, + toAmino(message: EventExec): EventExecAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.result = proposalExecutorResultToJSON(message.result); + return obj; + }, + fromAminoMsg(object: EventExecAminoMsg): EventExec { + return EventExec.fromAmino(object.value); + }, + toAminoMsg(message: EventExec): EventExecAminoMsg { + return { + type: "cosmos-sdk/EventExec", + value: EventExec.toAmino(message) + }; + }, + fromProtoMsg(message: EventExecProtoMsg): EventExec { + return EventExec.decode(message.value); + }, + toProto(message: EventExec): Uint8Array { + return EventExec.encode(message).finish(); + }, + toProtoMsg(message: EventExec): EventExecProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventExec", + value: EventExec.encode(message).finish() + }; } - }; - function createBaseEventLeaveGroup(): EventLeaveGroup { return { - groupId: Long.UZERO, + groupId: BigInt(0), address: "" }; } - export const EventLeaveGroup = { - encode(message: EventLeaveGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.EventLeaveGroup", + encode(message: EventLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - if (message.address !== "") { writer.uint32(18).string(message.address); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventLeaveGroup { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 2: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventLeaveGroup { + fromPartial(object: Partial): EventLeaveGroup { const message = createBaseEventLeaveGroup(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.address = object.address ?? ""; return message; + }, + fromAmino(object: EventLeaveGroupAmino): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { + return EventLeaveGroup.fromAmino(object.value); + }, + toAminoMsg(message: EventLeaveGroup): EventLeaveGroupAminoMsg { + return { + type: "cosmos-sdk/EventLeaveGroup", + value: EventLeaveGroup.toAmino(message) + }; + }, + fromProtoMsg(message: EventLeaveGroupProtoMsg): EventLeaveGroup { + return EventLeaveGroup.decode(message.value); + }, + toProto(message: EventLeaveGroup): Uint8Array { + return EventLeaveGroup.encode(message).finish(); + }, + toProtoMsg(message: EventLeaveGroup): EventLeaveGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventLeaveGroup", + value: EventLeaveGroup.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/genesis.ts b/src/codegen/cosmos/group/v1/genesis.ts index 5833e1b..8fb3a44 100644 --- a/src/codegen/cosmos/group/v1/genesis.ts +++ b/src/codegen/cosmos/group/v1/genesis.ts @@ -1,190 +1,240 @@ -import { GroupInfo, GroupInfoSDKType, GroupMember, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType } from "./types"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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: Long; + groupSeq: bigint; /** 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: Long; + groupPolicySeq: bigint; /** 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: Long; + proposalSeq: bigint; /** proposals is the list of proposals. */ - proposals: Proposal[]; /** votes is the list of votes. */ - votes: Vote[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.group.v1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the group module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** * group_seq is the group table orm.Sequence, * it is used to get the next group ID. */ - group_seq: Long; + group_seq?: string; /** groups is the list of groups info. */ - - groups: GroupInfoSDKType[]; + groups?: GroupInfoAmino[]; /** group_members is the list of groups members. */ - - group_members: GroupMemberSDKType[]; + group_members?: GroupMemberAmino[]; /** * group_policy_seq is the group policy table orm.Sequence, * it is used to generate the next group policy account address. */ - - group_policy_seq: Long; + group_policy_seq?: string; /** group_policies is the list of group policies info. */ - - group_policies: GroupPolicyInfoSDKType[]; + group_policies?: GroupPolicyInfoAmino[]; /** * proposal_seq is the proposal table orm.Sequence, * it is used to get the next proposal ID. */ - - proposal_seq: Long; + proposal_seq?: string; /** proposals is the list of proposals. */ - - proposals: ProposalSDKType[]; + proposals?: ProposalAmino[]; /** votes is the list of votes. */ - + votes?: VoteAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the group module's genesis state. */ +export interface GenesisStateSDKType { + group_seq: bigint; + groups: GroupInfoSDKType[]; + group_members: GroupMemberSDKType[]; + group_policy_seq: bigint; + group_policies: GroupPolicyInfoSDKType[]; + proposal_seq: bigint; + proposals: ProposalSDKType[]; votes: VoteSDKType[]; } - function createBaseGenesisState(): GenesisState { return { - groupSeq: Long.UZERO, + groupSeq: BigInt(0), groups: [], groupMembers: [], - groupPolicySeq: Long.UZERO, + groupPolicySeq: BigInt(0), groupPolicies: [], - proposalSeq: Long.UZERO, + proposalSeq: BigInt(0), proposals: [], votes: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupSeq.isZero()) { + typeUrl: "/cosmos.group.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupSeq !== BigInt(0)) { writer.uint32(8).uint64(message.groupSeq); } - for (const v of message.groups) { GroupInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.groupMembers) { GroupMember.encode(v!, writer.uint32(26).fork()).ldelim(); } - - if (!message.groupPolicySeq.isZero()) { + if (message.groupPolicySeq !== BigInt(0)) { writer.uint32(32).uint64(message.groupPolicySeq); } - for (const v of message.groupPolicies) { GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).ldelim(); } - - if (!message.proposalSeq.isZero()) { + if (message.proposalSeq !== BigInt(0)) { writer.uint32(48).uint64(message.proposalSeq); } - for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(58).fork()).ldelim(); } - for (const v of message.votes) { Vote.encode(v!, writer.uint32(66).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.groupSeq = (reader.uint64() as Long); + message.groupSeq = reader.uint64(); break; - case 2: message.groups.push(GroupInfo.decode(reader, reader.uint32())); break; - case 3: message.groupMembers.push(GroupMember.decode(reader, reader.uint32())); break; - case 4: - message.groupPolicySeq = (reader.uint64() as Long); + message.groupPolicySeq = reader.uint64(); break; - case 5: message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); break; - case 6: - message.proposalSeq = (reader.uint64() as Long); + message.proposalSeq = reader.uint64(); break; - case 7: message.proposals.push(Proposal.decode(reader, reader.uint32())); break; - case 8: message.votes.push(Vote.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); - message.groupSeq = object.groupSeq !== undefined && object.groupSeq !== null ? Long.fromValue(object.groupSeq) : Long.UZERO; + message.groupSeq = object.groupSeq !== undefined && object.groupSeq !== null ? BigInt(object.groupSeq.toString()) : BigInt(0); message.groups = object.groups?.map(e => GroupInfo.fromPartial(e)) || []; message.groupMembers = object.groupMembers?.map(e => GroupMember.fromPartial(e)) || []; - message.groupPolicySeq = object.groupPolicySeq !== undefined && object.groupPolicySeq !== null ? Long.fromValue(object.groupPolicySeq) : Long.UZERO; + message.groupPolicySeq = object.groupPolicySeq !== undefined && object.groupPolicySeq !== null ? BigInt(object.groupPolicySeq.toString()) : BigInt(0); message.groupPolicies = object.groupPolicies?.map(e => GroupPolicyInfo.fromPartial(e)) || []; - message.proposalSeq = object.proposalSeq !== undefined && object.proposalSeq !== null ? Long.fromValue(object.proposalSeq) : Long.UZERO; + message.proposalSeq = object.proposalSeq !== undefined && object.proposalSeq !== null ? BigInt(object.proposalSeq.toString()) : BigInt(0); message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.group_seq !== undefined && object.group_seq !== null) { + message.groupSeq = BigInt(object.group_seq); + } + message.groups = object.groups?.map(e => GroupInfo.fromAmino(e)) || []; + message.groupMembers = object.group_members?.map(e => GroupMember.fromAmino(e)) || []; + if (object.group_policy_seq !== undefined && object.group_policy_seq !== null) { + message.groupPolicySeq = BigInt(object.group_policy_seq); + } + message.groupPolicies = object.group_policies?.map(e => GroupPolicyInfo.fromAmino(e)) || []; + if (object.proposal_seq !== undefined && object.proposal_seq !== null) { + message.proposalSeq = BigInt(object.proposal_seq); + } + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + if (message.groups) { + obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); + } else { + obj.groups = []; + } + if (message.groupMembers) { + obj.group_members = message.groupMembers.map(e => e ? GroupMember.toAmino(e) : undefined); + } else { + obj.group_members = []; + } + obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + if (message.groupPolicies) { + obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); + } else { + obj.group_policies = []; + } + obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = []; + } + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/query.lcd.ts b/src/codegen/cosmos/group/v1/query.lcd.ts index dae3205..9afe234 100644 --- a/src/codegen/cosmos/group/v1/query.lcd.ts +++ b/src/codegen/cosmos/group/v1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryGroupInfoRequest, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -25,159 +24,116 @@ export class LCDQueryClient { this.tallyResult = this.tallyResult.bind(this); } /* GroupInfo queries group info based on group id. */ - - async groupInfo(params: QueryGroupInfoRequest): Promise { const endpoint = `cosmos/group/v1/group_info/${params.groupId}`; return await this.req.get(endpoint); } /* GroupPolicyInfo queries group policy info based on account address of group policy. */ - - async groupPolicyInfo(params: QueryGroupPolicyInfoRequest): Promise { const endpoint = `cosmos/group/v1/group_policy_info/${params.address}`; return await this.req.get(endpoint); } /* GroupMembers queries members of a group */ - - async groupMembers(params: QueryGroupMembersRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/group/v1/group_members/${params.groupId}`; return await this.req.get(endpoint, options); } /* GroupsByAdmin queries groups by admin address. */ - - async groupsByAdmin(params: QueryGroupsByAdminRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/group/v1/groups_by_admin/${params.admin}`; return await this.req.get(endpoint, options); } /* GroupPoliciesByGroup queries group policies by group id. */ - - async groupPoliciesByGroup(params: QueryGroupPoliciesByGroupRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/group/v1/group_policies_by_group/${params.groupId}`; return await this.req.get(endpoint, options); } /* GroupsByAdmin queries group policies by admin address. */ - - async groupPoliciesByAdmin(params: QueryGroupPoliciesByAdminRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/group/v1/group_policies_by_admin/${params.admin}`; return await this.req.get(endpoint, options); } /* Proposal queries a proposal based on proposal id. */ - - async proposal(params: QueryProposalRequest): Promise { const endpoint = `cosmos/group/v1/proposal/${params.proposalId}`; return await this.req.get(endpoint); } /* ProposalsByGroupPolicy queries proposals based on account address of group policy. */ - - async proposalsByGroupPolicy(params: QueryProposalsByGroupPolicyRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/group/v1/proposals_by_group_policy/${params.address}`; return await this.req.get(endpoint, options); } /* VoteByProposalVoter queries a vote by proposal id and voter. */ - - async voteByProposalVoter(params: QueryVoteByProposalVoterRequest): Promise { const endpoint = `cosmos/group/v1/vote_by_proposal_voter/${params.proposalId}/${params.voter}`; return await this.req.get(endpoint); } /* VotesByProposal queries a vote by proposal. */ - - async votesByProposal(params: QueryVotesByProposalRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/group/v1/votes_by_proposal/${params.proposalId}`; return await this.req.get(endpoint, options); } /* VotesByVoter queries a vote by voter. */ - - async votesByVoter(params: QueryVotesByVoterRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/group/v1/votes_by_voter/${params.voter}`; return await this.req.get(endpoint, options); } /* GroupsByMember queries groups by member address. */ - - async groupsByMember(params: QueryGroupsByMemberRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/group/v1/groups_by_member/${params.address}`; return await this.req.get(endpoint, options); } /* TallyResult queries the tally of a proposal votes. */ - - async tallyResult(params: QueryTallyResultRequest): Promise { const endpoint = `cosmos/group/v1/proposals/${params.proposalId}/tally`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/query.rpc.Query.ts b/src/codegen/cosmos/group/v1/query.rpc.Query.ts index 27d76df..cb17035 100644 --- a/src/codegen/cosmos/group/v1/query.rpc.Query.ts +++ b/src/codegen/cosmos/group/v1/query.rpc.Query.ts @@ -1,52 +1,38 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryGroupInfoRequest, QueryGroupInfoResponse, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponse, QueryGroupMembersRequest, QueryGroupMembersResponse, QueryGroupsByAdminRequest, QueryGroupsByAdminResponse, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponse, QueryProposalRequest, QueryProposalResponse, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponse, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponse, QueryVotesByProposalRequest, QueryVotesByProposalResponse, QueryVotesByVoterRequest, QueryVotesByVoterResponse, QueryGroupsByMemberRequest, QueryGroupsByMemberResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; /** Query is the cosmos.group.v1 Query service. */ - export interface Query { /** GroupInfo queries group info based on group id. */ groupInfo(request: QueryGroupInfoRequest): Promise; /** GroupPolicyInfo queries group policy info based on account address of group policy. */ - groupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise; /** GroupMembers queries members of a group */ - groupMembers(request: QueryGroupMembersRequest): Promise; /** GroupsByAdmin queries groups by admin address. */ - groupsByAdmin(request: QueryGroupsByAdminRequest): Promise; /** GroupPoliciesByGroup queries group policies by group id. */ - groupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise; /** GroupsByAdmin queries group policies by admin address. */ - groupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise; /** Proposal queries a proposal based on proposal id. */ - proposal(request: QueryProposalRequest): Promise; /** ProposalsByGroupPolicy queries proposals based on account address of group policy. */ - proposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise; /** VoteByProposalVoter queries a vote by proposal id and voter. */ - voteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise; /** VotesByProposal queries a vote by proposal. */ - votesByProposal(request: QueryVotesByProposalRequest): Promise; /** VotesByVoter queries a vote by voter. */ - votesByVoter(request: QueryVotesByVoterRequest): Promise; /** GroupsByMember queries groups by member address. */ - groupsByMember(request: QueryGroupsByMemberRequest): Promise; /** TallyResult queries the tally of a proposal votes. */ - tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.groupInfo = this.groupInfo.bind(this); @@ -63,85 +49,71 @@ export class QueryClientImpl implements Query { this.groupsByMember = this.groupsByMember.bind(this); this.tallyResult = this.tallyResult.bind(this); } - groupInfo(request: QueryGroupInfoRequest): Promise { const data = QueryGroupInfoRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.group.v1.Query", "GroupInfo", data); - return promise.then(data => QueryGroupInfoResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "GroupPolicyInfo", data); - return promise.then(data => QueryGroupPolicyInfoResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "GroupMembers", data); - return promise.then(data => QueryGroupMembersResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "GroupsByAdmin", data); - return promise.then(data => QueryGroupsByAdminResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "GroupPoliciesByGroup", data); - return promise.then(data => QueryGroupPoliciesByGroupResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "GroupPoliciesByAdmin", data); - return promise.then(data => QueryGroupPoliciesByAdminResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "Proposal", data); - return promise.then(data => QueryProposalResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "ProposalsByGroupPolicy", data); - return promise.then(data => QueryProposalsByGroupPolicyResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "VoteByProposalVoter", data); - return promise.then(data => QueryVoteByProposalVoterResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "VotesByProposal", data); - return promise.then(data => QueryVotesByProposalResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "VotesByVoter", data); - return promise.then(data => QueryVotesByVoterResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "GroupsByMember", data); - return promise.then(data => QueryGroupsByMemberResponse.decode(new _m0.Reader(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("cosmos.group.v1.Query", "TallyResult", data); - return promise.then(data => QueryTallyResultResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryTallyResultResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -150,54 +122,41 @@ export const createRpcQueryExtension = (base: QueryClient) => { groupInfo(request: QueryGroupInfoRequest): Promise { return queryService.groupInfo(request); }, - groupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise { return queryService.groupPolicyInfo(request); }, - groupMembers(request: QueryGroupMembersRequest): Promise { return queryService.groupMembers(request); }, - groupsByAdmin(request: QueryGroupsByAdminRequest): Promise { return queryService.groupsByAdmin(request); }, - groupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise { return queryService.groupPoliciesByGroup(request); }, - groupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise { return queryService.groupPoliciesByAdmin(request); }, - proposal(request: QueryProposalRequest): Promise { return queryService.proposal(request); }, - proposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise { return queryService.proposalsByGroupPolicy(request); }, - voteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise { return queryService.voteByProposalVoter(request); }, - votesByProposal(request: QueryVotesByProposalRequest): Promise { return queryService.votesByProposal(request); }, - votesByVoter(request: QueryVotesByVoterRequest): Promise { return queryService.votesByVoter(request); }, - groupsByMember(request: QueryGroupsByMemberRequest): Promise { return queryService.groupsByMember(request); }, - tallyResult(request: QueryTallyResultRequest): Promise { return queryService.tallyResult(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/query.ts b/src/codegen/cosmos/group/v1/query.ts index 35c9a45..32a3823 100644 --- a/src/codegen/cosmos/group/v1/query.ts +++ b/src/codegen/cosmos/group/v1/query.ts @@ -1,1758 +1,2674 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ - export interface QueryGroupInfoRequest { /** group_id is the unique ID of the group. */ - groupId: Long; + groupId: bigint; +} +export interface QueryGroupInfoRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest"; + value: Uint8Array; } /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ - -export interface QueryGroupInfoRequestSDKType { +export interface QueryGroupInfoRequestAmino { /** group_id is the unique ID of the group. */ - group_id: Long; + group_id?: string; +} +export interface QueryGroupInfoRequestAminoMsg { + type: "cosmos-sdk/QueryGroupInfoRequest"; + value: QueryGroupInfoRequestAmino; +} +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequestSDKType { + group_id: bigint; } /** QueryGroupInfoResponse is the Query/GroupInfo response type. */ - export interface QueryGroupInfoResponse { /** info is the GroupInfo for the group. */ info?: GroupInfo; } +export interface QueryGroupInfoResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse"; + value: Uint8Array; +} /** QueryGroupInfoResponse is the Query/GroupInfo response type. */ - -export interface QueryGroupInfoResponseSDKType { +export interface QueryGroupInfoResponseAmino { /** info is the GroupInfo for the group. */ + info?: GroupInfoAmino; +} +export interface QueryGroupInfoResponseAminoMsg { + type: "cosmos-sdk/QueryGroupInfoResponse"; + value: QueryGroupInfoResponseAmino; +} +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponseSDKType { info?: GroupInfoSDKType; } /** QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. */ - export interface QueryGroupPolicyInfoRequest { /** address is the account address of the group policy. */ address: string; } +export interface QueryGroupPolicyInfoRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest"; + value: Uint8Array; +} /** QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. */ - -export interface QueryGroupPolicyInfoRequestSDKType { +export interface QueryGroupPolicyInfoRequestAmino { /** address is the account address of the group policy. */ + address?: string; +} +export interface QueryGroupPolicyInfoRequestAminoMsg { + type: "cosmos-sdk/QueryGroupPolicyInfoRequest"; + value: QueryGroupPolicyInfoRequestAmino; +} +/** QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. */ +export interface QueryGroupPolicyInfoRequestSDKType { address: string; } /** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ - export interface QueryGroupPolicyInfoResponse { /** info is the GroupPolicyInfo for the group policy. */ info?: GroupPolicyInfo; } +export interface QueryGroupPolicyInfoResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse"; + value: Uint8Array; +} /** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ - -export interface QueryGroupPolicyInfoResponseSDKType { +export interface QueryGroupPolicyInfoResponseAmino { /** info is the GroupPolicyInfo for the group policy. */ + info?: GroupPolicyInfoAmino; +} +export interface QueryGroupPolicyInfoResponseAminoMsg { + type: "cosmos-sdk/QueryGroupPolicyInfoResponse"; + value: QueryGroupPolicyInfoResponseAmino; +} +/** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ +export interface QueryGroupPolicyInfoResponseSDKType { info?: GroupPolicyInfoSDKType; } /** QueryGroupMembersRequest is the Query/GroupMembers request type. */ - export interface QueryGroupMembersRequest { /** group_id is the unique ID of the group. */ - groupId: Long; + groupId: bigint; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryGroupMembersRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest"; + value: Uint8Array; +} /** QueryGroupMembersRequest is the Query/GroupMembers request type. */ - -export interface QueryGroupMembersRequestSDKType { +export interface QueryGroupMembersRequestAmino { /** group_id is the unique ID of the group. */ - group_id: Long; + group_id?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryGroupMembersRequestAminoMsg { + type: "cosmos-sdk/QueryGroupMembersRequest"; + value: QueryGroupMembersRequestAmino; +} +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequestSDKType { + group_id: bigint; pagination?: PageRequestSDKType; } /** 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; } +export interface QueryGroupMembersResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse"; + value: Uint8Array; +} /** QueryGroupMembersResponse is the Query/GroupMembersResponse response type. */ - -export interface QueryGroupMembersResponseSDKType { +export interface QueryGroupMembersResponseAmino { /** members are the members of the group with given group_id. */ - members: GroupMemberSDKType[]; + members?: GroupMemberAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryGroupMembersResponseAminoMsg { + type: "cosmos-sdk/QueryGroupMembersResponse"; + value: QueryGroupMembersResponseAmino; +} +/** QueryGroupMembersResponse is the Query/GroupMembersResponse response type. */ +export interface QueryGroupMembersResponseSDKType { + members: GroupMemberSDKType[]; pagination?: PageResponseSDKType; } /** 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; } +export interface QueryGroupsByAdminRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest"; + value: Uint8Array; +} /** QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. */ - -export interface QueryGroupsByAdminRequestSDKType { +export interface QueryGroupsByAdminRequestAmino { /** admin is the account address of a group's admin. */ - admin: string; + admin?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryGroupsByAdminRequestAminoMsg { + type: "cosmos-sdk/QueryGroupsByAdminRequest"; + value: QueryGroupsByAdminRequestAmino; +} +/** QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. */ +export interface QueryGroupsByAdminRequestSDKType { + admin: string; pagination?: PageRequestSDKType; } /** 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; } +export interface QueryGroupsByAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse"; + value: Uint8Array; +} /** QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. */ - -export interface QueryGroupsByAdminResponseSDKType { +export interface QueryGroupsByAdminResponseAmino { /** groups are the groups info with the provided admin. */ - groups: GroupInfoSDKType[]; + groups?: GroupInfoAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryGroupsByAdminResponseAminoMsg { + type: "cosmos-sdk/QueryGroupsByAdminResponse"; + value: QueryGroupsByAdminResponseAmino; +} +/** QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. */ +export interface QueryGroupsByAdminResponseSDKType { + groups: GroupInfoSDKType[]; pagination?: PageResponseSDKType; } /** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ - export interface QueryGroupPoliciesByGroupRequest { /** group_id is the unique ID of the group policy's group. */ - groupId: Long; + groupId: bigint; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryGroupPoliciesByGroupRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest"; + value: Uint8Array; +} /** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ - -export interface QueryGroupPoliciesByGroupRequestSDKType { +export interface QueryGroupPoliciesByGroupRequestAmino { /** group_id is the unique ID of the group policy's group. */ - group_id: Long; + group_id?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryGroupPoliciesByGroupRequestAminoMsg { + type: "cosmos-sdk/QueryGroupPoliciesByGroupRequest"; + value: QueryGroupPoliciesByGroupRequestAmino; +} +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequestSDKType { + group_id: bigint; pagination?: PageRequestSDKType; } /** 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; } +export interface QueryGroupPoliciesByGroupResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse"; + value: Uint8Array; +} /** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ - -export interface QueryGroupPoliciesByGroupResponseSDKType { +export interface QueryGroupPoliciesByGroupResponseAmino { /** group_policies are the group policies info associated with the provided group. */ - group_policies: GroupPolicyInfoSDKType[]; + group_policies?: GroupPolicyInfoAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryGroupPoliciesByGroupResponseAminoMsg { + type: "cosmos-sdk/QueryGroupPoliciesByGroupResponse"; + value: QueryGroupPoliciesByGroupResponseAmino; +} +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponseSDKType { + group_policies: GroupPolicyInfoSDKType[]; pagination?: PageResponseSDKType; } /** 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; } +export interface QueryGroupPoliciesByAdminRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest"; + value: Uint8Array; +} /** QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. */ - -export interface QueryGroupPoliciesByAdminRequestSDKType { +export interface QueryGroupPoliciesByAdminRequestAmino { /** admin is the admin address of the group policy. */ - admin: string; + admin?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryGroupPoliciesByAdminRequestAminoMsg { + type: "cosmos-sdk/QueryGroupPoliciesByAdminRequest"; + value: QueryGroupPoliciesByAdminRequestAmino; +} +/** QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. */ +export interface QueryGroupPoliciesByAdminRequestSDKType { + admin: string; pagination?: PageRequestSDKType; } /** 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; } +export interface QueryGroupPoliciesByAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse"; + value: Uint8Array; +} /** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ - -export interface QueryGroupPoliciesByAdminResponseSDKType { +export interface QueryGroupPoliciesByAdminResponseAmino { /** group_policies are the group policies info with provided admin. */ - group_policies: GroupPolicyInfoSDKType[]; + group_policies?: GroupPolicyInfoAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryGroupPoliciesByAdminResponseAminoMsg { + type: "cosmos-sdk/QueryGroupPoliciesByAdminResponse"; + value: QueryGroupPoliciesByAdminResponseAmino; +} +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponseSDKType { + group_policies: GroupPolicyInfoSDKType[]; pagination?: PageResponseSDKType; } /** QueryProposalRequest is the Query/Proposal request type. */ - export interface QueryProposalRequest { /** proposal_id is the unique ID of a proposal. */ - proposalId: Long; + proposalId: bigint; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryProposalRequest"; + value: Uint8Array; +} +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequestAmino { + /** proposal_id is the unique ID of a proposal. */ + proposal_id?: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/QueryProposalRequest"; + value: QueryProposalRequestAmino; } /** QueryProposalRequest is the Query/Proposal request type. */ - export interface QueryProposalRequestSDKType { - /** proposal_id is the unique ID of a proposal. */ - proposal_id: Long; + proposal_id: bigint; } /** QueryProposalResponse is the Query/Proposal response type. */ - export interface QueryProposalResponse { /** proposal is the proposal info. */ proposal?: Proposal; } +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryProposalResponse"; + value: Uint8Array; +} /** QueryProposalResponse is the Query/Proposal response type. */ - -export interface QueryProposalResponseSDKType { +export interface QueryProposalResponseAmino { /** proposal is the proposal info. */ + proposal?: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/QueryProposalResponse"; + value: QueryProposalResponseAmino; +} +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponseSDKType { proposal?: ProposalSDKType; } /** 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; } +export interface QueryProposalsByGroupPolicyRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest"; + value: Uint8Array; +} /** QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. */ - -export interface QueryProposalsByGroupPolicyRequestSDKType { +export interface QueryProposalsByGroupPolicyRequestAmino { /** address is the account address of the group policy related to proposals. */ - address: string; + address?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryProposalsByGroupPolicyRequestAminoMsg { + type: "cosmos-sdk/QueryProposalsByGroupPolicyRequest"; + value: QueryProposalsByGroupPolicyRequestAmino; +} +/** QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. */ +export interface QueryProposalsByGroupPolicyRequestSDKType { + address: string; pagination?: PageRequestSDKType; } /** 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; } +export interface QueryProposalsByGroupPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse"; + value: Uint8Array; +} /** QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. */ - -export interface QueryProposalsByGroupPolicyResponseSDKType { +export interface QueryProposalsByGroupPolicyResponseAmino { /** proposals are the proposals with given group policy. */ - proposals: ProposalSDKType[]; + proposals?: ProposalAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryProposalsByGroupPolicyResponseAminoMsg { + type: "cosmos-sdk/QueryProposalsByGroupPolicyResponse"; + value: QueryProposalsByGroupPolicyResponseAmino; +} +/** QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. */ +export interface QueryProposalsByGroupPolicyResponseSDKType { + proposals: ProposalSDKType[]; pagination?: PageResponseSDKType; } /** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ - export interface QueryVoteByProposalVoterRequest { /** proposal_id is the unique ID of a proposal. */ - proposalId: Long; + proposalId: bigint; /** voter is a proposal voter account address. */ - voter: string; } +export interface QueryVoteByProposalVoterRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest"; + value: Uint8Array; +} /** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ - -export interface QueryVoteByProposalVoterRequestSDKType { +export interface QueryVoteByProposalVoterRequestAmino { /** proposal_id is the unique ID of a proposal. */ - proposal_id: Long; + proposal_id?: string; /** voter is a proposal voter account address. */ - + voter?: string; +} +export interface QueryVoteByProposalVoterRequestAminoMsg { + type: "cosmos-sdk/QueryVoteByProposalVoterRequest"; + value: QueryVoteByProposalVoterRequestAmino; +} +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequestSDKType { + proposal_id: bigint; voter: string; } /** QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. */ - export interface QueryVoteByProposalVoterResponse { /** vote is the vote with given proposal_id and voter. */ vote?: Vote; } +export interface QueryVoteByProposalVoterResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse"; + value: Uint8Array; +} /** QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. */ - -export interface QueryVoteByProposalVoterResponseSDKType { +export interface QueryVoteByProposalVoterResponseAmino { /** vote is the vote with given proposal_id and voter. */ + vote?: VoteAmino; +} +export interface QueryVoteByProposalVoterResponseAminoMsg { + type: "cosmos-sdk/QueryVoteByProposalVoterResponse"; + value: QueryVoteByProposalVoterResponseAmino; +} +/** QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. */ +export interface QueryVoteByProposalVoterResponseSDKType { vote?: VoteSDKType; } /** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ - export interface QueryVotesByProposalRequest { /** proposal_id is the unique ID of a proposal. */ - proposalId: Long; + proposalId: bigint; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryVotesByProposalRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest"; + value: Uint8Array; +} /** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ - -export interface QueryVotesByProposalRequestSDKType { +export interface QueryVotesByProposalRequestAmino { /** proposal_id is the unique ID of a proposal. */ - proposal_id: Long; + proposal_id?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryVotesByProposalRequestAminoMsg { + type: "cosmos-sdk/QueryVotesByProposalRequest"; + value: QueryVotesByProposalRequestAmino; +} +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequestSDKType { + proposal_id: bigint; pagination?: PageRequestSDKType; } /** 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; } +export interface QueryVotesByProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse"; + value: Uint8Array; +} /** QueryVotesByProposalResponse is the Query/VotesByProposal response type. */ - -export interface QueryVotesByProposalResponseSDKType { +export interface QueryVotesByProposalResponseAmino { /** votes are the list of votes for given proposal_id. */ - votes: VoteSDKType[]; + votes?: VoteAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryVotesByProposalResponseAminoMsg { + type: "cosmos-sdk/QueryVotesByProposalResponse"; + value: QueryVotesByProposalResponseAmino; +} +/** QueryVotesByProposalResponse is the Query/VotesByProposal response type. */ +export interface QueryVotesByProposalResponseSDKType { + votes: VoteSDKType[]; pagination?: PageResponseSDKType; } /** 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; } +export interface QueryVotesByVoterRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest"; + value: Uint8Array; +} /** QueryVotesByVoterRequest is the Query/VotesByVoter request type. */ - -export interface QueryVotesByVoterRequestSDKType { +export interface QueryVotesByVoterRequestAmino { /** voter is a proposal voter account address. */ - voter: string; + voter?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryVotesByVoterRequestAminoMsg { + type: "cosmos-sdk/QueryVotesByVoterRequest"; + value: QueryVotesByVoterRequestAmino; +} +/** QueryVotesByVoterRequest is the Query/VotesByVoter request type. */ +export interface QueryVotesByVoterRequestSDKType { + voter: string; pagination?: PageRequestSDKType; } /** 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; } +export interface QueryVotesByVoterResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse"; + value: Uint8Array; +} /** QueryVotesByVoterResponse is the Query/VotesByVoter response type. */ - -export interface QueryVotesByVoterResponseSDKType { +export interface QueryVotesByVoterResponseAmino { /** votes are the list of votes by given voter. */ - votes: VoteSDKType[]; + votes?: VoteAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryVotesByVoterResponseAminoMsg { + type: "cosmos-sdk/QueryVotesByVoterResponse"; + value: QueryVotesByVoterResponseAmino; +} +/** QueryVotesByVoterResponse is the Query/VotesByVoter response type. */ +export interface QueryVotesByVoterResponseSDKType { + votes: VoteSDKType[]; pagination?: PageResponseSDKType; } /** 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; } +export interface QueryGroupsByMemberRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest"; + value: Uint8Array; +} /** QueryGroupsByMemberRequest is the Query/GroupsByMember request type. */ - -export interface QueryGroupsByMemberRequestSDKType { +export interface QueryGroupsByMemberRequestAmino { /** address is the group member address. */ - address: string; + address?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryGroupsByMemberRequestAminoMsg { + type: "cosmos-sdk/QueryGroupsByMemberRequest"; + value: QueryGroupsByMemberRequestAmino; +} +/** QueryGroupsByMemberRequest is the Query/GroupsByMember request type. */ +export interface QueryGroupsByMemberRequestSDKType { + address: string; pagination?: PageRequestSDKType; } /** 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; } +export interface QueryGroupsByMemberResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse"; + value: Uint8Array; +} /** QueryGroupsByMemberResponse is the Query/GroupsByMember response type. */ - -export interface QueryGroupsByMemberResponseSDKType { +export interface QueryGroupsByMemberResponseAmino { /** groups are the groups info with the provided group member. */ - groups: GroupInfoSDKType[]; + groups?: GroupInfoAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryGroupsByMemberResponseAminoMsg { + type: "cosmos-sdk/QueryGroupsByMemberResponse"; + value: QueryGroupsByMemberResponseAmino; +} +/** QueryGroupsByMemberResponse is the Query/GroupsByMember response type. */ +export interface QueryGroupsByMemberResponseSDKType { + groups: GroupInfoSDKType[]; pagination?: PageResponseSDKType; } /** QueryTallyResultRequest is the Query/TallyResult request type. */ - export interface QueryTallyResultRequest { /** proposal_id is the unique id of a proposal. */ - proposalId: Long; + proposalId: bigint; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryTallyResultRequest"; + value: Uint8Array; } /** QueryTallyResultRequest is the Query/TallyResult request type. */ - -export interface QueryTallyResultRequestSDKType { +export interface QueryTallyResultRequestAmino { /** proposal_id is the unique id of a proposal. */ - proposal_id: Long; + proposal_id?: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequestSDKType { + proposal_id: bigint; } /** QueryTallyResultResponse is the Query/TallyResult response type. */ - export interface QueryTallyResultResponse { /** tally defines the requested tally. */ - tally?: TallyResult; + tally: TallyResult; +} +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryTallyResultResponse"; + value: Uint8Array; +} +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponseAmino { + /** tally defines the requested tally. */ + tally?: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; } /** QueryTallyResultResponse is the Query/TallyResult response type. */ - export interface QueryTallyResultResponseSDKType { - /** tally defines the requested tally. */ - tally?: TallyResultSDKType; + tally: TallyResultSDKType; } - function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { return { - groupId: Long.UZERO + groupId: BigInt(0) }; } - export const QueryGroupInfoRequest = { - encode(message: QueryGroupInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", + encode(message: QueryGroupInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupInfoRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupInfoRequest { + fromPartial(object: Partial): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryGroupInfoRequestAmino): QueryGroupInfoRequest { const message = createBaseQueryGroupInfoRequest(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } return message; + }, + toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { + return QueryGroupInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupInfoRequest): QueryGroupInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupInfoRequest", + value: QueryGroupInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupInfoRequestProtoMsg): QueryGroupInfoRequest { + return QueryGroupInfoRequest.decode(message.value); + }, + toProto(message: QueryGroupInfoRequest): Uint8Array { + return QueryGroupInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupInfoRequest): QueryGroupInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", + value: QueryGroupInfoRequest.encode(message).finish() + }; } - }; - function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { return { info: undefined }; } - export const QueryGroupInfoResponse = { - encode(message: QueryGroupInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", + encode(message: QueryGroupInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.info !== undefined) { GroupInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupInfoResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.info = GroupInfo.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupInfoResponse { + fromPartial(object: Partial): QueryGroupInfoResponse { const message = createBaseQueryGroupInfoResponse(); message.info = object.info !== undefined && object.info !== null ? GroupInfo.fromPartial(object.info) : undefined; return message; + }, + fromAmino(object: QueryGroupInfoResponseAmino): QueryGroupInfoResponse { + const message = createBaseQueryGroupInfoResponse(); + if (object.info !== undefined && object.info !== null) { + message.info = GroupInfo.fromAmino(object.info); + } + return message; + }, + toAmino(message: QueryGroupInfoResponse): QueryGroupInfoResponseAmino { + const obj: any = {}; + obj.info = message.info ? GroupInfo.toAmino(message.info) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupInfoResponseAminoMsg): QueryGroupInfoResponse { + return QueryGroupInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupInfoResponse): QueryGroupInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupInfoResponse", + value: QueryGroupInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupInfoResponseProtoMsg): QueryGroupInfoResponse { + return QueryGroupInfoResponse.decode(message.value); + }, + toProto(message: QueryGroupInfoResponse): Uint8Array { + return QueryGroupInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupInfoResponse): QueryGroupInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", + value: QueryGroupInfoResponse.encode(message).finish() + }; } - }; - function createBaseQueryGroupPolicyInfoRequest(): QueryGroupPolicyInfoRequest { return { address: "" }; } - export const QueryGroupPolicyInfoRequest = { - encode(message: QueryGroupPolicyInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", + encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupPolicyInfoRequest { + fromPartial(object: Partial): QueryGroupPolicyInfoRequest { const message = createBaseQueryGroupPolicyInfoRequest(); message.address = object.address ?? ""; return message; + }, + fromAmino(object: QueryGroupPolicyInfoRequestAmino): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPolicyInfoRequest", + value: QueryGroupPolicyInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPolicyInfoRequestProtoMsg): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.decode(message.value); + }, + toProto(message: QueryGroupPolicyInfoRequest): Uint8Array { + return QueryGroupPolicyInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", + value: QueryGroupPolicyInfoRequest.encode(message).finish() + }; } - }; - function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { return { info: undefined }; } - export const QueryGroupPolicyInfoResponse = { - encode(message: QueryGroupPolicyInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", + encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.info !== undefined) { GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.info = GroupPolicyInfo.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupPolicyInfoResponse { + fromPartial(object: Partial): QueryGroupPolicyInfoResponse { const message = createBaseQueryGroupPolicyInfoResponse(); message.info = object.info !== undefined && object.info !== null ? GroupPolicyInfo.fromPartial(object.info) : undefined; return message; + }, + fromAmino(object: QueryGroupPolicyInfoResponseAmino): QueryGroupPolicyInfoResponse { + const message = createBaseQueryGroupPolicyInfoResponse(); + if (object.info !== undefined && object.info !== null) { + message.info = GroupPolicyInfo.fromAmino(object.info); + } + return message; + }, + toAmino(message: QueryGroupPolicyInfoResponse): QueryGroupPolicyInfoResponseAmino { + const obj: any = {}; + obj.info = message.info ? GroupPolicyInfo.toAmino(message.info) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPolicyInfoResponseAminoMsg): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPolicyInfoResponse): QueryGroupPolicyInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPolicyInfoResponse", + value: QueryGroupPolicyInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPolicyInfoResponseProtoMsg): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.decode(message.value); + }, + toProto(message: QueryGroupPolicyInfoResponse): Uint8Array { + return QueryGroupPolicyInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPolicyInfoResponse): QueryGroupPolicyInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", + value: QueryGroupPolicyInfoResponse.encode(message).finish() + }; } - }; - function createBaseQueryGroupMembersRequest(): QueryGroupMembersRequest { return { - groupId: Long.UZERO, + groupId: BigInt(0), pagination: undefined }; } - export const QueryGroupMembersRequest = { - encode(message: QueryGroupMembersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", + encode(message: QueryGroupMembersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupMembersRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupMembersRequest { + fromPartial(object: Partial): QueryGroupMembersRequest { const message = createBaseQueryGroupMembersRequest(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryGroupMembersRequestAmino): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupMembersRequestAminoMsg): QueryGroupMembersRequest { + return QueryGroupMembersRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupMembersRequest): QueryGroupMembersRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupMembersRequest", + value: QueryGroupMembersRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupMembersRequestProtoMsg): QueryGroupMembersRequest { + return QueryGroupMembersRequest.decode(message.value); + }, + toProto(message: QueryGroupMembersRequest): Uint8Array { + return QueryGroupMembersRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupMembersRequest): QueryGroupMembersRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", + value: QueryGroupMembersRequest.encode(message).finish() + }; } - }; - function createBaseQueryGroupMembersResponse(): QueryGroupMembersResponse { return { members: [], pagination: undefined }; } - export const QueryGroupMembersResponse = { - encode(message: QueryGroupMembersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", + encode(message: QueryGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.members) { GroupMember.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupMembersResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.members.push(GroupMember.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupMembersResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGroupMembersResponseAmino): QueryGroupMembersResponse { + const message = createBaseQueryGroupMembersResponse(); + message.members = object.members?.map(e => GroupMember.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupMembersResponse): QueryGroupMembersResponseAmino { + const obj: any = {}; + if (message.members) { + obj.members = message.members.map(e => e ? GroupMember.toAmino(e) : undefined); + } else { + obj.members = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupMembersResponseAminoMsg): QueryGroupMembersResponse { + return QueryGroupMembersResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupMembersResponse): QueryGroupMembersResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupMembersResponse", + value: QueryGroupMembersResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupMembersResponseProtoMsg): QueryGroupMembersResponse { + return QueryGroupMembersResponse.decode(message.value); + }, + toProto(message: QueryGroupMembersResponse): Uint8Array { + return QueryGroupMembersResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupMembersResponse): QueryGroupMembersResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", + value: QueryGroupMembersResponse.encode(message).finish() + }; } - }; - function createBaseQueryGroupsByAdminRequest(): QueryGroupsByAdminRequest { return { admin: "", pagination: undefined }; } - export const QueryGroupsByAdminRequest = { - encode(message: QueryGroupsByAdminRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", + encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByAdminRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.admin = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupsByAdminRequest { + fromPartial(object: Partial): QueryGroupsByAdminRequest { const message = createBaseQueryGroupsByAdminRequest(); message.admin = object.admin ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryGroupsByAdminRequestAmino): QueryGroupsByAdminRequest { + const message = createBaseQueryGroupsByAdminRequest(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsByAdminRequestAminoMsg): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsByAdminRequest", + value: QueryGroupsByAdminRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsByAdminRequestProtoMsg): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.decode(message.value); + }, + toProto(message: QueryGroupsByAdminRequest): Uint8Array { + return QueryGroupsByAdminRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", + value: QueryGroupsByAdminRequest.encode(message).finish() + }; } - }; - function createBaseQueryGroupsByAdminResponse(): QueryGroupsByAdminResponse { return { groups: [], pagination: undefined }; } - export const QueryGroupsByAdminResponse = { - encode(message: QueryGroupsByAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", + encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groups) { GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByAdminResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.groups.push(GroupInfo.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupsByAdminResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGroupsByAdminResponseAmino): QueryGroupsByAdminResponse { + const message = createBaseQueryGroupsByAdminResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsByAdminResponse): QueryGroupsByAdminResponseAmino { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); + } else { + obj.groups = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsByAdminResponseAminoMsg): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsByAdminResponse): QueryGroupsByAdminResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsByAdminResponse", + value: QueryGroupsByAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsByAdminResponseProtoMsg): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.decode(message.value); + }, + toProto(message: QueryGroupsByAdminResponse): Uint8Array { + return QueryGroupsByAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsByAdminResponse): QueryGroupsByAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", + value: QueryGroupsByAdminResponse.encode(message).finish() + }; } - }; - function createBaseQueryGroupPoliciesByGroupRequest(): QueryGroupPoliciesByGroupRequest { return { - groupId: Long.UZERO, + groupId: BigInt(0), pagination: undefined }; } - export const QueryGroupPoliciesByGroupRequest = { - encode(message: QueryGroupPoliciesByGroupRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", + encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupPoliciesByGroupRequest { + fromPartial(object: Partial): QueryGroupPoliciesByGroupRequest { const message = createBaseQueryGroupPoliciesByGroupRequest(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryGroupPoliciesByGroupRequestAmino): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPoliciesByGroupRequestAminoMsg): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPoliciesByGroupRequest", + value: QueryGroupPoliciesByGroupRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPoliciesByGroupRequestProtoMsg): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.decode(message.value); + }, + toProto(message: QueryGroupPoliciesByGroupRequest): Uint8Array { + return QueryGroupPoliciesByGroupRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", + value: QueryGroupPoliciesByGroupRequest.encode(message).finish() + }; } - }; - function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { return { groupPolicies: [], pagination: undefined }; } - export const QueryGroupPoliciesByGroupResponse = { - encode(message: QueryGroupPoliciesByGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", + encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groupPolicies) { GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupPoliciesByGroupResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGroupPoliciesByGroupResponseAmino): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.groupPolicies = object.group_policies?.map(e => GroupPolicyInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupPoliciesByGroupResponse): QueryGroupPoliciesByGroupResponseAmino { + const obj: any = {}; + if (message.groupPolicies) { + obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); + } else { + obj.group_policies = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPoliciesByGroupResponseAminoMsg): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPoliciesByGroupResponse): QueryGroupPoliciesByGroupResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPoliciesByGroupResponse", + value: QueryGroupPoliciesByGroupResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPoliciesByGroupResponseProtoMsg): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.decode(message.value); + }, + toProto(message: QueryGroupPoliciesByGroupResponse): Uint8Array { + return QueryGroupPoliciesByGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPoliciesByGroupResponse): QueryGroupPoliciesByGroupResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", + value: QueryGroupPoliciesByGroupResponse.encode(message).finish() + }; } - }; - function createBaseQueryGroupPoliciesByAdminRequest(): QueryGroupPoliciesByAdminRequest { return { admin: "", pagination: undefined }; } - export const QueryGroupPoliciesByAdminRequest = { - encode(message: QueryGroupPoliciesByAdminRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", + encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.admin = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupPoliciesByAdminRequest { + fromPartial(object: Partial): QueryGroupPoliciesByAdminRequest { const message = createBaseQueryGroupPoliciesByAdminRequest(); message.admin = object.admin ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryGroupPoliciesByAdminRequestAmino): QueryGroupPoliciesByAdminRequest { + const message = createBaseQueryGroupPoliciesByAdminRequest(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPoliciesByAdminRequestAminoMsg): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPoliciesByAdminRequest", + value: QueryGroupPoliciesByAdminRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPoliciesByAdminRequestProtoMsg): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.decode(message.value); + }, + toProto(message: QueryGroupPoliciesByAdminRequest): Uint8Array { + return QueryGroupPoliciesByAdminRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", + value: QueryGroupPoliciesByAdminRequest.encode(message).finish() + }; } - }; - function createBaseQueryGroupPoliciesByAdminResponse(): QueryGroupPoliciesByAdminResponse { return { groupPolicies: [], pagination: undefined }; } - export const QueryGroupPoliciesByAdminResponse = { - encode(message: QueryGroupPoliciesByAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", + encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groupPolicies) { GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupPoliciesByAdminResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGroupPoliciesByAdminResponseAmino): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.groupPolicies = object.group_policies?.map(e => GroupPolicyInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupPoliciesByAdminResponse): QueryGroupPoliciesByAdminResponseAmino { + const obj: any = {}; + if (message.groupPolicies) { + obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); + } else { + obj.group_policies = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPoliciesByAdminResponseAminoMsg): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPoliciesByAdminResponse): QueryGroupPoliciesByAdminResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPoliciesByAdminResponse", + value: QueryGroupPoliciesByAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPoliciesByAdminResponseProtoMsg): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.decode(message.value); + }, + toProto(message: QueryGroupPoliciesByAdminResponse): Uint8Array { + return QueryGroupPoliciesByAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPoliciesByAdminResponse): QueryGroupPoliciesByAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", + value: QueryGroupPoliciesByAdminResponse.encode(message).finish() + }; } - }; - function createBaseQueryProposalRequest(): QueryProposalRequest { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const QueryProposalRequest = { - encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.QueryProposalRequest", + encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalRequest { + fromPartial(object: Partial): QueryProposalRequest { const message = createBaseQueryProposalRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish() + }; } - }; - function createBaseQueryProposalResponse(): QueryProposalResponse { return { proposal: undefined }; } - export const QueryProposalResponse = { - encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryProposalResponse", + encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryProposalResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.proposal = Proposal.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalResponse { + fromPartial(object: Partial): QueryProposalResponse { const message = createBaseQueryProposalResponse(); message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + return message; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish() + }; } - }; - function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { return { address: "", pagination: undefined }; } - export const QueryProposalsByGroupPolicyRequest = { - encode(message: QueryProposalsByGroupPolicyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", + encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalsByGroupPolicyRequest { + fromPartial(object: Partial): QueryProposalsByGroupPolicyRequest { const message = createBaseQueryProposalsByGroupPolicyRequest(); message.address = object.address ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryProposalsByGroupPolicyRequestAmino): QueryProposalsByGroupPolicyRequest { + const message = createBaseQueryProposalsByGroupPolicyRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { + const obj: any = {}; + obj.address = message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsByGroupPolicyRequestAminoMsg): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsByGroupPolicyRequest", + value: QueryProposalsByGroupPolicyRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsByGroupPolicyRequestProtoMsg): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.decode(message.value); + }, + toProto(message: QueryProposalsByGroupPolicyRequest): Uint8Array { + return QueryProposalsByGroupPolicyRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", + value: QueryProposalsByGroupPolicyRequest.encode(message).finish() + }; } - }; - function createBaseQueryProposalsByGroupPolicyResponse(): QueryProposalsByGroupPolicyResponse { return { proposals: [], pagination: undefined }; } - export const QueryProposalsByGroupPolicyResponse = { - encode(message: QueryProposalsByGroupPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", + encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.proposals.push(Proposal.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryProposalsByGroupPolicyResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryProposalsByGroupPolicyResponseAmino): QueryProposalsByGroupPolicyResponse { + const message = createBaseQueryProposalsByGroupPolicyResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsByGroupPolicyResponse): QueryProposalsByGroupPolicyResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsByGroupPolicyResponseAminoMsg): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsByGroupPolicyResponse): QueryProposalsByGroupPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsByGroupPolicyResponse", + value: QueryProposalsByGroupPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsByGroupPolicyResponseProtoMsg): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.decode(message.value); + }, + toProto(message: QueryProposalsByGroupPolicyResponse): Uint8Array { + return QueryProposalsByGroupPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsByGroupPolicyResponse): QueryProposalsByGroupPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", + value: QueryProposalsByGroupPolicyResponse.encode(message).finish() + }; } - }; - function createBaseQueryVoteByProposalVoterRequest(): QueryVoteByProposalVoterRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "" }; } - export const QueryVoteByProposalVoterRequest = { - encode(message: QueryVoteByProposalVoterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", + encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVoteByProposalVoterRequest { + fromPartial(object: Partial): QueryVoteByProposalVoterRequest { const message = createBaseQueryVoteByProposalVoterRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; return message; + }, + fromAmino(object: QueryVoteByProposalVoterRequestAmino): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + return message; + }, + toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVoteByProposalVoterRequest", + value: QueryVoteByProposalVoterRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteByProposalVoterRequestProtoMsg): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.decode(message.value); + }, + toProto(message: QueryVoteByProposalVoterRequest): Uint8Array { + return QueryVoteByProposalVoterRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", + value: QueryVoteByProposalVoterRequest.encode(message).finish() + }; } - }; - function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { return { vote: undefined }; } - export const QueryVoteByProposalVoterResponse = { - encode(message: QueryVoteByProposalVoterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", + encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.vote = Vote.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVoteByProposalVoterResponse { + fromPartial(object: Partial): QueryVoteByProposalVoterResponse { const message = createBaseQueryVoteByProposalVoterResponse(); message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; return message; + }, + fromAmino(object: QueryVoteByProposalVoterResponseAmino): QueryVoteByProposalVoterResponse { + const message = createBaseQueryVoteByProposalVoterResponse(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + return message; + }, + toAmino(message: QueryVoteByProposalVoterResponse): QueryVoteByProposalVoterResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVoteByProposalVoterResponseAminoMsg): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteByProposalVoterResponse): QueryVoteByProposalVoterResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVoteByProposalVoterResponse", + value: QueryVoteByProposalVoterResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteByProposalVoterResponseProtoMsg): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.decode(message.value); + }, + toProto(message: QueryVoteByProposalVoterResponse): Uint8Array { + return QueryVoteByProposalVoterResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteByProposalVoterResponse): QueryVoteByProposalVoterResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", + value: QueryVoteByProposalVoterResponse.encode(message).finish() + }; } - }; - function createBaseQueryVotesByProposalRequest(): QueryVotesByProposalRequest { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), pagination: undefined }; } - export const QueryVotesByProposalRequest = { - encode(message: QueryVotesByProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", + encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesByProposalRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVotesByProposalRequest { + fromPartial(object: Partial): QueryVotesByProposalRequest { const message = createBaseQueryVotesByProposalRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryVotesByProposalRequestAmino): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesByProposalRequestAminoMsg): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVotesByProposalRequest", + value: QueryVotesByProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesByProposalRequestProtoMsg): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.decode(message.value); + }, + toProto(message: QueryVotesByProposalRequest): Uint8Array { + return QueryVotesByProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", + value: QueryVotesByProposalRequest.encode(message).finish() + }; } - }; - function createBaseQueryVotesByProposalResponse(): QueryVotesByProposalResponse { return { votes: [], pagination: undefined }; } - export const QueryVotesByProposalResponse = { - encode(message: QueryVotesByProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", + encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesByProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.votes.push(Vote.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVotesByProposalResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryVotesByProposalResponseAmino): QueryVotesByProposalResponse { + const message = createBaseQueryVotesByProposalResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesByProposalResponse): QueryVotesByProposalResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesByProposalResponseAminoMsg): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesByProposalResponse): QueryVotesByProposalResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVotesByProposalResponse", + value: QueryVotesByProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesByProposalResponseProtoMsg): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.decode(message.value); + }, + toProto(message: QueryVotesByProposalResponse): Uint8Array { + return QueryVotesByProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesByProposalResponse): QueryVotesByProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", + value: QueryVotesByProposalResponse.encode(message).finish() + }; } - }; - function createBaseQueryVotesByVoterRequest(): QueryVotesByVoterRequest { return { voter: "", pagination: undefined }; } - export const QueryVotesByVoterRequest = { - encode(message: QueryVotesByVoterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", + encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.voter !== "") { writer.uint32(10).string(message.voter); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesByVoterRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.voter = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVotesByVoterRequest { + fromPartial(object: Partial): QueryVotesByVoterRequest { const message = createBaseQueryVotesByVoterRequest(); message.voter = object.voter ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryVotesByVoterRequestAmino): QueryVotesByVoterRequest { + const message = createBaseQueryVotesByVoterRequest(); + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { + const obj: any = {}; + obj.voter = message.voter; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesByVoterRequestAminoMsg): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVotesByVoterRequest", + value: QueryVotesByVoterRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesByVoterRequestProtoMsg): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.decode(message.value); + }, + toProto(message: QueryVotesByVoterRequest): Uint8Array { + return QueryVotesByVoterRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", + value: QueryVotesByVoterRequest.encode(message).finish() + }; } - }; - function createBaseQueryVotesByVoterResponse(): QueryVotesByVoterResponse { return { votes: [], pagination: undefined }; } - export const QueryVotesByVoterResponse = { - encode(message: QueryVotesByVoterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", + encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesByVoterResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.votes.push(Vote.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryVotesByVoterResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryVotesByVoterResponseAmino): QueryVotesByVoterResponse { + const message = createBaseQueryVotesByVoterResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesByVoterResponse): QueryVotesByVoterResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesByVoterResponseAminoMsg): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesByVoterResponse): QueryVotesByVoterResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVotesByVoterResponse", + value: QueryVotesByVoterResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesByVoterResponseProtoMsg): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.decode(message.value); + }, + toProto(message: QueryVotesByVoterResponse): Uint8Array { + return QueryVotesByVoterResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesByVoterResponse): QueryVotesByVoterResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", + value: QueryVotesByVoterResponse.encode(message).finish() + }; } - }; - function createBaseQueryGroupsByMemberRequest(): QueryGroupsByMemberRequest { return { address: "", pagination: undefined }; } - export const QueryGroupsByMemberRequest = { - encode(message: QueryGroupsByMemberRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", + encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByMemberRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupsByMemberRequest { + fromPartial(object: Partial): QueryGroupsByMemberRequest { const message = createBaseQueryGroupsByMemberRequest(); message.address = object.address ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryGroupsByMemberRequestAmino): QueryGroupsByMemberRequest { + const message = createBaseQueryGroupsByMemberRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { + const obj: any = {}; + obj.address = message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsByMemberRequestAminoMsg): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsByMemberRequest", + value: QueryGroupsByMemberRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsByMemberRequestProtoMsg): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.decode(message.value); + }, + toProto(message: QueryGroupsByMemberRequest): Uint8Array { + return QueryGroupsByMemberRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", + value: QueryGroupsByMemberRequest.encode(message).finish() + }; } - }; - function createBaseQueryGroupsByMemberResponse(): QueryGroupsByMemberResponse { return { groups: [], pagination: undefined }; } - export const QueryGroupsByMemberResponse = { - encode(message: QueryGroupsByMemberResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", + encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groups) { GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByMemberResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.groups.push(GroupInfo.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryGroupsByMemberResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryGroupsByMemberResponseAmino): QueryGroupsByMemberResponse { + const message = createBaseQueryGroupsByMemberResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsByMemberResponse): QueryGroupsByMemberResponseAmino { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); + } else { + obj.groups = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsByMemberResponseAminoMsg): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsByMemberResponse): QueryGroupsByMemberResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsByMemberResponse", + value: QueryGroupsByMemberResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsByMemberResponseProtoMsg): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.decode(message.value); + }, + toProto(message: QueryGroupsByMemberResponse): Uint8Array { + return QueryGroupsByMemberResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsByMemberResponse): QueryGroupsByMemberResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", + value: QueryGroupsByMemberResponse.encode(message).finish() + }; } - }; - function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const QueryTallyResultRequest = { - encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", + encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTallyResultRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryTallyResultRequest { + fromPartial(object: Partial): QueryTallyResultRequest { const message = createBaseQueryTallyResultRequest(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultRequestProtoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish() + }; } - }; - function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { - tally: undefined + tally: TallyResult.fromPartial({}) }; } - export const QueryTallyResultResponse = { - encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.QueryTallyResultResponse", + encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTallyResultResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.tally = TallyResult.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryTallyResultResponse { + fromPartial(object: Partial): QueryTallyResultResponse { const message = createBaseQueryTallyResultResponse(); message.tally = object.tally !== undefined && object.tally !== null ? TallyResult.fromPartial(object.tally) : undefined; return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + if (object.tally !== undefined && object.tally !== null) { + message.tally = TallyResult.fromAmino(object.tally); + } + return message; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultResponseProtoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/tx.amino.ts b/src/codegen/cosmos/group/v1/tx.amino.ts index fac06b9..25e97c5 100644 --- a/src/codegen/cosmos/group/v1/tx.amino.ts +++ b/src/codegen/cosmos/group/v1/tx.amino.ts @@ -1,583 +1,73 @@ -import { voteOptionFromJSON } from "./types"; -import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; -import { execFromJSON, MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; -export interface AminoMsgCreateGroup extends AminoMsg { - type: "cosmos-sdk/MsgCreateGroup"; - value: { - admin: string; - members: { - address: string; - weight: string; - metadata: string; - added_at: { - seconds: string; - nanos: number; - }; - }[]; - metadata: string; - }; -} -export interface AminoMsgUpdateGroupMembers extends AminoMsg { - type: "cosmos-sdk/MsgUpdateGroupMembers"; - value: { - admin: string; - group_id: string; - member_updates: { - address: string; - weight: string; - metadata: string; - added_at: { - seconds: string; - nanos: number; - }; - }[]; - }; -} -export interface AminoMsgUpdateGroupAdmin extends AminoMsg { - type: "cosmos-sdk/MsgUpdateGroupAdmin"; - value: { - admin: string; - group_id: string; - new_admin: string; - }; -} -export interface AminoMsgUpdateGroupMetadata extends AminoMsg { - type: "cosmos-sdk/MsgUpdateGroupMetadata"; - value: { - admin: string; - group_id: string; - metadata: string; - }; -} -export interface AminoMsgCreateGroupPolicy extends AminoMsg { - type: "cosmos-sdk/MsgCreateGroupPolicy"; - value: { - admin: string; - group_id: string; - metadata: string; - decision_policy: { - type_url: string; - value: Uint8Array; - }; - }; -} -export interface AminoMsgCreateGroupWithPolicy extends AminoMsg { - type: "cosmos-sdk/MsgCreateGroupWithPolicy"; - value: { - admin: string; - members: { - address: string; - weight: string; - metadata: string; - added_at: { - seconds: string; - nanos: number; - }; - }[]; - group_metadata: string; - group_policy_metadata: string; - group_policy_as_admin: boolean; - decision_policy: { - type_url: string; - value: Uint8Array; - }; - }; -} -export interface AminoMsgUpdateGroupPolicyAdmin extends AminoMsg { - type: "cosmos-sdk/MsgUpdateGroupPolicyAdmin"; - value: { - admin: string; - address: string; - new_admin: string; - }; -} -export interface AminoMsgUpdateGroupPolicyDecisionPolicy extends AminoMsg { - type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy"; - value: { - admin: string; - address: string; - decision_policy: { - type_url: string; - value: Uint8Array; - }; - }; -} -export interface AminoMsgUpdateGroupPolicyMetadata extends AminoMsg { - type: "cosmos-sdk/MsgUpdateGroupPolicyMetadata"; - value: { - admin: string; - address: string; - metadata: string; - }; -} -export interface AminoMsgSubmitProposal extends AminoMsg { - type: "cosmos-sdk/group/MsgSubmitProposal"; - value: { - address: string; - proposers: string[]; - metadata: string; - messages: { - type_url: string; - value: Uint8Array; - }[]; - exec: number; - }; -} -export interface AminoMsgWithdrawProposal extends AminoMsg { - type: "cosmos-sdk/group/MsgWithdrawProposal"; - value: { - proposal_id: string; - address: string; - }; -} -export interface AminoMsgVote extends AminoMsg { - type: "cosmos-sdk/group/MsgVote"; - value: { - proposal_id: string; - voter: string; - option: number; - metadata: string; - exec: number; - }; -} -export interface AminoMsgExec extends AminoMsg { - type: "cosmos-sdk/group/MsgExec"; - value: { - proposal_id: string; - signer: string; - }; -} -export interface AminoMsgLeaveGroup extends AminoMsg { - type: "cosmos-sdk/group/MsgLeaveGroup"; - value: { - address: string; - group_id: string; - }; -} +import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; export const AminoConverter = { "/cosmos.group.v1.MsgCreateGroup": { aminoType: "cosmos-sdk/MsgCreateGroup", - toAmino: ({ - admin, - members, - metadata - }: MsgCreateGroup): AminoMsgCreateGroup["value"] => { - return { - admin, - members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, - added_at: el0.addedAt - })), - metadata - }; - }, - fromAmino: ({ - admin, - members, - metadata - }: AminoMsgCreateGroup["value"]): MsgCreateGroup => { - return { - admin, - members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, - addedAt: el0.added_at - })), - metadata - }; - } + toAmino: MsgCreateGroup.toAmino, + fromAmino: MsgCreateGroup.fromAmino }, "/cosmos.group.v1.MsgUpdateGroupMembers": { aminoType: "cosmos-sdk/MsgUpdateGroupMembers", - toAmino: ({ - admin, - groupId, - memberUpdates - }: MsgUpdateGroupMembers): AminoMsgUpdateGroupMembers["value"] => { - return { - admin, - group_id: groupId.toString(), - member_updates: memberUpdates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, - added_at: el0.addedAt - })) - }; - }, - fromAmino: ({ - admin, - group_id, - member_updates - }: AminoMsgUpdateGroupMembers["value"]): MsgUpdateGroupMembers => { - return { - admin, - groupId: Long.fromString(group_id), - memberUpdates: member_updates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, - addedAt: el0.added_at - })) - }; - } + toAmino: MsgUpdateGroupMembers.toAmino, + fromAmino: MsgUpdateGroupMembers.fromAmino }, "/cosmos.group.v1.MsgUpdateGroupAdmin": { aminoType: "cosmos-sdk/MsgUpdateGroupAdmin", - toAmino: ({ - admin, - groupId, - newAdmin - }: MsgUpdateGroupAdmin): AminoMsgUpdateGroupAdmin["value"] => { - return { - admin, - group_id: groupId.toString(), - new_admin: newAdmin - }; - }, - fromAmino: ({ - admin, - group_id, - new_admin - }: AminoMsgUpdateGroupAdmin["value"]): MsgUpdateGroupAdmin => { - return { - admin, - groupId: Long.fromString(group_id), - newAdmin: new_admin - }; - } + toAmino: MsgUpdateGroupAdmin.toAmino, + fromAmino: MsgUpdateGroupAdmin.fromAmino }, "/cosmos.group.v1.MsgUpdateGroupMetadata": { aminoType: "cosmos-sdk/MsgUpdateGroupMetadata", - toAmino: ({ - admin, - groupId, - metadata - }: MsgUpdateGroupMetadata): AminoMsgUpdateGroupMetadata["value"] => { - return { - admin, - group_id: groupId.toString(), - metadata - }; - }, - fromAmino: ({ - admin, - group_id, - metadata - }: AminoMsgUpdateGroupMetadata["value"]): MsgUpdateGroupMetadata => { - return { - admin, - groupId: Long.fromString(group_id), - metadata - }; - } + toAmino: MsgUpdateGroupMetadata.toAmino, + fromAmino: MsgUpdateGroupMetadata.fromAmino }, "/cosmos.group.v1.MsgCreateGroupPolicy": { aminoType: "cosmos-sdk/MsgCreateGroupPolicy", - toAmino: ({ - admin, - groupId, - metadata, - decisionPolicy - }: MsgCreateGroupPolicy): AminoMsgCreateGroupPolicy["value"] => { - return { - admin, - group_id: groupId.toString(), - metadata, - decision_policy: { - type_url: decisionPolicy.typeUrl, - value: decisionPolicy.value - } - }; - }, - fromAmino: ({ - admin, - group_id, - metadata, - decision_policy - }: AminoMsgCreateGroupPolicy["value"]): MsgCreateGroupPolicy => { - return { - admin, - groupId: Long.fromString(group_id), - metadata, - decisionPolicy: { - typeUrl: decision_policy.type_url, - value: decision_policy.value - } - }; - } + toAmino: MsgCreateGroupPolicy.toAmino, + fromAmino: MsgCreateGroupPolicy.fromAmino }, "/cosmos.group.v1.MsgCreateGroupWithPolicy": { aminoType: "cosmos-sdk/MsgCreateGroupWithPolicy", - toAmino: ({ - admin, - members, - groupMetadata, - groupPolicyMetadata, - groupPolicyAsAdmin, - decisionPolicy - }: MsgCreateGroupWithPolicy): AminoMsgCreateGroupWithPolicy["value"] => { - return { - admin, - members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, - added_at: el0.addedAt - })), - group_metadata: groupMetadata, - group_policy_metadata: groupPolicyMetadata, - group_policy_as_admin: groupPolicyAsAdmin, - decision_policy: { - type_url: decisionPolicy.typeUrl, - value: decisionPolicy.value - } - }; - }, - fromAmino: ({ - admin, - members, - group_metadata, - group_policy_metadata, - group_policy_as_admin, - decision_policy - }: AminoMsgCreateGroupWithPolicy["value"]): MsgCreateGroupWithPolicy => { - return { - admin, - members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, - addedAt: el0.added_at - })), - groupMetadata: group_metadata, - groupPolicyMetadata: group_policy_metadata, - groupPolicyAsAdmin: group_policy_as_admin, - decisionPolicy: { - typeUrl: decision_policy.type_url, - value: decision_policy.value - } - }; - } + toAmino: MsgCreateGroupWithPolicy.toAmino, + fromAmino: MsgCreateGroupWithPolicy.fromAmino }, "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin": { aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", - toAmino: ({ - admin, - address, - newAdmin - }: MsgUpdateGroupPolicyAdmin): AminoMsgUpdateGroupPolicyAdmin["value"] => { - return { - admin, - address, - new_admin: newAdmin - }; - }, - fromAmino: ({ - admin, - address, - new_admin - }: AminoMsgUpdateGroupPolicyAdmin["value"]): MsgUpdateGroupPolicyAdmin => { - return { - admin, - address, - newAdmin: new_admin - }; - } + toAmino: MsgUpdateGroupPolicyAdmin.toAmino, + fromAmino: MsgUpdateGroupPolicyAdmin.fromAmino }, "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy": { aminoType: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy", - toAmino: ({ - admin, - address, - decisionPolicy - }: MsgUpdateGroupPolicyDecisionPolicy): AminoMsgUpdateGroupPolicyDecisionPolicy["value"] => { - return { - admin, - address, - decision_policy: { - type_url: decisionPolicy.typeUrl, - value: decisionPolicy.value - } - }; - }, - fromAmino: ({ - admin, - address, - decision_policy - }: AminoMsgUpdateGroupPolicyDecisionPolicy["value"]): MsgUpdateGroupPolicyDecisionPolicy => { - return { - admin, - address, - decisionPolicy: { - typeUrl: decision_policy.type_url, - value: decision_policy.value - } - }; - } + toAmino: MsgUpdateGroupPolicyDecisionPolicy.toAmino, + fromAmino: MsgUpdateGroupPolicyDecisionPolicy.fromAmino }, "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata": { aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", - toAmino: ({ - admin, - address, - metadata - }: MsgUpdateGroupPolicyMetadata): AminoMsgUpdateGroupPolicyMetadata["value"] => { - return { - admin, - address, - metadata - }; - }, - fromAmino: ({ - admin, - address, - metadata - }: AminoMsgUpdateGroupPolicyMetadata["value"]): MsgUpdateGroupPolicyMetadata => { - return { - admin, - address, - metadata - }; - } + toAmino: MsgUpdateGroupPolicyMetadata.toAmino, + fromAmino: MsgUpdateGroupPolicyMetadata.fromAmino }, "/cosmos.group.v1.MsgSubmitProposal": { aminoType: "cosmos-sdk/group/MsgSubmitProposal", - toAmino: ({ - address, - proposers, - metadata, - messages, - exec - }: MsgSubmitProposal): AminoMsgSubmitProposal["value"] => { - return { - address, - proposers, - metadata, - messages: messages.map(el0 => ({ - type_url: el0.typeUrl, - value: el0.value - })), - exec - }; - }, - fromAmino: ({ - address, - proposers, - metadata, - messages, - exec - }: AminoMsgSubmitProposal["value"]): MsgSubmitProposal => { - return { - address, - proposers, - metadata, - messages: messages.map(el0 => ({ - typeUrl: el0.type_url, - value: el0.value - })), - exec: execFromJSON(exec) - }; - } + toAmino: MsgSubmitProposal.toAmino, + fromAmino: MsgSubmitProposal.fromAmino }, "/cosmos.group.v1.MsgWithdrawProposal": { aminoType: "cosmos-sdk/group/MsgWithdrawProposal", - toAmino: ({ - proposalId, - address - }: MsgWithdrawProposal): AminoMsgWithdrawProposal["value"] => { - return { - proposal_id: proposalId.toString(), - address - }; - }, - fromAmino: ({ - proposal_id, - address - }: AminoMsgWithdrawProposal["value"]): MsgWithdrawProposal => { - return { - proposalId: Long.fromString(proposal_id), - address - }; - } + toAmino: MsgWithdrawProposal.toAmino, + fromAmino: MsgWithdrawProposal.fromAmino }, "/cosmos.group.v1.MsgVote": { aminoType: "cosmos-sdk/group/MsgVote", - toAmino: ({ - proposalId, - voter, - option, - metadata, - exec - }: MsgVote): AminoMsgVote["value"] => { - return { - proposal_id: proposalId.toString(), - voter, - option, - metadata, - exec - }; - }, - fromAmino: ({ - proposal_id, - voter, - option, - metadata, - exec - }: AminoMsgVote["value"]): MsgVote => { - return { - proposalId: Long.fromString(proposal_id), - voter, - option: voteOptionFromJSON(option), - metadata, - exec: execFromJSON(exec) - }; - } + toAmino: MsgVote.toAmino, + fromAmino: MsgVote.fromAmino }, "/cosmos.group.v1.MsgExec": { aminoType: "cosmos-sdk/group/MsgExec", - toAmino: ({ - proposalId, - signer - }: MsgExec): AminoMsgExec["value"] => { - return { - proposal_id: proposalId.toString(), - signer - }; - }, - fromAmino: ({ - proposal_id, - signer - }: AminoMsgExec["value"]): MsgExec => { - return { - proposalId: Long.fromString(proposal_id), - signer - }; - } + toAmino: MsgExec.toAmino, + fromAmino: MsgExec.fromAmino }, "/cosmos.group.v1.MsgLeaveGroup": { aminoType: "cosmos-sdk/group/MsgLeaveGroup", - toAmino: ({ - address, - groupId - }: MsgLeaveGroup): AminoMsgLeaveGroup["value"] => { - return { - address, - group_id: groupId.toString() - }; - }, - fromAmino: ({ - address, - group_id - }: AminoMsgLeaveGroup["value"]): MsgLeaveGroup => { - return { - address, - groupId: Long.fromString(group_id) - }; - } + toAmino: MsgLeaveGroup.toAmino, + fromAmino: MsgLeaveGroup.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/tx.registry.ts b/src/codegen/cosmos/group/v1/tx.registry.ts index 3441045..e200020 100644 --- a/src/codegen/cosmos/group/v1/tx.registry.ts +++ b/src/codegen/cosmos/group/v1/tx.registry.ts @@ -14,98 +14,84 @@ export const MessageComposer = { value: MsgCreateGroup.encode(value).finish() }; }, - updateGroupMembers(value: MsgUpdateGroupMembers) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", value: MsgUpdateGroupMembers.encode(value).finish() }; }, - updateGroupAdmin(value: MsgUpdateGroupAdmin) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", value: MsgUpdateGroupAdmin.encode(value).finish() }; }, - updateGroupMetadata(value: MsgUpdateGroupMetadata) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", value: MsgUpdateGroupMetadata.encode(value).finish() }; }, - createGroupPolicy(value: MsgCreateGroupPolicy) { return { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", value: MsgCreateGroupPolicy.encode(value).finish() }; }, - createGroupWithPolicy(value: MsgCreateGroupWithPolicy) { return { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", value: MsgCreateGroupWithPolicy.encode(value).finish() }; }, - updateGroupPolicyAdmin(value: MsgUpdateGroupPolicyAdmin) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", value: MsgUpdateGroupPolicyAdmin.encode(value).finish() }; }, - updateGroupPolicyDecisionPolicy(value: MsgUpdateGroupPolicyDecisionPolicy) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", value: MsgUpdateGroupPolicyDecisionPolicy.encode(value).finish() }; }, - updateGroupPolicyMetadata(value: MsgUpdateGroupPolicyMetadata) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", value: MsgUpdateGroupPolicyMetadata.encode(value).finish() }; }, - submitProposal(value: MsgSubmitProposal) { return { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", value: MsgSubmitProposal.encode(value).finish() }; }, - withdrawProposal(value: MsgWithdrawProposal) { return { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", value: MsgWithdrawProposal.encode(value).finish() }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.group.v1.MsgVote", value: MsgVote.encode(value).finish() }; }, - exec(value: MsgExec) { return { typeUrl: "/cosmos.group.v1.MsgExec", value: MsgExec.encode(value).finish() }; }, - leaveGroup(value: MsgLeaveGroup) { return { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", value: MsgLeaveGroup.encode(value).finish() }; } - }, withTypeUrl: { createGroup(value: MsgCreateGroup) { @@ -114,98 +100,84 @@ export const MessageComposer = { value }; }, - updateGroupMembers(value: MsgUpdateGroupMembers) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", value }; }, - updateGroupAdmin(value: MsgUpdateGroupAdmin) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", value }; }, - updateGroupMetadata(value: MsgUpdateGroupMetadata) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", value }; }, - createGroupPolicy(value: MsgCreateGroupPolicy) { return { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", value }; }, - createGroupWithPolicy(value: MsgCreateGroupWithPolicy) { return { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", value }; }, - updateGroupPolicyAdmin(value: MsgUpdateGroupPolicyAdmin) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", value }; }, - updateGroupPolicyDecisionPolicy(value: MsgUpdateGroupPolicyDecisionPolicy) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", value }; }, - updateGroupPolicyMetadata(value: MsgUpdateGroupPolicyMetadata) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", value }; }, - submitProposal(value: MsgSubmitProposal) { return { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", value }; }, - withdrawProposal(value: MsgWithdrawProposal) { return { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", value }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.group.v1.MsgVote", value }; }, - exec(value: MsgExec) { return { typeUrl: "/cosmos.group.v1.MsgExec", value }; }, - leaveGroup(value: MsgLeaveGroup) { return { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", value }; } - }, fromPartial: { createGroup(value: MsgCreateGroup) { @@ -214,97 +186,83 @@ export const MessageComposer = { value: MsgCreateGroup.fromPartial(value) }; }, - updateGroupMembers(value: MsgUpdateGroupMembers) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", value: MsgUpdateGroupMembers.fromPartial(value) }; }, - updateGroupAdmin(value: MsgUpdateGroupAdmin) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", value: MsgUpdateGroupAdmin.fromPartial(value) }; }, - updateGroupMetadata(value: MsgUpdateGroupMetadata) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", value: MsgUpdateGroupMetadata.fromPartial(value) }; }, - createGroupPolicy(value: MsgCreateGroupPolicy) { return { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", value: MsgCreateGroupPolicy.fromPartial(value) }; }, - createGroupWithPolicy(value: MsgCreateGroupWithPolicy) { return { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", value: MsgCreateGroupWithPolicy.fromPartial(value) }; }, - updateGroupPolicyAdmin(value: MsgUpdateGroupPolicyAdmin) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", value: MsgUpdateGroupPolicyAdmin.fromPartial(value) }; }, - updateGroupPolicyDecisionPolicy(value: MsgUpdateGroupPolicyDecisionPolicy) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", value: MsgUpdateGroupPolicyDecisionPolicy.fromPartial(value) }; }, - updateGroupPolicyMetadata(value: MsgUpdateGroupPolicyMetadata) { return { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", value: MsgUpdateGroupPolicyMetadata.fromPartial(value) }; }, - submitProposal(value: MsgSubmitProposal) { return { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial(value) }; }, - withdrawProposal(value: MsgWithdrawProposal) { return { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", value: MsgWithdrawProposal.fromPartial(value) }; }, - vote(value: MsgVote) { return { typeUrl: "/cosmos.group.v1.MsgVote", value: MsgVote.fromPartial(value) }; }, - exec(value: MsgExec) { return { typeUrl: "/cosmos.group.v1.MsgExec", value: MsgExec.fromPartial(value) }; }, - leaveGroup(value: MsgLeaveGroup) { return { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", value: MsgLeaveGroup.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/tx.rpc.msg.ts b/src/codegen/cosmos/group/v1/tx.rpc.msg.ts index b921d00..e6c8ed8 100644 --- a/src/codegen/cosmos/group/v1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/group/v1/tx.rpc.msg.ts @@ -1,54 +1,39 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgCreateGroup, MsgCreateGroupResponse, MsgUpdateGroupMembers, MsgUpdateGroupMembersResponse, MsgUpdateGroupAdmin, MsgUpdateGroupAdminResponse, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataResponse, MsgCreateGroupPolicy, MsgCreateGroupPolicyResponse, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicyResponse, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataResponse, MsgSubmitProposal, MsgSubmitProposalResponse, MsgWithdrawProposal, MsgWithdrawProposalResponse, MsgVote, MsgVoteResponse, MsgExec, MsgExecResponse, MsgLeaveGroup, MsgLeaveGroupResponse } from "./tx"; /** Msg is the cosmos.group.v1 Msg service. */ - export interface Msg { /** CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. */ createGroup(request: MsgCreateGroup): Promise; /** UpdateGroupMembers updates the group members with given group id and admin address. */ - updateGroupMembers(request: MsgUpdateGroupMembers): Promise; /** UpdateGroupAdmin updates the group admin with given group id and previous admin address. */ - updateGroupAdmin(request: MsgUpdateGroupAdmin): Promise; /** UpdateGroupMetadata updates the group metadata with given group id and admin address. */ - updateGroupMetadata(request: MsgUpdateGroupMetadata): Promise; /** CreateGroupPolicy creates a new group policy using given DecisionPolicy. */ - createGroupPolicy(request: MsgCreateGroupPolicy): Promise; /** CreateGroupWithPolicy creates a new group with policy. */ - createGroupWithPolicy(request: MsgCreateGroupWithPolicy): Promise; /** UpdateGroupPolicyAdmin updates a group policy admin. */ - updateGroupPolicyAdmin(request: MsgUpdateGroupPolicyAdmin): Promise; /** UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. */ - updateGroupPolicyDecisionPolicy(request: MsgUpdateGroupPolicyDecisionPolicy): Promise; /** UpdateGroupPolicyMetadata updates a group policy metadata. */ - updateGroupPolicyMetadata(request: MsgUpdateGroupPolicyMetadata): Promise; /** SubmitProposal submits a new proposal. */ - submitProposal(request: MsgSubmitProposal): Promise; /** WithdrawProposal aborts a proposal. */ - withdrawProposal(request: MsgWithdrawProposal): Promise; /** Vote allows a voter to vote on a proposal. */ - vote(request: MsgVote): Promise; /** Exec executes a proposal. */ - exec(request: MsgExec): Promise; /** LeaveGroup allows a group member to leave the group. */ - leaveGroup(request: MsgLeaveGroup): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.createGroup = this.createGroup.bind(this); @@ -66,89 +51,74 @@ export class MsgClientImpl implements Msg { 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("cosmos.group.v1.Msg", "CreateGroup", data); - return promise.then(data => MsgCreateGroupResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "UpdateGroupMembers", data); - return promise.then(data => MsgUpdateGroupMembersResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "UpdateGroupAdmin", data); - return promise.then(data => MsgUpdateGroupAdminResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "UpdateGroupMetadata", data); - return promise.then(data => MsgUpdateGroupMetadataResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "CreateGroupPolicy", data); - return promise.then(data => MsgCreateGroupPolicyResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "CreateGroupWithPolicy", data); - return promise.then(data => MsgCreateGroupWithPolicyResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "UpdateGroupPolicyAdmin", data); - return promise.then(data => MsgUpdateGroupPolicyAdminResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "UpdateGroupPolicyDecisionPolicy", data); - return promise.then(data => MsgUpdateGroupPolicyDecisionPolicyResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "UpdateGroupPolicyMetadata", data); - return promise.then(data => MsgUpdateGroupPolicyMetadataResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "SubmitProposal", data); - return promise.then(data => MsgSubmitProposalResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "WithdrawProposal", data); - return promise.then(data => MsgWithdrawProposalResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "Vote", data); - return promise.then(data => MsgVoteResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "Exec", data); - return promise.then(data => MsgExecResponse.decode(new _m0.Reader(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("cosmos.group.v1.Msg", "LeaveGroup", data); - return promise.then(data => MsgLeaveGroupResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgLeaveGroupResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/tx.ts b/src/codegen/cosmos/group/v1/tx.ts index 8b06afd..6a0b80f 100644 --- a/src/codegen/cosmos/group/v1/tx.ts +++ b/src/codegen/cosmos/group/v1/tx.ts @@ -1,34 +1,13 @@ -import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Member, MemberAmino, MemberSDKType, VoteOption, voteOptionFromJSON, voteOptionToJSON } from "./types"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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, -} -/** Exec defines modes of execution of a proposal on creation or on new vote. */ - -export enum ExecSDKType { - /** - * 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, @@ -38,16 +17,16 @@ export enum ExecSDKType { EXEC_TRY = 1, UNRECOGNIZED = -1, } +export const ExecSDKType = Exec; +export const ExecAmino = Exec; export function execFromJSON(object: any): Exec { switch (object) { case 0: case "EXEC_UNSPECIFIED": return Exec.EXEC_UNSPECIFIED; - case 1: case "EXEC_TRY": return Exec.EXEC_TRY; - case -1: case "UNRECOGNIZED": default: @@ -58,341 +37,483 @@ export function execToJSON(object: Exec): string { switch (object) { case Exec.EXEC_UNSPECIFIED: return "EXEC_UNSPECIFIED"; - case Exec.EXEC_TRY: return "EXEC_TRY"; - case Exec.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** MsgCreateGroup is the Msg/CreateGroup request type. */ - export interface MsgCreateGroup { /** admin is the account address of the group admin. */ admin: string; /** members defines the group members. */ - members: Member[]; /** metadata is any arbitrary metadata to attached to the group. */ - metadata: string; } +export interface MsgCreateGroupProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroup"; + value: Uint8Array; +} /** MsgCreateGroup is the Msg/CreateGroup request type. */ - -export interface MsgCreateGroupSDKType { +export interface MsgCreateGroupAmino { /** admin is the account address of the group admin. */ - admin: string; + admin?: string; /** members defines the group members. */ - - members: MemberSDKType[]; + members?: MemberAmino[]; /** metadata is any arbitrary metadata to attached to the group. */ - + metadata?: string; +} +export interface MsgCreateGroupAminoMsg { + type: "cosmos-sdk/MsgCreateGroup"; + value: MsgCreateGroupAmino; +} +/** MsgCreateGroup is the Msg/CreateGroup request type. */ +export interface MsgCreateGroupSDKType { + admin: string; + members: MemberSDKType[]; metadata: string; } /** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ - export interface MsgCreateGroupResponse { /** group_id is the unique ID of the newly created group. */ - groupId: Long; + groupId: bigint; +} +export interface MsgCreateGroupResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse"; + value: Uint8Array; } /** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ - -export interface MsgCreateGroupResponseSDKType { +export interface MsgCreateGroupResponseAmino { /** group_id is the unique ID of the newly created group. */ - group_id: Long; + group_id?: string; +} +export interface MsgCreateGroupResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupResponse"; + value: MsgCreateGroupResponseAmino; +} +/** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ +export interface MsgCreateGroupResponseSDKType { + group_id: bigint; } /** 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: Long; + groupId: bigint; /** * member_updates is the list of members to update, * set weight to 0 to remove a member. */ - memberUpdates: Member[]; } +export interface MsgUpdateGroupMembersProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers"; + value: Uint8Array; +} /** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ - -export interface MsgUpdateGroupMembersSDKType { +export interface MsgUpdateGroupMembersAmino { /** admin is the account address of the group admin. */ - admin: string; + admin?: string; /** group_id is the unique ID of the group. */ - - group_id: Long; + group_id?: string; /** * member_updates is the list of members to update, * set weight to 0 to remove a member. */ - + member_updates?: MemberAmino[]; +} +export interface MsgUpdateGroupMembersAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMembers"; + value: MsgUpdateGroupMembersAmino; +} +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembersSDKType { + admin: string; + group_id: bigint; member_updates: MemberSDKType[]; } /** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ - export interface MsgUpdateGroupMembersResponse {} +export interface MsgUpdateGroupMembersResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ +export interface MsgUpdateGroupMembersResponseAmino {} +export interface MsgUpdateGroupMembersResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMembersResponse"; + value: MsgUpdateGroupMembersResponseAmino; +} /** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ - export interface MsgUpdateGroupMembersResponseSDKType {} /** 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: Long; + groupId: bigint; /** new_admin is the group new admin account address. */ - newAdmin: string; } +export interface MsgUpdateGroupAdminProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin"; + value: Uint8Array; +} /** MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type. */ - -export interface MsgUpdateGroupAdminSDKType { +export interface MsgUpdateGroupAdminAmino { /** admin is the current account address of the group admin. */ - admin: string; + admin?: string; /** group_id is the unique ID of the group. */ - - group_id: Long; + group_id?: string; /** new_admin is the group new admin account address. */ - + new_admin?: string; +} +export interface MsgUpdateGroupAdminAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupAdmin"; + value: MsgUpdateGroupAdminAmino; +} +/** MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type. */ +export interface MsgUpdateGroupAdminSDKType { + admin: string; + group_id: bigint; new_admin: string; } /** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ - export interface MsgUpdateGroupAdminResponse {} +export interface MsgUpdateGroupAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ +export interface MsgUpdateGroupAdminResponseAmino {} +export interface MsgUpdateGroupAdminResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupAdminResponse"; + value: MsgUpdateGroupAdminResponseAmino; +} /** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ - export interface MsgUpdateGroupAdminResponseSDKType {} /** 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: Long; + groupId: bigint; /** metadata is the updated group's metadata. */ - metadata: string; } +export interface MsgUpdateGroupMetadataProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata"; + value: Uint8Array; +} /** MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type. */ - -export interface MsgUpdateGroupMetadataSDKType { +export interface MsgUpdateGroupMetadataAmino { /** admin is the account address of the group admin. */ - admin: string; + admin?: string; /** group_id is the unique ID of the group. */ - - group_id: Long; + group_id?: string; /** metadata is the updated group's metadata. */ - + metadata?: string; +} +export interface MsgUpdateGroupMetadataAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMetadata"; + value: MsgUpdateGroupMetadataAmino; +} +/** MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type. */ +export interface MsgUpdateGroupMetadataSDKType { + admin: string; + group_id: bigint; metadata: string; } /** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ - export interface MsgUpdateGroupMetadataResponse {} +export interface MsgUpdateGroupMetadataResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ +export interface MsgUpdateGroupMetadataResponseAmino {} +export interface MsgUpdateGroupMetadataResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMetadataResponse"; + value: MsgUpdateGroupMetadataResponseAmino; +} /** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ - export interface MsgUpdateGroupMetadataResponseSDKType {} /** 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: Long; + groupId: bigint; /** metadata is any arbitrary metadata attached to the group policy. */ - metadata: string; /** decision_policy specifies the group policy's decision policy. */ - decisionPolicy?: Any; } +export interface MsgCreateGroupPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy"; + value: Uint8Array; +} /** MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type. */ - -export interface MsgCreateGroupPolicySDKType { +export interface MsgCreateGroupPolicyAmino { /** admin is the account address of the group admin. */ - admin: string; + admin?: string; /** group_id is the unique ID of the group. */ - - group_id: Long; + group_id?: string; /** metadata is any arbitrary metadata attached to the group policy. */ - - metadata: string; + metadata?: string; /** decision_policy specifies the group policy's decision policy. */ - + decision_policy?: AnyAmino; +} +export interface MsgCreateGroupPolicyAminoMsg { + type: "cosmos-sdk/MsgCreateGroupPolicy"; + value: MsgCreateGroupPolicyAmino; +} +/** MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type. */ +export interface MsgCreateGroupPolicySDKType { + admin: string; + group_id: bigint; + metadata: string; decision_policy?: AnySDKType; } /** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ - export interface MsgCreateGroupPolicyResponse { /** address is the account address of the newly created group policy. */ address: string; } +export interface MsgCreateGroupPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse"; + value: Uint8Array; +} /** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ - -export interface MsgCreateGroupPolicyResponseSDKType { +export interface MsgCreateGroupPolicyResponseAmino { /** address is the account address of the newly created group policy. */ + address?: string; +} +export interface MsgCreateGroupPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupPolicyResponse"; + value: MsgCreateGroupPolicyResponseAmino; +} +/** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ +export interface MsgCreateGroupPolicyResponseSDKType { address: string; } /** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ - export interface MsgUpdateGroupPolicyAdmin { /** admin is the account address of the group admin. */ admin: string; /** address is the account address of the group policy. */ - address: string; /** new_admin is the new group policy admin. */ - newAdmin: string; } +export interface MsgUpdateGroupPolicyAdminProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin"; + value: Uint8Array; +} /** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ - -export interface MsgUpdateGroupPolicyAdminSDKType { +export interface MsgUpdateGroupPolicyAdminAmino { /** admin is the account address of the group admin. */ - admin: string; + admin?: string; /** address is the account address of the group policy. */ - - address: string; + address?: string; /** new_admin is the new group policy admin. */ - + new_admin?: string; +} +export interface MsgUpdateGroupPolicyAdminAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdmin"; + value: MsgUpdateGroupPolicyAdminAmino; +} +/** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ +export interface MsgUpdateGroupPolicyAdminSDKType { + admin: string; + address: string; new_admin: string; } /** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ - export interface MsgCreateGroupWithPolicy { /** admin is the account address of the group and group policy admin. */ admin: string; /** members defines the group members. */ - members: Member[]; /** group_metadata is any arbitrary metadata attached to the group. */ - 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; } +export interface MsgCreateGroupWithPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy"; + value: Uint8Array; +} /** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ - -export interface MsgCreateGroupWithPolicySDKType { +export interface MsgCreateGroupWithPolicyAmino { /** admin is the account address of the group and group policy admin. */ - admin: string; + admin?: string; /** members defines the group members. */ - - members: MemberSDKType[]; + members?: MemberAmino[]; /** group_metadata is any arbitrary metadata attached to the group. */ - - group_metadata: string; + group_metadata?: string; /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ - - group_policy_metadata: string; + group_policy_metadata?: string; /** group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group and group policy admin. */ - - group_policy_as_admin: boolean; + group_policy_as_admin?: boolean; /** decision_policy specifies the group policy's decision policy. */ - + decision_policy?: AnyAmino; +} +export interface MsgCreateGroupWithPolicyAminoMsg { + type: "cosmos-sdk/MsgCreateGroupWithPolicy"; + value: MsgCreateGroupWithPolicyAmino; +} +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicySDKType { + admin: string; + members: MemberSDKType[]; + group_metadata: string; + group_policy_metadata: string; + group_policy_as_admin: boolean; decision_policy?: AnySDKType; } /** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ - export interface MsgCreateGroupWithPolicyResponse { /** group_id is the unique ID of the newly created group with policy. */ - groupId: Long; + groupId: bigint; /** group_policy_address is the account address of the newly created group policy. */ - groupPolicyAddress: string; } +export interface MsgCreateGroupWithPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse"; + value: Uint8Array; +} /** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ - -export interface MsgCreateGroupWithPolicyResponseSDKType { +export interface MsgCreateGroupWithPolicyResponseAmino { /** group_id is the unique ID of the newly created group with policy. */ - group_id: Long; + group_id?: string; /** group_policy_address is the account address of the newly created group policy. */ - + group_policy_address?: string; +} +export interface MsgCreateGroupWithPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupWithPolicyResponse"; + value: MsgCreateGroupWithPolicyResponseAmino; +} +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponseSDKType { + group_id: bigint; group_policy_address: string; } /** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ - export interface MsgUpdateGroupPolicyAdminResponse {} +export interface MsgUpdateGroupPolicyAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponseAmino {} +export interface MsgUpdateGroupPolicyAdminResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse"; + value: MsgUpdateGroupPolicyAdminResponseAmino; +} /** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ - export interface MsgUpdateGroupPolicyAdminResponseSDKType {} /** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ - export interface MsgUpdateGroupPolicyDecisionPolicy { /** admin is the account address of the group admin. */ admin: string; /** address is the account address of group policy. */ - address: string; /** decision_policy is the updated group policy's decision policy. */ - decisionPolicy?: Any; } +export interface MsgUpdateGroupPolicyDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy"; + value: Uint8Array; +} /** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ - -export interface MsgUpdateGroupPolicyDecisionPolicySDKType { +export interface MsgUpdateGroupPolicyDecisionPolicyAmino { /** admin is the account address of the group admin. */ - admin: string; + admin?: string; /** address is the account address of group policy. */ - - address: string; + address?: string; /** decision_policy is the updated group policy's decision policy. */ - + decision_policy?: AnyAmino; +} +export interface MsgUpdateGroupPolicyDecisionPolicyAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy"; + value: MsgUpdateGroupPolicyDecisionPolicyAmino; +} +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicySDKType { + admin: string; + address: string; decision_policy?: AnySDKType; } /** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ - export interface MsgUpdateGroupPolicyDecisionPolicyResponse {} +export interface MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyResponseAmino {} +export interface MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse"; + value: MsgUpdateGroupPolicyDecisionPolicyResponseAmino; +} /** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ - export interface MsgUpdateGroupPolicyDecisionPolicyResponseSDKType {} /** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ - export interface MsgUpdateGroupPolicyMetadata { /** admin is the account address of the group admin. */ admin: string; /** address is the account address of group policy. */ - address: string; /** metadata is the updated group policy metadata. */ - metadata: string; } +export interface MsgUpdateGroupPolicyMetadataProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata"; + value: Uint8Array; +} /** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ - -export interface MsgUpdateGroupPolicyMetadataSDKType { +export interface MsgUpdateGroupPolicyMetadataAmino { /** admin is the account address of the group admin. */ - admin: string; + admin?: string; /** address is the account address of group policy. */ - - address: string; + address?: string; /** metadata is the updated group policy metadata. */ - + metadata?: string; +} +export interface MsgUpdateGroupPolicyMetadataAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadata"; + value: MsgUpdateGroupPolicyMetadataAmino; +} +/** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ +export interface MsgUpdateGroupPolicyMetadataSDKType { + admin: string; + address: string; metadata: string; } /** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ - export interface MsgUpdateGroupPolicyMetadataResponse {} +export interface MsgUpdateGroupPolicyMetadataResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponseAmino {} +export interface MsgUpdateGroupPolicyMetadataResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse"; + value: MsgUpdateGroupPolicyMetadataResponseAmino; +} /** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ - export interface MsgUpdateGroupPolicyMetadataResponseSDKType {} /** MsgSubmitProposal is the Msg/SubmitProposal request type. */ - export interface MsgSubmitProposal { /** address is the account address of group policy. */ address: string; @@ -400,180 +521,261 @@ export interface MsgSubmitProposal { * proposers are the account addresses of the proposers. * Proposers signatures will be counted as yes votes. */ - proposers: string[]; /** metadata is any arbitrary metadata to attached to the proposal. */ - metadata: string; /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ - messages: Any[]; /** * exec defines the mode of execution of the proposal, * whether it should be executed immediately on creation or not. * If so, proposers signatures are considered as Yes votes. */ - exec: Exec; } +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal"; + value: Uint8Array; +} /** MsgSubmitProposal is the Msg/SubmitProposal request type. */ - -export interface MsgSubmitProposalSDKType { +export interface MsgSubmitProposalAmino { /** address is the account address of group policy. */ - address: string; + address?: string; /** * proposers are the account addresses of the proposers. * Proposers signatures will be counted as yes votes. */ - - proposers: string[]; + proposers?: string[]; /** metadata is any arbitrary metadata to attached to the proposal. */ - - metadata: string; + metadata?: string; /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ - - messages: AnySDKType[]; + messages?: AnyAmino[]; /** * exec defines the mode of execution of the proposal, * whether it should be executed immediately on creation or not. * If so, proposers signatures are considered as Yes votes. */ - - exec: ExecSDKType; + exec?: Exec; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/group/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposalSDKType { + address: string; + proposers: string[]; + metadata: string; + messages: AnySDKType[]; + exec: Exec; } /** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ - export interface MsgSubmitProposalResponse { /** proposal is the unique ID of the proposal. */ - proposalId: Long; + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse"; + value: Uint8Array; } /** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ - -export interface MsgSubmitProposalResponseSDKType { +export interface MsgSubmitProposalResponseAmino { /** proposal is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id?: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseSDKType { + proposal_id: bigint; } /** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ - export interface MsgWithdrawProposal { /** proposal is the unique ID of the proposal. */ - proposalId: Long; + proposalId: bigint; /** address is the admin of the group policy or one of the proposer of the proposal. */ - address: string; } +export interface MsgWithdrawProposalProtoMsg { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal"; + value: Uint8Array; +} /** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ - -export interface MsgWithdrawProposalSDKType { +export interface MsgWithdrawProposalAmino { /** proposal is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** address is the admin of the group policy or one of the proposer of the proposal. */ - + address?: string; +} +export interface MsgWithdrawProposalAminoMsg { + type: "cosmos-sdk/group/MsgWithdrawProposal"; + value: MsgWithdrawProposalAmino; +} +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposalSDKType { + proposal_id: bigint; address: string; } /** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ - export interface MsgWithdrawProposalResponse {} +export interface MsgWithdrawProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse"; + value: Uint8Array; +} +/** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ +export interface MsgWithdrawProposalResponseAmino {} +export interface MsgWithdrawProposalResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawProposalResponse"; + value: MsgWithdrawProposalResponseAmino; +} /** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ - export interface MsgWithdrawProposalResponseSDKType {} /** MsgVote is the Msg/Vote request type. */ - export interface MsgVote { /** proposal is the unique ID of the proposal. */ - proposalId: Long; + proposalId: bigint; /** voter is the voter account address. */ - voter: string; /** option is the voter's choice on the proposal. */ - option: VoteOption; /** metadata is any arbitrary metadata to attached to the vote. */ - metadata: string; /** * exec defines whether the proposal should be executed * immediately after voting or not. */ - exec: Exec; } +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.group.v1.MsgVote"; + value: Uint8Array; +} /** MsgVote is the Msg/Vote request type. */ - -export interface MsgVoteSDKType { +export interface MsgVoteAmino { /** proposal is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** voter is the voter account address. */ - - voter: string; + voter?: string; /** option is the voter's choice on the proposal. */ - - option: VoteOptionSDKType; + option?: VoteOption; /** metadata is any arbitrary metadata to attached to the vote. */ - - metadata: string; + metadata?: string; /** * exec defines whether the proposal should be executed * immediately after voting or not. */ - - exec: ExecSDKType; + exec?: Exec; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/group/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVote is the Msg/Vote request type. */ +export interface MsgVoteSDKType { + proposal_id: bigint; + voter: string; + option: VoteOption; + metadata: string; + exec: Exec; } /** MsgVoteResponse is the Msg/Vote response type. */ - export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse is the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} /** MsgVoteResponse is the Msg/Vote response type. */ - export interface MsgVoteResponseSDKType {} /** MsgExec is the Msg/Exec request type. */ - export interface MsgExec { /** proposal is the unique ID of the proposal. */ - proposalId: Long; + proposalId: bigint; /** signer is the account address used to execute the proposal. */ - signer: string; } +export interface MsgExecProtoMsg { + typeUrl: "/cosmos.group.v1.MsgExec"; + value: Uint8Array; +} /** MsgExec is the Msg/Exec request type. */ - -export interface MsgExecSDKType { +export interface MsgExecAmino { /** proposal is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** signer is the account address used to execute the proposal. */ - + signer?: string; +} +export interface MsgExecAminoMsg { + type: "cosmos-sdk/group/MsgExec"; + value: MsgExecAmino; +} +/** MsgExec is the Msg/Exec request type. */ +export interface MsgExecSDKType { + proposal_id: bigint; signer: string; } /** MsgExecResponse is the Msg/Exec request type. */ - export interface MsgExecResponse {} +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgExecResponse"; + value: Uint8Array; +} +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponseAmino {} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} /** MsgExecResponse is the Msg/Exec request type. */ - export interface MsgExecResponseSDKType {} /** 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: Long; + groupId: bigint; +} +export interface MsgLeaveGroupProtoMsg { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup"; + value: Uint8Array; } /** MsgLeaveGroup is the Msg/LeaveGroup request type. */ - -export interface MsgLeaveGroupSDKType { +export interface MsgLeaveGroupAmino { /** address is the account address of the group member. */ - address: string; + address?: string; /** group_id is the unique ID of the group. */ - - group_id: Long; + group_id?: string; +} +export interface MsgLeaveGroupAminoMsg { + type: "cosmos-sdk/group/MsgLeaveGroup"; + value: MsgLeaveGroupAmino; +} +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroupSDKType { + address: string; + group_id: bigint; } /** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ - export interface MsgLeaveGroupResponse {} +export interface MsgLeaveGroupResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse"; + value: Uint8Array; +} +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponseAmino {} +export interface MsgLeaveGroupResponseAminoMsg { + type: "cosmos-sdk/MsgLeaveGroupResponse"; + value: MsgLeaveGroupResponseAmino; +} /** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ - export interface MsgLeaveGroupResponseSDKType {} - function createBaseMsgCreateGroup(): MsgCreateGroup { return { admin: "", @@ -581,526 +783,786 @@ function createBaseMsgCreateGroup(): MsgCreateGroup { metadata: "" }; } - export const MsgCreateGroup = { - encode(message: MsgCreateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + encode(message: MsgCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - for (const v of message.members) { Member.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroup { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateGroup(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: message.members.push(Member.decode(reader, reader.uint32())); break; - case 3: message.metadata = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateGroup { + fromPartial(object: Partial): MsgCreateGroup { const message = createBaseMsgCreateGroup(); message.admin = object.admin ?? ""; message.members = object.members?.map(e => Member.fromPartial(e)) || []; message.metadata = object.metadata ?? ""; return message; + }, + fromAmino(object: MsgCreateGroupAmino): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + message.members = object.members?.map(e => Member.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { + const obj: any = {}; + obj.admin = message.admin; + if (message.members) { + obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); + } else { + obj.members = []; + } + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { + return MsgCreateGroup.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroup): MsgCreateGroupAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroup", + value: MsgCreateGroup.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupProtoMsg): MsgCreateGroup { + return MsgCreateGroup.decode(message.value); + }, + toProto(message: MsgCreateGroup): Uint8Array { + return MsgCreateGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroup): MsgCreateGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + value: MsgCreateGroup.encode(message).finish() + }; } - }; - function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { return { - groupId: Long.UZERO + groupId: BigInt(0) }; } - export const MsgCreateGroupResponse = { - encode(message: MsgCreateGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", + encode(message: MsgCreateGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateGroupResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateGroupResponse { + fromPartial(object: Partial): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgCreateGroupResponseAmino): MsgCreateGroupResponse { const message = createBaseMsgCreateGroupResponse(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } return message; + }, + toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { + return MsgCreateGroupResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupResponse): MsgCreateGroupResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupResponse", + value: MsgCreateGroupResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupResponseProtoMsg): MsgCreateGroupResponse { + return MsgCreateGroupResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupResponse): Uint8Array { + return MsgCreateGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupResponse): MsgCreateGroupResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", + value: MsgCreateGroupResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { return { admin: "", - groupId: Long.UZERO, + groupId: BigInt(0), memberUpdates: [] }; } - export const MsgUpdateGroupMembers = { - encode(message: MsgUpdateGroupMembers, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - - if (!message.groupId.isZero()) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - for (const v of message.memberUpdates) { Member.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMembers { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupMembers(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 3: message.memberUpdates.push(Member.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUpdateGroupMembers { + fromPartial(object: Partial): MsgUpdateGroupMembers { const message = createBaseMsgUpdateGroupMembers(); message.admin = object.admin ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.memberUpdates = object.memberUpdates?.map(e => Member.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgUpdateGroupMembersAmino): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + message.memberUpdates = object.member_updates?.map(e => Member.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + if (message.memberUpdates) { + obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); + } else { + obj.member_updates = []; + } + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMembersAminoMsg): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMembers", + value: MsgUpdateGroupMembers.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMembersProtoMsg): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.decode(message.value); + }, + toProto(message: MsgUpdateGroupMembers): Uint8Array { + return MsgUpdateGroupMembers.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + value: MsgUpdateGroupMembers.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { return {}; } - export const MsgUpdateGroupMembersResponse = { - encode(_: MsgUpdateGroupMembersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", + encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupMembersResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUpdateGroupMembersResponse { + fromPartial(_: Partial): MsgUpdateGroupMembersResponse { const message = createBaseMsgUpdateGroupMembersResponse(); return message; + }, + fromAmino(_: MsgUpdateGroupMembersResponseAmino): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMembersResponseAminoMsg): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMembersResponse", + value: MsgUpdateGroupMembersResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMembersResponseProtoMsg): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupMembersResponse): Uint8Array { + return MsgUpdateGroupMembersResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", + value: MsgUpdateGroupMembersResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { return { admin: "", - groupId: Long.UZERO, + groupId: BigInt(0), newAdmin: "" }; } - export const MsgUpdateGroupAdmin = { - encode(message: MsgUpdateGroupAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - - if (!message.groupId.isZero()) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - if (message.newAdmin !== "") { writer.uint32(26).string(message.newAdmin); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupAdmin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupAdmin(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 3: message.newAdmin = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUpdateGroupAdmin { + fromPartial(object: Partial): MsgUpdateGroupAdmin { const message = createBaseMsgUpdateGroupAdmin(); message.admin = object.admin ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.newAdmin = object.newAdmin ?? ""; return message; + }, + fromAmino(object: MsgUpdateGroupAdminAmino): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + return message; + }, + toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.new_admin = message.newAdmin; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupAdmin", + value: MsgUpdateGroupAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupAdminProtoMsg): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.decode(message.value); + }, + toProto(message: MsgUpdateGroupAdmin): Uint8Array { + return MsgUpdateGroupAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + value: MsgUpdateGroupAdmin.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { return {}; } - export const MsgUpdateGroupAdminResponse = { - encode(_: MsgUpdateGroupAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", + encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupAdminResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUpdateGroupAdminResponse { + fromPartial(_: Partial): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupAdminResponseAmino): MsgUpdateGroupAdminResponse { const message = createBaseMsgUpdateGroupAdminResponse(); return message; + }, + toAmino(_: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupAdminResponseAminoMsg): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupAdminResponse", + value: MsgUpdateGroupAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupAdminResponseProtoMsg): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupAdminResponse): Uint8Array { + return MsgUpdateGroupAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", + value: MsgUpdateGroupAdminResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { return { admin: "", - groupId: Long.UZERO, + groupId: BigInt(0), metadata: "" }; } - export const MsgUpdateGroupMetadata = { - encode(message: MsgUpdateGroupMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - - if (!message.groupId.isZero()) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupMetadata(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 3: message.metadata = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUpdateGroupMetadata { + fromPartial(object: Partial): MsgUpdateGroupMetadata { const message = createBaseMsgUpdateGroupMetadata(); message.admin = object.admin ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.metadata = object.metadata ?? ""; return message; + }, + fromAmino(object: MsgUpdateGroupMetadataAmino): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMetadata", + value: MsgUpdateGroupMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMetadataProtoMsg): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.decode(message.value); + }, + toProto(message: MsgUpdateGroupMetadata): Uint8Array { + return MsgUpdateGroupMetadata.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + value: MsgUpdateGroupMetadata.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { return {}; } - export const MsgUpdateGroupMetadataResponse = { - encode(_: MsgUpdateGroupMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", + encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupMetadataResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUpdateGroupMetadataResponse { + fromPartial(_: Partial): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupMetadataResponseAmino): MsgUpdateGroupMetadataResponse { const message = createBaseMsgUpdateGroupMetadataResponse(); return message; + }, + toAmino(_: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMetadataResponseAminoMsg): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMetadataResponse", + value: MsgUpdateGroupMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMetadataResponseProtoMsg): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupMetadataResponse): Uint8Array { + return MsgUpdateGroupMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", + value: MsgUpdateGroupMetadataResponse.encode(message).finish() + }; } - }; - function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { return { admin: "", - groupId: Long.UZERO, + groupId: BigInt(0), metadata: "", decisionPolicy: undefined }; } - export const MsgCreateGroupPolicy = { - encode(message: MsgCreateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - - if (!message.groupId.isZero()) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - if (message.decisionPolicy !== undefined) { Any.encode(message.decisionPolicy, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupPolicy { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateGroupPolicy(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 3: message.metadata = reader.string(); break; - case 4: message.decisionPolicy = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateGroupPolicy { + fromPartial(object: Partial): MsgCreateGroupPolicy { const message = createBaseMsgCreateGroupPolicy(); message.admin = object.admin ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.metadata = object.metadata ?? ""; message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; return message; + }, + fromAmino(object: MsgCreateGroupPolicyAmino): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = Any.fromAmino(object.decision_policy); + } + return message; + }, + toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.metadata = message.metadata; + obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupPolicyAminoMsg): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupPolicy", + value: MsgCreateGroupPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupPolicyProtoMsg): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.decode(message.value); + }, + toProto(message: MsgCreateGroupPolicy): Uint8Array { + return MsgCreateGroupPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + value: MsgCreateGroupPolicy.encode(message).finish() + }; } - }; - function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { return { address: "" }; } - export const MsgCreateGroupPolicyResponse = { - encode(message: MsgCreateGroupPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", + encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateGroupPolicyResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateGroupPolicyResponse { + fromPartial(object: Partial): MsgCreateGroupPolicyResponse { const message = createBaseMsgCreateGroupPolicyResponse(); message.address = object.address ?? ""; return message; + }, + fromAmino(object: MsgCreateGroupPolicyResponseAmino): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupPolicyResponse", + value: MsgCreateGroupPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupPolicyResponseProtoMsg): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupPolicyResponse): Uint8Array { + return MsgCreateGroupPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", + value: MsgCreateGroupPolicyResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { return { admin: "", @@ -1108,64 +1570,92 @@ function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { newAdmin: "" }; } - export const MsgUpdateGroupPolicyAdmin = { - encode(message: MsgUpdateGroupPolicyAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.address !== "") { writer.uint32(18).string(message.address); } - if (message.newAdmin !== "") { writer.uint32(26).string(message.newAdmin); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupPolicyAdmin(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: message.address = reader.string(); break; - case 3: message.newAdmin = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUpdateGroupPolicyAdmin { + fromPartial(object: Partial): MsgUpdateGroupPolicyAdmin { const message = createBaseMsgUpdateGroupPolicyAdmin(); message.admin = object.admin ?? ""; message.address = object.address ?? ""; message.newAdmin = object.newAdmin ?? ""; return message; + }, + fromAmino(object: MsgUpdateGroupPolicyAdminAmino): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.address = message.address; + obj.new_admin = message.newAdmin; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", + value: MsgUpdateGroupPolicyAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyAdminProtoMsg): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyAdmin): Uint8Array { + return MsgUpdateGroupPolicyAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + value: MsgUpdateGroupPolicyAdmin.encode(message).finish() + }; } - }; - function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { return { admin: "", @@ -1176,79 +1666,62 @@ function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { decisionPolicy: undefined }; } - export const MsgCreateGroupWithPolicy = { - encode(message: MsgCreateGroupWithPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - for (const v of message.members) { Member.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.groupMetadata !== "") { writer.uint32(26).string(message.groupMetadata); } - if (message.groupPolicyMetadata !== "") { writer.uint32(34).string(message.groupPolicyMetadata); } - if (message.groupPolicyAsAdmin === true) { writer.uint32(40).bool(message.groupPolicyAsAdmin); } - if (message.decisionPolicy !== undefined) { Any.encode(message.decisionPolicy, writer.uint32(50).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateGroupWithPolicy(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: message.members.push(Member.decode(reader, reader.uint32())); break; - case 3: message.groupMetadata = reader.string(); break; - case 4: message.groupPolicyMetadata = reader.string(); break; - case 5: message.groupPolicyAsAdmin = reader.bool(); break; - case 6: message.decisionPolicy = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateGroupWithPolicy { + fromPartial(object: Partial): MsgCreateGroupWithPolicy { const message = createBaseMsgCreateGroupWithPolicy(); message.admin = object.admin ?? ""; message.members = object.members?.map(e => Member.fromPartial(e)) || []; @@ -1257,99 +1730,200 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; return message; + }, + fromAmino(object: MsgCreateGroupWithPolicyAmino): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + message.members = object.members?.map(e => Member.fromAmino(e)) || []; + if (object.group_metadata !== undefined && object.group_metadata !== null) { + message.groupMetadata = object.group_metadata; + } + if (object.group_policy_metadata !== undefined && object.group_policy_metadata !== null) { + message.groupPolicyMetadata = object.group_policy_metadata; + } + if (object.group_policy_as_admin !== undefined && object.group_policy_as_admin !== null) { + message.groupPolicyAsAdmin = object.group_policy_as_admin; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = Any.fromAmino(object.decision_policy); + } + return message; + }, + toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { + const obj: any = {}; + obj.admin = message.admin; + if (message.members) { + obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); + } else { + obj.members = []; + } + obj.group_metadata = message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupWithPolicyAminoMsg): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupWithPolicy", + value: MsgCreateGroupWithPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupWithPolicyProtoMsg): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.decode(message.value); + }, + toProto(message: MsgCreateGroupWithPolicy): Uint8Array { + return MsgCreateGroupWithPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + value: MsgCreateGroupWithPolicy.encode(message).finish() + }; } - }; - function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { return { - groupId: Long.UZERO, + groupId: BigInt(0), groupPolicyAddress: "" }; } - export const MsgCreateGroupWithPolicyResponse = { - encode(message: MsgCreateGroupWithPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", + encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - if (message.groupPolicyAddress !== "") { writer.uint32(18).string(message.groupPolicyAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateGroupWithPolicyResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 2: message.groupPolicyAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateGroupWithPolicyResponse { + fromPartial(object: Partial): MsgCreateGroupWithPolicyResponse { const message = createBaseMsgCreateGroupWithPolicyResponse(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.groupPolicyAddress = object.groupPolicyAddress ?? ""; return message; + }, + fromAmino(object: MsgCreateGroupWithPolicyResponseAmino): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + return message; + }, + toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_policy_address = message.groupPolicyAddress; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupWithPolicyResponse", + value: MsgCreateGroupWithPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupWithPolicyResponseProtoMsg): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupWithPolicyResponse): Uint8Array { + return MsgCreateGroupWithPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", + value: MsgCreateGroupWithPolicyResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { return {}; } - export const MsgUpdateGroupPolicyAdminResponse = { - encode(_: MsgUpdateGroupPolicyAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupPolicyAdminResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUpdateGroupPolicyAdminResponse { + fromPartial(_: Partial): MsgUpdateGroupPolicyAdminResponse { const message = createBaseMsgUpdateGroupPolicyAdminResponse(); return message; + }, + fromAmino(_: MsgUpdateGroupPolicyAdminResponseAmino): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyAdminResponseAminoMsg): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse", + value: MsgUpdateGroupPolicyAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyAdminResponseProtoMsg): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyAdminResponse): Uint8Array { + return MsgUpdateGroupPolicyAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", + value: MsgUpdateGroupPolicyAdminResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { return { admin: "", @@ -1357,98 +1931,148 @@ function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDec decisionPolicy: undefined }; } - export const MsgUpdateGroupPolicyDecisionPolicy = { - encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.address !== "") { writer.uint32(18).string(message.address); } - if (message.decisionPolicy !== undefined) { Any.encode(message.decisionPolicy, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: message.address = reader.string(); break; - case 3: message.decisionPolicy = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUpdateGroupPolicyDecisionPolicy { + fromPartial(object: Partial): MsgUpdateGroupPolicyDecisionPolicy { const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); message.admin = object.admin ?? ""; message.address = object.address ?? ""; message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; return message; + }, + fromAmino(object: MsgUpdateGroupPolicyDecisionPolicyAmino): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = Any.fromAmino(object.decision_policy); + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.address = message.address; + obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyDecisionPolicyAminoMsg): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy", + value: MsgUpdateGroupPolicyDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyProtoMsg): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyDecisionPolicy): Uint8Array { + return MsgUpdateGroupPolicyDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + value: MsgUpdateGroupPolicyDecisionPolicy.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { return {}; } - export const MsgUpdateGroupPolicyDecisionPolicyResponse = { - encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUpdateGroupPolicyDecisionPolicyResponse { + fromPartial(_: Partial): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupPolicyDecisionPolicyResponseAmino): MsgUpdateGroupPolicyDecisionPolicyResponse { const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); return message; + }, + toAmino(_: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse", + value: MsgUpdateGroupPolicyDecisionPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyDecisionPolicyResponse): Uint8Array { + return MsgUpdateGroupPolicyDecisionPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", + value: MsgUpdateGroupPolicyDecisionPolicyResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { return { admin: "", @@ -1456,98 +2080,148 @@ function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata metadata: "" }; } - export const MsgUpdateGroupPolicyMetadata = { - encode(message: MsgUpdateGroupPolicyMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.address !== "") { writer.uint32(18).string(message.address); } - if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupPolicyMetadata(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.admin = reader.string(); break; - case 2: message.address = reader.string(); break; - case 3: message.metadata = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUpdateGroupPolicyMetadata { + fromPartial(object: Partial): MsgUpdateGroupPolicyMetadata { const message = createBaseMsgUpdateGroupPolicyMetadata(); message.admin = object.admin ?? ""; message.address = object.address ?? ""; message.metadata = object.metadata ?? ""; return message; + }, + fromAmino(object: MsgUpdateGroupPolicyMetadataAmino): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { + const obj: any = {}; + obj.admin = message.admin; + obj.address = message.address; + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", + value: MsgUpdateGroupPolicyMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyMetadataProtoMsg): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyMetadata): Uint8Array { + return MsgUpdateGroupPolicyMetadata.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + value: MsgUpdateGroupPolicyMetadata.encode(message).finish() + }; } - }; - function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { return {}; } - export const MsgUpdateGroupPolicyMetadataResponse = { - encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUpdateGroupPolicyMetadataResponse { + fromPartial(_: Partial): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupPolicyMetadataResponseAmino): MsgUpdateGroupPolicyMetadataResponse { const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); return message; + }, + toAmino(_: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyMetadataResponseAminoMsg): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse", + value: MsgUpdateGroupPolicyMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyMetadataResponseProtoMsg): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyMetadataResponse): Uint8Array { + return MsgUpdateGroupPolicyMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", + value: MsgUpdateGroupPolicyMetadataResponse.encode(message).finish() + }; } - }; - function createBaseMsgSubmitProposal(): MsgSubmitProposal { return { address: "", @@ -1557,71 +2231,56 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { exec: 0 }; } - export const MsgSubmitProposal = { - encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - for (const v of message.proposers) { writer.uint32(18).string(v!); } - if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - for (const v of message.messages) { Any.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.exec !== 0) { writer.uint32(40).int32(message.exec); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.proposers.push(reader.string()); break; - case 3: message.metadata = reader.string(); break; - case 4: message.messages.push(Any.decode(reader, reader.uint32())); break; - case 5: message.exec = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitProposal { + fromPartial(object: Partial): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); message.address = object.address ?? ""; message.proposers = object.proposers?.map(e => e) || []; @@ -1629,437 +2288,711 @@ export const MsgSubmitProposal = { message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; message.exec = object.exec ?? 0; return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.proposers = object.proposers?.map(e => e) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.exec !== undefined && object.exec !== null) { + message.exec = execFromJSON(object.exec); + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + obj.address = message.address; + if (message.proposers) { + obj.proposers = message.proposers.map(e => e); + } else { + obj.proposers = []; + } + obj.metadata = message.metadata; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = []; + } + obj.exec = execToJSON(message.exec); + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/group/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; } - }; - function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { return { - proposalId: Long.UZERO + proposalId: BigInt(0) }; } - export const MsgSubmitProposalResponse = { - encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitProposalResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + fromPartial(object: Partial): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { const message = createBaseMsgSubmitProposalResponse(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; } - }; - function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), address: "" }; } - export const MsgWithdrawProposal = { - encode(message: MsgWithdrawProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + encode(message: MsgWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.address !== "") { writer.uint32(18).string(message.address); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgWithdrawProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgWithdrawProposal { + fromPartial(object: Partial): MsgWithdrawProposal { const message = createBaseMsgWithdrawProposal(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.address = object.address ?? ""; return message; + }, + fromAmino(object: MsgWithdrawProposalAmino): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { + return MsgWithdrawProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawProposal): MsgWithdrawProposalAminoMsg { + return { + type: "cosmos-sdk/group/MsgWithdrawProposal", + value: MsgWithdrawProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawProposalProtoMsg): MsgWithdrawProposal { + return MsgWithdrawProposal.decode(message.value); + }, + toProto(message: MsgWithdrawProposal): Uint8Array { + return MsgWithdrawProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawProposal): MsgWithdrawProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + value: MsgWithdrawProposal.encode(message).finish() + }; } - }; - function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { return {}; } - export const MsgWithdrawProposalResponse = { - encode(_: MsgWithdrawProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", + encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgWithdrawProposalResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgWithdrawProposalResponse { + fromPartial(_: Partial): MsgWithdrawProposalResponse { const message = createBaseMsgWithdrawProposalResponse(); return message; + }, + fromAmino(_: MsgWithdrawProposalResponseAmino): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, + toAmino(_: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgWithdrawProposalResponseAminoMsg): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawProposalResponse", + value: MsgWithdrawProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawProposalResponseProtoMsg): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.decode(message.value); + }, + toProto(message: MsgWithdrawProposalResponse): Uint8Array { + return MsgWithdrawProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", + value: MsgWithdrawProposalResponse.encode(message).finish() + }; } - }; - function createBaseMsgVote(): MsgVote { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "", option: 0, metadata: "", exec: 0 }; } - export const MsgVote = { - encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.MsgVote", + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - if (message.option !== 0) { writer.uint32(24).int32(message.option); } - if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } - if (message.exec !== 0) { writer.uint32(40).int32(message.exec); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - case 3: message.option = (reader.int32() as any); break; - case 4: message.metadata = reader.string(); break; - case 5: message.exec = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgVote { + fromPartial(object: Partial): MsgVote { const message = createBaseMsgVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.option = object.option ?? 0; message.metadata = object.metadata ?? ""; message.exec = object.exec ?? 0; return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = voteOptionFromJSON(object.option); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.exec !== undefined && object.exec !== null) { + message.exec = execFromJSON(object.exec); + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + obj.option = voteOptionToJSON(message.option); + obj.metadata = message.metadata; + obj.exec = execToJSON(message.exec); + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/group/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgVote", + value: MsgVote.encode(message).finish() + }; } - }; - function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; } - export const MsgVoteResponse = { - encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgVoteResponse", + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgVoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgVoteResponse { + fromPartial(_: Partial): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { const message = createBaseMsgVoteResponse(); return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; } - }; - function createBaseMsgExec(): MsgExec { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), signer: "" }; } - export const MsgExec = { - encode(message: MsgExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.MsgExec", + encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.signer !== "") { writer.uint32(18).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgExec { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgExec(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgExec { + fromPartial(object: Partial): MsgExec { const message = createBaseMsgExec(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgExecAmino): MsgExec { + const message = createBaseMsgExec(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgExec): MsgExecAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgExecAminoMsg): MsgExec { + return MsgExec.fromAmino(object.value); + }, + toAminoMsg(message: MsgExec): MsgExecAminoMsg { + return { + type: "cosmos-sdk/group/MsgExec", + value: MsgExec.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecProtoMsg): MsgExec { + return MsgExec.decode(message.value); + }, + toProto(message: MsgExec): Uint8Array { + return MsgExec.encode(message).finish(); + }, + toProtoMsg(message: MsgExec): MsgExecProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgExec", + value: MsgExec.encode(message).finish() + }; } - }; - function createBaseMsgExecResponse(): MsgExecResponse { return {}; } - export const MsgExecResponse = { - encode(_: MsgExecResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgExecResponse", + encode(_: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgExecResponse { + fromPartial(_: Partial): MsgExecResponse { + const message = createBaseMsgExecResponse(); + return message; + }, + fromAmino(_: MsgExecResponseAmino): MsgExecResponse { const message = createBaseMsgExecResponse(); return message; + }, + toAmino(_: MsgExecResponse): MsgExecResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); + }, + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish() + }; } - }; - function createBaseMsgLeaveGroup(): MsgLeaveGroup { return { address: "", - groupId: Long.UZERO + groupId: BigInt(0) }; } - export const MsgLeaveGroup = { - encode(message: MsgLeaveGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + encode(message: MsgLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - - if (!message.groupId.isZero()) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeaveGroup { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgLeaveGroup(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgLeaveGroup { + fromPartial(object: Partial): MsgLeaveGroup { const message = createBaseMsgLeaveGroup(); message.address = object.address ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgLeaveGroupAmino): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } return message; + }, + toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { + const obj: any = {}; + obj.address = message.address; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { + return MsgLeaveGroup.fromAmino(object.value); + }, + toAminoMsg(message: MsgLeaveGroup): MsgLeaveGroupAminoMsg { + return { + type: "cosmos-sdk/group/MsgLeaveGroup", + value: MsgLeaveGroup.toAmino(message) + }; + }, + fromProtoMsg(message: MsgLeaveGroupProtoMsg): MsgLeaveGroup { + return MsgLeaveGroup.decode(message.value); + }, + toProto(message: MsgLeaveGroup): Uint8Array { + return MsgLeaveGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgLeaveGroup): MsgLeaveGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + value: MsgLeaveGroup.encode(message).finish() + }; } - }; - function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { return {}; } - export const MsgLeaveGroupResponse = { - encode(_: MsgLeaveGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", + encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeaveGroupResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgLeaveGroupResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgLeaveGroupResponse { + fromPartial(_: Partial): MsgLeaveGroupResponse { const message = createBaseMsgLeaveGroupResponse(); return message; + }, + fromAmino(_: MsgLeaveGroupResponseAmino): MsgLeaveGroupResponse { + const message = createBaseMsgLeaveGroupResponse(); + return message; + }, + toAmino(_: MsgLeaveGroupResponse): MsgLeaveGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgLeaveGroupResponseAminoMsg): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgLeaveGroupResponse): MsgLeaveGroupResponseAminoMsg { + return { + type: "cosmos-sdk/MsgLeaveGroupResponse", + value: MsgLeaveGroupResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgLeaveGroupResponseProtoMsg): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.decode(message.value); + }, + toProto(message: MsgLeaveGroupResponse): Uint8Array { + return MsgLeaveGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgLeaveGroupResponse): MsgLeaveGroupResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", + value: MsgLeaveGroupResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/group/v1/types.ts b/src/codegen/cosmos/group/v1/types.ts index 7f7d4a8..b0b0ede 100644 --- a/src/codegen/cosmos/group/v1/types.ts +++ b/src/codegen/cosmos/group/v1/types.ts @@ -1,68 +1,41 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { toTimestamp, fromTimestamp, DeepPartial, Long } from "../../../helpers"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** VoteOption enumerates the valid vote options for a given proposal. */ - export enum VoteOption { /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ VOTE_OPTION_UNSPECIFIED = 0, - /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ VOTE_OPTION_YES = 1, - /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ VOTE_OPTION_ABSTAIN = 2, - /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ VOTE_OPTION_NO = 3, - - /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ - VOTE_OPTION_NO_WITH_VETO = 4, - UNRECOGNIZED = -1, -} -/** VoteOption enumerates the valid vote options for a given proposal. */ - -export enum VoteOptionSDKType { - /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ - VOTE_OPTION_UNSPECIFIED = 0, - - /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ - VOTE_OPTION_YES = 1, - - /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ - VOTE_OPTION_ABSTAIN = 2, - - /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ - VOTE_OPTION_NO = 3, - /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ VOTE_OPTION_NO_WITH_VETO = 4, UNRECOGNIZED = -1, } +export const VoteOptionSDKType = VoteOption; +export const VoteOptionAmino = VoteOption; export function voteOptionFromJSON(object: any): VoteOption { switch (object) { case 0: case "VOTE_OPTION_UNSPECIFIED": return VoteOption.VOTE_OPTION_UNSPECIFIED; - case 1: case "VOTE_OPTION_YES": return VoteOption.VOTE_OPTION_YES; - case 2: case "VOTE_OPTION_ABSTAIN": return VoteOption.VOTE_OPTION_ABSTAIN; - case 3: case "VOTE_OPTION_NO": return VoteOption.VOTE_OPTION_NO; - case 4: case "VOTE_OPTION_NO_WITH_VETO": return VoteOption.VOTE_OPTION_NO_WITH_VETO; - case -1: case "UNRECOGNIZED": default: @@ -73,61 +46,29 @@ export function voteOptionToJSON(object: VoteOption): string { switch (object) { case VoteOption.VOTE_OPTION_UNSPECIFIED: return "VOTE_OPTION_UNSPECIFIED"; - case VoteOption.VOTE_OPTION_YES: return "VOTE_OPTION_YES"; - case VoteOption.VOTE_OPTION_ABSTAIN: return "VOTE_OPTION_ABSTAIN"; - case VoteOption.VOTE_OPTION_NO: return "VOTE_OPTION_NO"; - case VoteOption.VOTE_OPTION_NO_WITH_VETO: return "VOTE_OPTION_NO_WITH_VETO"; - case VoteOption.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** ProposalStatus defines proposal statuses. */ - export enum ProposalStatus { /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ PROPOSAL_STATUS_UNSPECIFIED = 0, - - /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when persisted. */ - PROPOSAL_STATUS_SUBMITTED = 1, - - /** PROPOSAL_STATUS_CLOSED - Final status of a proposal when the final tally was executed. */ - PROPOSAL_STATUS_CLOSED = 2, - - /** PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group was modified before the final tally. */ - PROPOSAL_STATUS_ABORTED = 3, - - /** - * PROPOSAL_STATUS_WITHDRAWN - A proposal can be deleted before the voting start time by the owner. When this happens the final status - * is Withdrawn. - */ - PROPOSAL_STATUS_WITHDRAWN = 4, - UNRECOGNIZED = -1, -} -/** ProposalStatus defines proposal statuses. */ - -export enum ProposalStatusSDKType { - /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ - PROPOSAL_STATUS_UNSPECIFIED = 0, - /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when persisted. */ PROPOSAL_STATUS_SUBMITTED = 1, - /** PROPOSAL_STATUS_CLOSED - Final status of a proposal when the final tally was executed. */ PROPOSAL_STATUS_CLOSED = 2, - /** PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group was modified before the final tally. */ PROPOSAL_STATUS_ABORTED = 3, - /** * PROPOSAL_STATUS_WITHDRAWN - A proposal can be deleted before the voting start time by the owner. When this happens the final status * is Withdrawn. @@ -135,28 +76,25 @@ export enum ProposalStatusSDKType { PROPOSAL_STATUS_WITHDRAWN = 4, UNRECOGNIZED = -1, } +export const ProposalStatusSDKType = ProposalStatus; +export const ProposalStatusAmino = ProposalStatus; export function proposalStatusFromJSON(object: any): ProposalStatus { switch (object) { case 0: case "PROPOSAL_STATUS_UNSPECIFIED": return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; - case 1: case "PROPOSAL_STATUS_SUBMITTED": return ProposalStatus.PROPOSAL_STATUS_SUBMITTED; - case 2: case "PROPOSAL_STATUS_CLOSED": return ProposalStatus.PROPOSAL_STATUS_CLOSED; - case 3: case "PROPOSAL_STATUS_ABORTED": return ProposalStatus.PROPOSAL_STATUS_ABORTED; - case 4: case "PROPOSAL_STATUS_WITHDRAWN": return ProposalStatus.PROPOSAL_STATUS_WITHDRAWN; - case -1: case "UNRECOGNIZED": default: @@ -167,74 +105,47 @@ export function proposalStatusToJSON(object: ProposalStatus): string { switch (object) { case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: return "PROPOSAL_STATUS_UNSPECIFIED"; - case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: return "PROPOSAL_STATUS_SUBMITTED"; - case ProposalStatus.PROPOSAL_STATUS_CLOSED: return "PROPOSAL_STATUS_CLOSED"; - case ProposalStatus.PROPOSAL_STATUS_ABORTED: return "PROPOSAL_STATUS_ABORTED"; - case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: return "PROPOSAL_STATUS_WITHDRAWN"; - case ProposalStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** ProposalResult defines types of proposal results. */ - export enum ProposalResult { /** PROPOSAL_RESULT_UNSPECIFIED - An empty value is invalid and not allowed */ PROPOSAL_RESULT_UNSPECIFIED = 0, - - /** PROPOSAL_RESULT_UNFINALIZED - Until a final tally has happened the status is unfinalized */ - PROPOSAL_RESULT_UNFINALIZED = 1, - - /** PROPOSAL_RESULT_ACCEPTED - Final result of the tally */ - PROPOSAL_RESULT_ACCEPTED = 2, - - /** PROPOSAL_RESULT_REJECTED - Final result of the tally */ - PROPOSAL_RESULT_REJECTED = 3, - UNRECOGNIZED = -1, -} -/** ProposalResult defines types of proposal results. */ - -export enum ProposalResultSDKType { - /** PROPOSAL_RESULT_UNSPECIFIED - An empty value is invalid and not allowed */ - PROPOSAL_RESULT_UNSPECIFIED = 0, - /** PROPOSAL_RESULT_UNFINALIZED - Until a final tally has happened the status is unfinalized */ PROPOSAL_RESULT_UNFINALIZED = 1, - /** PROPOSAL_RESULT_ACCEPTED - Final result of the tally */ PROPOSAL_RESULT_ACCEPTED = 2, - /** PROPOSAL_RESULT_REJECTED - Final result of the tally */ PROPOSAL_RESULT_REJECTED = 3, UNRECOGNIZED = -1, } +export const ProposalResultSDKType = ProposalResult; +export const ProposalResultAmino = ProposalResult; export function proposalResultFromJSON(object: any): ProposalResult { switch (object) { case 0: case "PROPOSAL_RESULT_UNSPECIFIED": return ProposalResult.PROPOSAL_RESULT_UNSPECIFIED; - case 1: case "PROPOSAL_RESULT_UNFINALIZED": return ProposalResult.PROPOSAL_RESULT_UNFINALIZED; - case 2: case "PROPOSAL_RESULT_ACCEPTED": return ProposalResult.PROPOSAL_RESULT_ACCEPTED; - case 3: case "PROPOSAL_RESULT_REJECTED": return ProposalResult.PROPOSAL_RESULT_REJECTED; - case -1: case "UNRECOGNIZED": default: @@ -245,71 +156,45 @@ export function proposalResultToJSON(object: ProposalResult): string { switch (object) { case ProposalResult.PROPOSAL_RESULT_UNSPECIFIED: return "PROPOSAL_RESULT_UNSPECIFIED"; - case ProposalResult.PROPOSAL_RESULT_UNFINALIZED: return "PROPOSAL_RESULT_UNFINALIZED"; - case ProposalResult.PROPOSAL_RESULT_ACCEPTED: return "PROPOSAL_RESULT_ACCEPTED"; - case ProposalResult.PROPOSAL_RESULT_REJECTED: return "PROPOSAL_RESULT_REJECTED"; - case ProposalResult.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** ProposalExecutorResult defines types of proposal executor results. */ - export enum ProposalExecutorResult { /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, - /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, - /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, - - /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ - PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, - UNRECOGNIZED = -1, -} -/** ProposalExecutorResult defines types of proposal executor results. */ - -export enum ProposalExecutorResultSDKType { - /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, - - /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ - PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, - - /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ - PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, - /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, UNRECOGNIZED = -1, } +export const ProposalExecutorResultSDKType = ProposalExecutorResult; +export const ProposalExecutorResultAmino = ProposalExecutorResult; export function proposalExecutorResultFromJSON(object: any): ProposalExecutorResult { switch (object) { case 0: case "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED": return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; - case 1: case "PROPOSAL_EXECUTOR_RESULT_NOT_RUN": return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN; - case 2: case "PROPOSAL_EXECUTOR_RESULT_SUCCESS": return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS; - case 3: case "PROPOSAL_EXECUTOR_RESULT_FAILURE": return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE; - case -1: case "UNRECOGNIZED": default: @@ -320,16 +205,12 @@ export function proposalExecutorResultToJSON(object: ProposalExecutorResult): st 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"; @@ -339,94 +220,131 @@ export function proposalExecutorResultToJSON(object: ProposalExecutorResult): st * Member represents a group member with an account address, * non-zero weight and metadata. */ - export interface Member { /** address is the member's account address. */ address: string; /** weight is the member's voting weight that should be greater than 0. */ - weight: string; /** metadata is any arbitrary metadata to attached to the member. */ - metadata: string; /** added_at is a timestamp specifying when a member was added. */ - - addedAt?: Date; + addedAt: Date; +} +export interface MemberProtoMsg { + typeUrl: "/cosmos.group.v1.Member"; + value: Uint8Array; } /** * Member represents a group member with an account address, * non-zero weight and metadata. */ - -export interface MemberSDKType { +export interface MemberAmino { /** address is the member's account address. */ - address: string; + address?: string; /** weight is the member's voting weight that should be greater than 0. */ - - weight: string; + weight?: string; /** metadata is any arbitrary metadata to attached to the member. */ - - metadata: string; + metadata?: string; /** added_at is a timestamp specifying when a member was added. */ - - added_at?: Date; + added_at?: string; +} +export interface MemberAminoMsg { + type: "cosmos-sdk/Member"; + value: MemberAmino; +} +/** + * Member represents a group member with an account address, + * non-zero weight and metadata. + */ +export interface MemberSDKType { + address: string; + weight: string; + metadata: string; + added_at: Date; } /** Members defines a repeated slice of Member objects. */ - export interface Members { /** members is the list of members. */ members: Member[]; } +export interface MembersProtoMsg { + typeUrl: "/cosmos.group.v1.Members"; + value: Uint8Array; +} /** Members defines a repeated slice of Member objects. */ - -export interface MembersSDKType { +export interface MembersAmino { /** members is the list of members. */ + members?: MemberAmino[]; +} +export interface MembersAminoMsg { + type: "cosmos-sdk/Members"; + value: MembersAmino; +} +/** Members defines a repeated slice of Member objects. */ +export interface MembersSDKType { members: MemberSDKType[]; } /** ThresholdDecisionPolicy implements the DecisionPolicy interface */ - export interface ThresholdDecisionPolicy { /** threshold is the minimum weighted sum of yes votes that must be met or exceeded for a proposal to succeed. */ threshold: string; /** windows defines the different windows for voting and execution. */ - windows?: DecisionPolicyWindows; } +export interface ThresholdDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy"; + value: Uint8Array; +} /** ThresholdDecisionPolicy implements the DecisionPolicy interface */ - -export interface ThresholdDecisionPolicySDKType { +export interface ThresholdDecisionPolicyAmino { /** threshold is the minimum weighted sum of yes votes that must be met or exceeded for a proposal to succeed. */ - threshold: string; + threshold?: string; /** windows defines the different windows for voting and execution. */ - + windows?: DecisionPolicyWindowsAmino; +} +export interface ThresholdDecisionPolicyAminoMsg { + type: "cosmos-sdk/ThresholdDecisionPolicy"; + value: ThresholdDecisionPolicyAmino; +} +/** ThresholdDecisionPolicy implements the DecisionPolicy interface */ +export interface ThresholdDecisionPolicySDKType { + threshold: string; windows?: DecisionPolicyWindowsSDKType; } /** PercentageDecisionPolicy implements the DecisionPolicy interface */ - export interface PercentageDecisionPolicy { /** percentage is the minimum percentage the weighted sum of yes votes must meet for a proposal to succeed. */ percentage: string; /** windows defines the different windows for voting and execution. */ - windows?: DecisionPolicyWindows; } +export interface PercentageDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy"; + value: Uint8Array; +} /** PercentageDecisionPolicy implements the DecisionPolicy interface */ - -export interface PercentageDecisionPolicySDKType { +export interface PercentageDecisionPolicyAmino { /** percentage is the minimum percentage the weighted sum of yes votes must meet for a proposal to succeed. */ - percentage: string; + percentage?: string; /** windows defines the different windows for voting and execution. */ - + windows?: DecisionPolicyWindowsAmino; +} +export interface PercentageDecisionPolicyAminoMsg { + type: "cosmos-sdk/PercentageDecisionPolicy"; + value: PercentageDecisionPolicyAmino; +} +/** PercentageDecisionPolicy implements the DecisionPolicy interface */ +export interface PercentageDecisionPolicySDKType { + percentage: string; windows?: DecisionPolicyWindowsSDKType; } /** 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; + votingPeriod: Duration; /** * min_execution_period is the minimum duration after the proposal submission * where members can start sending MsgExec. This means that the window for @@ -440,17 +358,19 @@ export interface DecisionPolicyWindows { * is empty, meaning that all proposals created with this decision policy * won't be able to be executed. */ - - minExecutionPeriod?: Duration; + minExecutionPeriod: Duration; +} +export interface DecisionPolicyWindowsProtoMsg { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows"; + value: Uint8Array; } /** DecisionPolicyWindows defines the different windows for voting and execution. */ - -export interface DecisionPolicyWindowsSDKType { +export interface DecisionPolicyWindowsAmino { /** * voting_period is the duration from submission of a proposal to the end of voting period * Within this times votes can be submitted with MsgVote. */ - voting_period?: DurationSDKType; + voting_period?: DurationAmino; /** * min_execution_period is the minimum duration after the proposal submission * where members can start sending MsgExec. This means that the window for @@ -464,19 +384,24 @@ export interface DecisionPolicyWindowsSDKType { * is empty, meaning that all proposals created with this decision policy * won't be able to be executed. */ - - min_execution_period?: DurationSDKType; + min_execution_period?: DurationAmino; +} +export interface DecisionPolicyWindowsAminoMsg { + type: "cosmos-sdk/DecisionPolicyWindows"; + value: DecisionPolicyWindowsAmino; +} +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindowsSDKType { + voting_period: DurationSDKType; + min_execution_period: DurationSDKType; } /** GroupInfo represents the high-level on-chain information for a group. */ - export interface GroupInfo { /** id is the unique ID of the group. */ - id: Long; + id: bigint; /** admin is the account address of the group's admin. */ - admin: string; /** metadata is any arbitrary metadata to attached to the group. */ - metadata: string; /** * version is used to track changes to a group's membership structure that @@ -484,112 +409,133 @@ export interface GroupInfo { * 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: Long; + version: bigint; /** total_weight is the sum of the group members' weights. */ - totalWeight: string; /** created_at is a timestamp specifying when a group was created. */ - - createdAt?: Date; + createdAt: Date; +} +export interface GroupInfoProtoMsg { + typeUrl: "/cosmos.group.v1.GroupInfo"; + value: Uint8Array; } /** GroupInfo represents the high-level on-chain information for a group. */ - -export interface GroupInfoSDKType { +export interface GroupInfoAmino { /** id is the unique ID of the group. */ - id: Long; + id?: string; /** admin is the account address of the group's admin. */ - - admin: string; + admin?: string; /** metadata is any arbitrary metadata to attached to the group. */ - - metadata: string; + 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: Long; + version?: string; /** total_weight is the sum of the group members' weights. */ - - total_weight: string; + total_weight?: string; /** created_at is a timestamp specifying when a group was created. */ - - created_at?: Date; + created_at?: string; +} +export interface GroupInfoAminoMsg { + type: "cosmos-sdk/GroupInfo"; + value: GroupInfoAmino; +} +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfoSDKType { + id: bigint; + admin: string; + metadata: string; + version: bigint; + total_weight: string; + created_at: Date; } /** GroupMember represents the relationship between a group and a member. */ - export interface GroupMember { /** group_id is the unique ID of the group. */ - groupId: Long; + groupId: bigint; /** member is the member data. */ - member?: Member; } +export interface GroupMemberProtoMsg { + typeUrl: "/cosmos.group.v1.GroupMember"; + value: Uint8Array; +} /** GroupMember represents the relationship between a group and a member. */ - -export interface GroupMemberSDKType { +export interface GroupMemberAmino { /** group_id is the unique ID of the group. */ - group_id: Long; + group_id?: string; /** member is the member data. */ - + member?: MemberAmino; +} +export interface GroupMemberAminoMsg { + type: "cosmos-sdk/GroupMember"; + value: GroupMemberAmino; +} +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMemberSDKType { + group_id: bigint; member?: MemberSDKType; } /** 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: Long; + groupId: bigint; /** admin is the account address of the group admin. */ - admin: string; /** metadata is any arbitrary metadata to attached to the group policy. */ - metadata: string; /** * version is used to track changes to a group's GroupPolicyInfo structure that * would create a different result on a running proposal. */ - - version: Long; + version: bigint; /** decision_policy specifies the group policy's decision policy. */ - decisionPolicy?: Any; /** created_at is a timestamp specifying when a group policy was created. */ - - createdAt?: Date; + createdAt: Date; +} +export interface GroupPolicyInfoProtoMsg { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo"; + value: Uint8Array; } /** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ - -export interface GroupPolicyInfoSDKType { +export interface GroupPolicyInfoAmino { /** address is the account address of group policy. */ - address: string; + address?: string; /** group_id is the unique ID of the group. */ - - group_id: Long; + group_id?: string; /** admin is the account address of the group admin. */ - - admin: string; + admin?: string; /** metadata is any arbitrary metadata to attached to the group policy. */ - - metadata: string; + 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: Long; + version?: string; /** decision_policy specifies the group policy's decision policy. */ - - decision_policy?: AnySDKType; + decision_policy?: AnyAmino; /** created_at is a timestamp specifying when a group policy was created. */ - - created_at?: Date; + created_at?: string; +} +export interface GroupPolicyInfoAminoMsg { + type: "cosmos-sdk/GroupPolicyInfo"; + value: GroupPolicyInfoAmino; +} +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfoSDKType { + address: string; + group_id: bigint; + admin: string; + metadata: string; + version: bigint; + decision_policy?: AnySDKType; + created_at: Date; } /** * Proposal defines a group proposal. Any member of a group can submit a proposal @@ -597,42 +543,33 @@ export interface GroupPolicyInfoSDKType { * 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: Long; + id: bigint; /** address is the account address of group policy. */ - address: string; /** metadata is any arbitrary metadata to attached to the proposal. */ - metadata: string; /** proposers are the account addresses of the proposers. */ - proposers: string[]; /** submit_time is a timestamp specifying when a proposal was submitted. */ - - submitTime?: Date; + submitTime: Date; /** * group_version tracks the version of the group that this proposal corresponds to. * When group membership is changed, existing proposals from previous group versions will become invalid. */ - - groupVersion: Long; + groupVersion: bigint; /** * group_policy_version tracks the version of the group policy that this proposal corresponds to. * When a decision policy is changed, existing proposals from previous policy versions will become invalid. */ - - groupPolicyVersion: Long; + groupPolicyVersion: bigint; /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ - status: ProposalStatus; /** * result is the final result based on the votes and election rule. Initial value is unfinalized. * The result is persisted so that clients can always rely on this state and not have to replicate the logic. */ - result: ProposalResult; /** * final_tally_result contains the sums of all weighted votes for this @@ -640,8 +577,7 @@ export interface Proposal { * via gRPC, this field is not populated until the proposal's voting period * has ended. */ - - finalTallyResult?: TallyResult; + finalTallyResult: TallyResult; /** * voting_period_end is the timestamp before which voting must be done. * Unless a successfull MsgExec is called before (to execute a proposal whose @@ -649,66 +585,57 @@ export interface Proposal { * at this point, and the `final_tally_result`, as well * as `status` and `result` fields will be accordingly updated. */ - - votingPeriodEnd?: Date; + votingPeriodEnd: Date; /** executor_result is the final result based on the votes and election rule. Initial value is NotRun. */ - executorResult: ProposalExecutorResult; /** messages is a list of Msgs that will be executed if the proposal passes. */ - messages: Any[]; } +export interface ProposalProtoMsg { + typeUrl: "/cosmos.group.v1.Proposal"; + value: Uint8Array; +} /** * Proposal defines a group proposal. Any member of a group can submit a proposal * for a group policy to decide upon. * A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal * passes as well as some optional metadata associated with the proposal. */ - -export interface ProposalSDKType { +export interface ProposalAmino { /** id is the unique id of the proposal. */ - id: Long; + id?: string; /** address is the account address of group policy. */ - - address: string; + address?: string; /** metadata is any arbitrary metadata to attached to the proposal. */ - - metadata: string; + metadata?: string; /** proposers are the account addresses of the proposers. */ - - proposers: string[]; + proposers?: string[]; /** submit_time is a timestamp specifying when a proposal was submitted. */ - - submit_time?: Date; + submit_time?: string; /** * group_version tracks the version of the group that this proposal corresponds to. * When group membership is changed, existing proposals from previous group versions will become invalid. */ - - group_version: Long; + group_version?: string; /** * group_policy_version tracks the version of the group policy that this proposal corresponds to. * When a decision policy is changed, existing proposals from previous policy versions will become invalid. */ - - group_policy_version: Long; + group_policy_version?: string; /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ - - status: ProposalStatusSDKType; + status?: ProposalStatus; /** * result is the final result based on the votes and election rule. Initial value is unfinalized. * The result is persisted so that clients can always rely on this state and not have to replicate the logic. */ - - result: ProposalResultSDKType; + result?: ProposalResult; /** * final_tally_result contains the sums of all weighted votes for this * proposal for each vote option, after tallying. When querying a proposal * via gRPC, this field is not populated until the proposal's voting period * has ended. */ - - final_tally_result?: TallyResultSDKType; + final_tally_result?: TallyResultAmino; /** * voting_period_end is the timestamp before which voting must be done. * Unless a successfull MsgExec is called before (to execute a proposal whose @@ -716,776 +643,1009 @@ export interface ProposalSDKType { * at this point, and the `final_tally_result`, as well * as `status` and `result` fields will be accordingly updated. */ - - voting_period_end?: Date; + voting_period_end?: string; /** executor_result is the final result based on the votes and election rule. Initial value is NotRun. */ - - executor_result: ProposalExecutorResultSDKType; + executor_result?: ProposalExecutorResult; /** messages is a list of Msgs that will be executed if the proposal passes. */ - + messages?: AnyAmino[]; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/Proposal"; + value: ProposalAmino; +} +/** + * 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 ProposalSDKType { + id: bigint; + address: string; + metadata: string; + proposers: string[]; + submit_time: Date; + group_version: bigint; + group_policy_version: bigint; + status: ProposalStatus; + result: ProposalResult; + final_tally_result: TallyResultSDKType; + voting_period_end: Date; + executor_result: ProposalExecutorResult; messages: AnySDKType[]; } /** 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 is the weighted sum of no votes. */ - noCount: string; /** no_with_veto_count is the weighted sum of veto. */ - noWithVetoCount: string; } +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.group.v1.TallyResult"; + value: Uint8Array; +} /** TallyResult represents the sum of weighted votes for each vote option. */ - -export interface TallyResultSDKType { +export interface TallyResultAmino { /** yes_count is the weighted sum of yes votes. */ - yes_count: string; + yes_count?: string; /** abstain_count is the weighted sum of abstainers. */ - - abstain_count: string; + abstain_count?: string; /** no is the weighted sum of no votes. */ - - no_count: string; + no_count?: string; /** no_with_veto_count is the weighted sum of veto. */ - + no_with_veto_count?: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/TallyResult"; + value: TallyResultAmino; +} +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResultSDKType { + yes_count: string; + abstain_count: string; + no_count: string; no_with_veto_count: string; } /** Vote represents a vote for a proposal. */ - export interface Vote { /** proposal is the unique ID of the proposal. */ - proposalId: Long; + proposalId: bigint; /** voter is the account address of the voter. */ - voter: string; /** option is the voter's choice on the proposal. */ - option: VoteOption; /** metadata is any arbitrary metadata to attached to the vote. */ - metadata: string; /** submit_time is the timestamp when the vote was submitted. */ - - submitTime?: Date; + submitTime: Date; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.group.v1.Vote"; + value: Uint8Array; } /** Vote represents a vote for a proposal. */ - -export interface VoteSDKType { +export interface VoteAmino { /** proposal is the unique ID of the proposal. */ - proposal_id: Long; + proposal_id?: string; /** voter is the account address of the voter. */ - - voter: string; + voter?: string; /** option is the voter's choice on the proposal. */ - - option: VoteOptionSDKType; + option?: VoteOption; /** metadata is any arbitrary metadata to attached to the vote. */ - - metadata: string; + metadata?: string; /** submit_time is the timestamp when the vote was submitted. */ - - submit_time?: Date; + submit_time?: string; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/Vote"; + value: VoteAmino; +} +/** Vote represents a vote for a proposal. */ +export interface VoteSDKType { + proposal_id: bigint; + voter: string; + option: VoteOption; + metadata: string; + submit_time: Date; } - function createBaseMember(): Member { return { address: "", weight: "", metadata: "", - addedAt: undefined + addedAt: new Date() }; } - export const Member = { - encode(message: Member, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.Member", + encode(message: Member, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.weight !== "") { writer.uint32(18).string(message.weight); } - if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - if (message.addedAt !== undefined) { Timestamp.encode(toTimestamp(message.addedAt), writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Member { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Member { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMember(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.weight = reader.string(); break; - case 3: message.metadata = reader.string(); break; - case 4: message.addedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Member { + fromPartial(object: Partial): Member { const message = createBaseMember(); message.address = object.address ?? ""; message.weight = object.weight ?? ""; message.metadata = object.metadata ?? ""; message.addedAt = object.addedAt ?? undefined; return message; + }, + fromAmino(object: MemberAmino): Member { + const message = createBaseMember(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.added_at !== undefined && object.added_at !== null) { + message.addedAt = fromTimestamp(Timestamp.fromAmino(object.added_at)); + } + return message; + }, + toAmino(message: Member): MemberAmino { + const obj: any = {}; + obj.address = message.address; + obj.weight = message.weight; + obj.metadata = message.metadata; + obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : undefined; + return obj; + }, + fromAminoMsg(object: MemberAminoMsg): Member { + return Member.fromAmino(object.value); + }, + toAminoMsg(message: Member): MemberAminoMsg { + return { + type: "cosmos-sdk/Member", + value: Member.toAmino(message) + }; + }, + fromProtoMsg(message: MemberProtoMsg): Member { + return Member.decode(message.value); + }, + toProto(message: Member): Uint8Array { + return Member.encode(message).finish(); + }, + toProtoMsg(message: Member): MemberProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Member", + value: Member.encode(message).finish() + }; } - }; - function createBaseMembers(): Members { return { members: [] }; } - export const Members = { - encode(message: Members, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.Members", + encode(message: Members, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.members) { Member.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Members { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Members { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMembers(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.members.push(Member.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Members { + fromPartial(object: Partial): Members { const message = createBaseMembers(); message.members = object.members?.map(e => Member.fromPartial(e)) || []; return message; + }, + fromAmino(object: MembersAmino): Members { + const message = createBaseMembers(); + message.members = object.members?.map(e => Member.fromAmino(e)) || []; + return message; + }, + toAmino(message: Members): MembersAmino { + const obj: any = {}; + if (message.members) { + obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); + } else { + obj.members = []; + } + return obj; + }, + fromAminoMsg(object: MembersAminoMsg): Members { + return Members.fromAmino(object.value); + }, + toAminoMsg(message: Members): MembersAminoMsg { + return { + type: "cosmos-sdk/Members", + value: Members.toAmino(message) + }; + }, + fromProtoMsg(message: MembersProtoMsg): Members { + return Members.decode(message.value); + }, + toProto(message: Members): Uint8Array { + return Members.encode(message).finish(); + }, + toProtoMsg(message: Members): MembersProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Members", + value: Members.encode(message).finish() + }; } - }; - function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { return { threshold: "", windows: undefined }; } - export const ThresholdDecisionPolicy = { - encode(message: ThresholdDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.threshold !== "") { writer.uint32(10).string(message.threshold); } - if (message.windows !== undefined) { DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ThresholdDecisionPolicy { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseThresholdDecisionPolicy(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.threshold = reader.string(); break; - case 2: message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ThresholdDecisionPolicy { + fromPartial(object: Partial): ThresholdDecisionPolicy { const message = createBaseThresholdDecisionPolicy(); message.threshold = object.threshold ?? ""; message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; return message; + }, + fromAmino(object: ThresholdDecisionPolicyAmino): ThresholdDecisionPolicy { + const message = createBaseThresholdDecisionPolicy(); + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.windows !== undefined && object.windows !== null) { + message.windows = DecisionPolicyWindows.fromAmino(object.windows); + } + return message; + }, + toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { + const obj: any = {}; + obj.threshold = message.threshold; + obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; + return obj; + }, + fromAminoMsg(object: ThresholdDecisionPolicyAminoMsg): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: ThresholdDecisionPolicyProtoMsg): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.decode(message.value); + }, + toProto(message: ThresholdDecisionPolicy): Uint8Array { + return ThresholdDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.encode(message).finish() + }; } - }; - function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { return { percentage: "", windows: undefined }; } - export const PercentageDecisionPolicy = { - encode(message: PercentageDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + encode(message: PercentageDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.percentage !== "") { writer.uint32(10).string(message.percentage); } - if (message.windows !== undefined) { DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PercentageDecisionPolicy { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePercentageDecisionPolicy(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.percentage = reader.string(); break; - case 2: message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PercentageDecisionPolicy { + fromPartial(object: Partial): PercentageDecisionPolicy { const message = createBasePercentageDecisionPolicy(); message.percentage = object.percentage ?? ""; message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; return message; + }, + fromAmino(object: PercentageDecisionPolicyAmino): PercentageDecisionPolicy { + const message = createBasePercentageDecisionPolicy(); + if (object.percentage !== undefined && object.percentage !== null) { + message.percentage = object.percentage; + } + if (object.windows !== undefined && object.windows !== null) { + message.windows = DecisionPolicyWindows.fromAmino(object.windows); + } + return message; + }, + toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { + const obj: any = {}; + obj.percentage = message.percentage; + obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; + return obj; + }, + fromAminoMsg(object: PercentageDecisionPolicyAminoMsg): PercentageDecisionPolicy { + return PercentageDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: PercentageDecisionPolicy): PercentageDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/PercentageDecisionPolicy", + value: PercentageDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: PercentageDecisionPolicyProtoMsg): PercentageDecisionPolicy { + return PercentageDecisionPolicy.decode(message.value); + }, + toProto(message: PercentageDecisionPolicy): Uint8Array { + return PercentageDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: PercentageDecisionPolicy): PercentageDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + value: PercentageDecisionPolicy.encode(message).finish() + }; } - }; - function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { return { - votingPeriod: undefined, - minExecutionPeriod: undefined + votingPeriod: Duration.fromPartial({}), + minExecutionPeriod: Duration.fromPartial({}) }; } - export const DecisionPolicyWindows = { - encode(message: DecisionPolicyWindows, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", + encode(message: DecisionPolicyWindows, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); } - if (message.minExecutionPeriod !== undefined) { Duration.encode(message.minExecutionPeriod, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DecisionPolicyWindows { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDecisionPolicyWindows(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.votingPeriod = Duration.decode(reader, reader.uint32()); break; - case 2: message.minExecutionPeriod = Duration.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DecisionPolicyWindows { + fromPartial(object: Partial): DecisionPolicyWindows { const message = createBaseDecisionPolicyWindows(); message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; message.minExecutionPeriod = object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null ? Duration.fromPartial(object.minExecutionPeriod) : undefined; return message; + }, + fromAmino(object: DecisionPolicyWindowsAmino): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + if (object.min_execution_period !== undefined && object.min_execution_period !== null) { + message.minExecutionPeriod = Duration.fromAmino(object.min_execution_period); + } + return message; + }, + toAmino(message: DecisionPolicyWindows): DecisionPolicyWindowsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + obj.min_execution_period = message.minExecutionPeriod ? Duration.toAmino(message.minExecutionPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: DecisionPolicyWindowsAminoMsg): DecisionPolicyWindows { + return DecisionPolicyWindows.fromAmino(object.value); + }, + toAminoMsg(message: DecisionPolicyWindows): DecisionPolicyWindowsAminoMsg { + return { + type: "cosmos-sdk/DecisionPolicyWindows", + value: DecisionPolicyWindows.toAmino(message) + }; + }, + fromProtoMsg(message: DecisionPolicyWindowsProtoMsg): DecisionPolicyWindows { + return DecisionPolicyWindows.decode(message.value); + }, + toProto(message: DecisionPolicyWindows): Uint8Array { + return DecisionPolicyWindows.encode(message).finish(); + }, + toProtoMsg(message: DecisionPolicyWindows): DecisionPolicyWindowsProtoMsg { + return { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", + value: DecisionPolicyWindows.encode(message).finish() + }; } - }; - function createBaseGroupInfo(): GroupInfo { return { - id: Long.UZERO, + id: BigInt(0), admin: "", metadata: "", - version: Long.UZERO, + version: BigInt(0), totalWeight: "", - createdAt: undefined + createdAt: new Date() }; } - export const GroupInfo = { - encode(message: GroupInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.id.isZero()) { + typeUrl: "/cosmos.group.v1.GroupInfo", + encode(message: GroupInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); } - if (message.admin !== "") { writer.uint32(18).string(message.admin); } - if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - - if (!message.version.isZero()) { + if (message.version !== BigInt(0)) { writer.uint32(32).uint64(message.version); } - if (message.totalWeight !== "") { writer.uint32(42).string(message.totalWeight); } - if (message.createdAt !== undefined) { Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GroupInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGroupInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.id = (reader.uint64() as Long); + message.id = reader.uint64(); break; - case 2: message.admin = reader.string(); break; - case 3: message.metadata = reader.string(); break; - case 4: - message.version = (reader.uint64() as Long); + message.version = reader.uint64(); break; - case 5: message.totalWeight = reader.string(); break; - case 6: message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GroupInfo { + fromPartial(object: Partial): GroupInfo { const message = createBaseGroupInfo(); - message.id = object.id !== undefined && object.id !== null ? Long.fromValue(object.id) : Long.UZERO; + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); message.admin = object.admin ?? ""; message.metadata = object.metadata ?? ""; - message.version = object.version !== undefined && object.version !== null ? Long.fromValue(object.version) : Long.UZERO; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); message.totalWeight = object.totalWeight ?? ""; message.createdAt = object.createdAt ?? undefined; return message; + }, + fromAmino(object: GroupInfoAmino): GroupInfo { + const message = createBaseGroupInfo(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.total_weight !== undefined && object.total_weight !== null) { + message.totalWeight = object.total_weight; + } + if (object.created_at !== undefined && object.created_at !== null) { + message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); + } + return message; + }, + toAmino(message: GroupInfo): GroupInfoAmino { + const obj: any = {}; + obj.id = message.id ? message.id.toString() : undefined; + obj.admin = message.admin; + obj.metadata = message.metadata; + obj.version = message.version ? message.version.toString() : undefined; + obj.total_weight = message.totalWeight; + obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; + return obj; + }, + fromAminoMsg(object: GroupInfoAminoMsg): GroupInfo { + return GroupInfo.fromAmino(object.value); + }, + toAminoMsg(message: GroupInfo): GroupInfoAminoMsg { + return { + type: "cosmos-sdk/GroupInfo", + value: GroupInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GroupInfoProtoMsg): GroupInfo { + return GroupInfo.decode(message.value); + }, + toProto(message: GroupInfo): Uint8Array { + return GroupInfo.encode(message).finish(); + }, + toProtoMsg(message: GroupInfo): GroupInfoProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupInfo", + value: GroupInfo.encode(message).finish() + }; } - }; - function createBaseGroupMember(): GroupMember { return { - groupId: Long.UZERO, + groupId: BigInt(0), member: undefined }; } - export const GroupMember = { - encode(message: GroupMember, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.groupId.isZero()) { + typeUrl: "/cosmos.group.v1.GroupMember", + encode(message: GroupMember, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - if (message.member !== undefined) { Member.encode(message.member, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GroupMember { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGroupMember(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 2: message.member = Member.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GroupMember { + fromPartial(object: Partial): GroupMember { const message = createBaseGroupMember(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.member = object.member !== undefined && object.member !== null ? Member.fromPartial(object.member) : undefined; return message; + }, + fromAmino(object: GroupMemberAmino): GroupMember { + const message = createBaseGroupMember(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.member !== undefined && object.member !== null) { + message.member = Member.fromAmino(object.member); + } + return message; + }, + toAmino(message: GroupMember): GroupMemberAmino { + const obj: any = {}; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.member = message.member ? Member.toAmino(message.member) : undefined; + return obj; + }, + fromAminoMsg(object: GroupMemberAminoMsg): GroupMember { + return GroupMember.fromAmino(object.value); + }, + toAminoMsg(message: GroupMember): GroupMemberAminoMsg { + return { + type: "cosmos-sdk/GroupMember", + value: GroupMember.toAmino(message) + }; + }, + fromProtoMsg(message: GroupMemberProtoMsg): GroupMember { + return GroupMember.decode(message.value); + }, + toProto(message: GroupMember): Uint8Array { + return GroupMember.encode(message).finish(); + }, + toProtoMsg(message: GroupMember): GroupMemberProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupMember", + value: GroupMember.encode(message).finish() + }; } - }; - function createBaseGroupPolicyInfo(): GroupPolicyInfo { return { address: "", - groupId: Long.UZERO, + groupId: BigInt(0), admin: "", metadata: "", - version: Long.UZERO, + version: BigInt(0), decisionPolicy: undefined, - createdAt: undefined + createdAt: new Date() }; } - export const GroupPolicyInfo = { - encode(message: GroupPolicyInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo", + encode(message: GroupPolicyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - - if (!message.groupId.isZero()) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - if (message.admin !== "") { writer.uint32(26).string(message.admin); } - if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } - - if (!message.version.isZero()) { + if (message.version !== BigInt(0)) { writer.uint32(40).uint64(message.version); } - if (message.decisionPolicy !== undefined) { Any.encode(message.decisionPolicy, writer.uint32(50).fork()).ldelim(); } - if (message.createdAt !== undefined) { Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GroupPolicyInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGroupPolicyInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: - message.groupId = (reader.uint64() as Long); + message.groupId = reader.uint64(); break; - case 3: message.admin = reader.string(); break; - case 4: message.metadata = reader.string(); break; - case 5: - message.version = (reader.uint64() as Long); + message.version = reader.uint64(); break; - case 6: message.decisionPolicy = Any.decode(reader, reader.uint32()); break; - case 7: message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GroupPolicyInfo { + fromPartial(object: Partial): GroupPolicyInfo { const message = createBaseGroupPolicyInfo(); message.address = object.address ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? Long.fromValue(object.groupId) : Long.UZERO; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.admin = object.admin ?? ""; message.metadata = object.metadata ?? ""; - message.version = object.version !== undefined && object.version !== null ? Long.fromValue(object.version) : Long.UZERO; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; message.createdAt = object.createdAt ?? undefined; return message; + }, + fromAmino(object: GroupPolicyInfoAmino): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = Any.fromAmino(object.decision_policy); + } + if (object.created_at !== undefined && object.created_at !== null) { + message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); + } + return message; + }, + toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { + const obj: any = {}; + obj.address = message.address; + obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.admin = message.admin; + obj.metadata = message.metadata; + obj.version = message.version ? message.version.toString() : undefined; + obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; + obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; + return obj; + }, + fromAminoMsg(object: GroupPolicyInfoAminoMsg): GroupPolicyInfo { + return GroupPolicyInfo.fromAmino(object.value); + }, + toAminoMsg(message: GroupPolicyInfo): GroupPolicyInfoAminoMsg { + return { + type: "cosmos-sdk/GroupPolicyInfo", + value: GroupPolicyInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GroupPolicyInfoProtoMsg): GroupPolicyInfo { + return GroupPolicyInfo.decode(message.value); + }, + toProto(message: GroupPolicyInfo): Uint8Array { + return GroupPolicyInfo.encode(message).finish(); + }, + toProtoMsg(message: GroupPolicyInfo): GroupPolicyInfoProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo", + value: GroupPolicyInfo.encode(message).finish() + }; } - }; - function createBaseProposal(): Proposal { return { - id: Long.UZERO, + id: BigInt(0), address: "", metadata: "", proposers: [], - submitTime: undefined, - groupVersion: Long.UZERO, - groupPolicyVersion: Long.UZERO, + submitTime: new Date(), + groupVersion: BigInt(0), + groupPolicyVersion: BigInt(0), status: 0, result: 0, - finalTallyResult: undefined, - votingPeriodEnd: undefined, + finalTallyResult: TallyResult.fromPartial({}), + votingPeriodEnd: new Date(), executorResult: 0, messages: [] }; } - export const Proposal = { - encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.id.isZero()) { + typeUrl: "/cosmos.group.v1.Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); } - if (message.address !== "") { writer.uint32(18).string(message.address); } - if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - for (const v of message.proposers) { writer.uint32(34).string(v!); } - if (message.submitTime !== undefined) { Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); } - - if (!message.groupVersion.isZero()) { + if (message.groupVersion !== BigInt(0)) { writer.uint32(48).uint64(message.groupVersion); } - - if (!message.groupPolicyVersion.isZero()) { + if (message.groupPolicyVersion !== BigInt(0)) { writer.uint32(56).uint64(message.groupPolicyVersion); } - if (message.status !== 0) { writer.uint32(64).int32(message.status); } - if (message.result !== 0) { writer.uint32(72).int32(message.result); } - if (message.finalTallyResult !== undefined) { TallyResult.encode(message.finalTallyResult, writer.uint32(82).fork()).ldelim(); } - if (message.votingPeriodEnd !== undefined) { Timestamp.encode(toTimestamp(message.votingPeriodEnd), writer.uint32(90).fork()).ldelim(); } - if (message.executorResult !== 0) { writer.uint32(96).int32(message.executorResult); } - for (const v of message.messages) { Any.encode(v!, writer.uint32(106).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.id = (reader.uint64() as Long); + message.id = reader.uint64(); break; - case 2: message.address = reader.string(); break; - case 3: message.metadata = reader.string(); break; - case 4: message.proposers.push(reader.string()); break; - case 5: message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 6: - message.groupVersion = (reader.uint64() as Long); + message.groupVersion = reader.uint64(); break; - case 7: - message.groupPolicyVersion = (reader.uint64() as Long); + message.groupPolicyVersion = reader.uint64(); break; - case 8: message.status = (reader.int32() as any); break; - case 9: message.result = (reader.int32() as any); break; - case 10: message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); break; - case 11: message.votingPeriodEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 12: message.executorResult = (reader.int32() as any); break; - case 13: message.messages.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Proposal { + fromPartial(object: Partial): Proposal { const message = createBaseProposal(); - message.id = object.id !== undefined && object.id !== null ? Long.fromValue(object.id) : Long.UZERO; + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); message.address = object.address ?? ""; message.metadata = object.metadata ?? ""; message.proposers = object.proposers?.map(e => e) || []; message.submitTime = object.submitTime ?? undefined; - message.groupVersion = object.groupVersion !== undefined && object.groupVersion !== null ? Long.fromValue(object.groupVersion) : Long.UZERO; - message.groupPolicyVersion = object.groupPolicyVersion !== undefined && object.groupPolicyVersion !== null ? Long.fromValue(object.groupPolicyVersion) : Long.UZERO; + message.groupVersion = object.groupVersion !== undefined && object.groupVersion !== null ? BigInt(object.groupVersion.toString()) : BigInt(0); + message.groupPolicyVersion = object.groupPolicyVersion !== undefined && object.groupPolicyVersion !== null ? BigInt(object.groupPolicyVersion.toString()) : BigInt(0); message.status = object.status ?? 0; message.result = object.result ?? 0; message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; @@ -1493,10 +1653,93 @@ export const Proposal = { message.executorResult = object.executorResult ?? 0; message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + message.proposers = object.proposers?.map(e => e) || []; + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.group_version !== undefined && object.group_version !== null) { + message.groupVersion = BigInt(object.group_version); + } + if (object.group_policy_version !== undefined && object.group_policy_version !== null) { + message.groupPolicyVersion = BigInt(object.group_policy_version); + } + if (object.status !== undefined && object.status !== null) { + message.status = proposalStatusFromJSON(object.status); + } + if (object.result !== undefined && object.result !== null) { + message.result = proposalResultFromJSON(object.result); + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.voting_period_end !== undefined && object.voting_period_end !== null) { + message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); + } + if (object.executor_result !== undefined && object.executor_result !== null) { + message.executorResult = proposalExecutorResultFromJSON(object.executor_result); + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.id = message.id ? message.id.toString() : undefined; + obj.address = message.address; + obj.metadata = message.metadata; + if (message.proposers) { + obj.proposers = message.proposers.map(e => e); + } else { + obj.proposers = []; + } + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; + obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; + obj.status = proposalStatusToJSON(message.status); + obj.result = proposalResultToJSON(message.result); + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; + obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : undefined; + obj.executor_result = proposalExecutorResultToJSON(message.executorResult); + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = []; + } + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Proposal", + value: Proposal.encode(message).finish() + }; } - }; - function createBaseTallyResult(): TallyResult { return { yesCount: "", @@ -1505,154 +1748,217 @@ function createBaseTallyResult(): TallyResult { noWithVetoCount: "" }; } - export const TallyResult = { - encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.group.v1.TallyResult", + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yesCount !== "") { writer.uint32(10).string(message.yesCount); } - if (message.abstainCount !== "") { writer.uint32(18).string(message.abstainCount); } - if (message.noCount !== "") { writer.uint32(26).string(message.noCount); } - if (message.noWithVetoCount !== "") { writer.uint32(34).string(message.noWithVetoCount); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTallyResult(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.yesCount = reader.string(); break; - case 2: message.abstainCount = reader.string(); break; - case 3: message.noCount = reader.string(); break; - case 4: message.noWithVetoCount = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TallyResult { + fromPartial(object: Partial): TallyResult { const message = createBaseTallyResult(); message.yesCount = object.yesCount ?? ""; message.abstainCount = object.abstainCount ?? ""; message.noCount = object.noCount ?? ""; message.noWithVetoCount = object.noWithVetoCount ?? ""; return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes_count !== undefined && object.yes_count !== null) { + message.yesCount = object.yes_count; + } + if (object.abstain_count !== undefined && object.abstain_count !== null) { + message.abstainCount = object.abstain_count; + } + if (object.no_count !== undefined && object.no_count !== null) { + message.noCount = object.no_count; + } + if (object.no_with_veto_count !== undefined && object.no_with_veto_count !== null) { + message.noWithVetoCount = object.no_with_veto_count; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes_count = message.yesCount; + obj.abstain_count = message.abstainCount; + obj.no_count = message.noCount; + obj.no_with_veto_count = message.noWithVetoCount; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.group.v1.TallyResult", + value: TallyResult.encode(message).finish() + }; } - }; - function createBaseVote(): Vote { return { - proposalId: Long.UZERO, + proposalId: BigInt(0), voter: "", option: 0, metadata: "", - submitTime: undefined + submitTime: new Date() }; } - export const Vote = { - encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.proposalId.isZero()) { + typeUrl: "/cosmos.group.v1.Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - if (message.option !== 0) { writer.uint32(24).int32(message.option); } - if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } - if (message.submitTime !== undefined) { Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Vote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.proposalId = (reader.uint64() as Long); + message.proposalId = reader.uint64(); break; - case 2: message.voter = reader.string(); break; - case 3: message.option = (reader.int32() as any); break; - case 4: message.metadata = reader.string(); break; - case 5: message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Vote { + fromPartial(object: Partial): Vote { const message = createBaseVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? Long.fromValue(object.proposalId) : Long.UZERO; + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.option = object.option ?? 0; message.metadata = object.metadata ?? ""; message.submitTime = object.submitTime ?? undefined; return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = voteOptionFromJSON(object.option); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter; + obj.option = voteOptionToJSON(message.option); + obj.metadata = message.metadata; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Vote", + value: Vote.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/lcd.ts b/src/codegen/cosmos/lcd.ts index 954fcdf..4299781 100644 --- a/src/codegen/cosmos/lcd.ts +++ b/src/codegen/cosmos/lcd.ts @@ -1,4 +1,4 @@ -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; export const createLCDClient = async ({ restEndpoint }: { diff --git a/src/codegen/cosmos/mint/v1beta1/genesis.ts b/src/codegen/cosmos/mint/v1beta1/genesis.ts index 4816451..b0cf028 100644 --- a/src/codegen/cosmos/mint/v1beta1/genesis.ts +++ b/src/codegen/cosmos/mint/v1beta1/genesis.ts @@ -1,76 +1,110 @@ -import { Minter, MinterSDKType, Params, ParamsSDKType } from "./mint"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the mint module's genesis state. */ - export interface GenesisState { /** minter is a space for holding current inflation information. */ - minter?: Minter; + minter: Minter; /** params defines all the paramaters of the module. */ - - params?: Params; + params: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.GenesisState"; + value: Uint8Array; } /** GenesisState defines the mint module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** minter is a space for holding current inflation information. */ - minter?: MinterSDKType; + minter?: MinterAmino; /** params defines all the paramaters of the module. */ - - params?: ParamsSDKType; + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the mint module's genesis state. */ +export interface GenesisStateSDKType { + minter: MinterSDKType; + params: ParamsSDKType; } - function createBaseGenesisState(): GenesisState { return { - minter: undefined, - params: undefined + minter: Minter.fromPartial({}), + params: Params.fromPartial({}) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.minter !== undefined) { Minter.encode(message.minter, writer.uint32(10).fork()).ldelim(); } - if (message.params !== undefined) { Params.encode(message.params, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.minter = Minter.decode(reader, reader.uint32()); break; - case 2: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): 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; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.minter !== undefined && object.minter !== null) { + message.minter = Minter.fromAmino(object.minter); + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/mint/v1beta1/mint.ts b/src/codegen/cosmos/mint/v1beta1/mint.ts index a31d9e5..ce6219e 100644 --- a/src/codegen/cosmos/mint/v1beta1/mint.ts +++ b/src/codegen/cosmos/mint/v1beta1/mint.ts @@ -1,121 +1,160 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; /** Minter represents the minting state. */ - export interface Minter { /** current annual inflation rate */ inflation: string; /** current annual expected provisions */ - annualProvisions: string; } +export interface MinterProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.Minter"; + value: Uint8Array; +} /** Minter represents the minting state. */ - -export interface MinterSDKType { +export interface MinterAmino { /** current annual inflation rate */ - inflation: string; + inflation?: string; /** current annual expected provisions */ - + annual_provisions?: string; +} +export interface MinterAminoMsg { + type: "cosmos-sdk/Minter"; + value: MinterAmino; +} +/** Minter represents the minting state. */ +export interface MinterSDKType { + inflation: string; annual_provisions: string; } /** Params holds parameters for the 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: Long; + blocksPerYear: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.Params"; + value: Uint8Array; } /** Params holds parameters for the mint module. */ - -export interface ParamsSDKType { +export interface ParamsAmino { /** type of coin to mint */ - mint_denom: string; + mint_denom?: string; /** maximum annual change in inflation rate */ - - inflation_rate_change: string; + inflation_rate_change?: string; /** maximum inflation rate */ - - inflation_max: string; + inflation_max?: string; /** minimum inflation rate */ - - inflation_min: string; + inflation_min?: string; /** goal of percent bonded atoms */ - - goal_bonded: string; + goal_bonded?: string; /** expected blocks per year */ - - blocks_per_year: Long; + blocks_per_year?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** Params holds parameters for the mint module. */ +export interface ParamsSDKType { + mint_denom: string; + inflation_rate_change: string; + inflation_max: string; + inflation_min: string; + goal_bonded: string; + blocks_per_year: bigint; } - function createBaseMinter(): Minter { return { inflation: "", annualProvisions: "" }; } - export const Minter = { - encode(message: Minter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.Minter", + encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflation !== "") { - writer.uint32(10).string(message.inflation); + writer.uint32(10).string(Decimal.fromUserInput(message.inflation, 18).atomics); } - if (message.annualProvisions !== "") { - writer.uint32(18).string(message.annualProvisions); + writer.uint32(18).string(Decimal.fromUserInput(message.annualProvisions, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Minter { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.inflation = reader.string(); + message.inflation = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 2: - message.annualProvisions = reader.string(); + message.annualProvisions = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Minter { + fromPartial(object: Partial): Minter { const message = createBaseMinter(); message.inflation = object.inflation ?? ""; message.annualProvisions = object.annualProvisions ?? ""; return message; + }, + fromAmino(object: MinterAmino): Minter { + const message = createBaseMinter(); + if (object.inflation !== undefined && object.inflation !== null) { + message.inflation = object.inflation; + } + if (object.annual_provisions !== undefined && object.annual_provisions !== null) { + message.annualProvisions = object.annual_provisions; + } + return message; + }, + toAmino(message: Minter): MinterAmino { + const obj: any = {}; + obj.inflation = message.inflation; + obj.annual_provisions = message.annualProvisions; + return obj; + }, + fromAminoMsg(object: MinterAminoMsg): Minter { + return Minter.fromAmino(object.value); + }, + toAminoMsg(message: Minter): MinterAminoMsg { + return { + type: "cosmos-sdk/Minter", + value: Minter.toAmino(message) + }; + }, + fromProtoMsg(message: MinterProtoMsg): Minter { + return Minter.decode(message.value); + }, + toProto(message: Minter): Uint8Array { + return Minter.encode(message).finish(); + }, + toProtoMsg(message: Minter): MinterProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.Minter", + value: Minter.encode(message).finish() + }; } - }; - function createBaseParams(): Params { return { mintDenom: "", @@ -123,90 +162,125 @@ function createBaseParams(): Params { inflationMax: "", inflationMin: "", goalBonded: "", - blocksPerYear: Long.UZERO + blocksPerYear: BigInt(0) }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); } - if (message.inflationRateChange !== "") { - writer.uint32(18).string(message.inflationRateChange); + writer.uint32(18).string(Decimal.fromUserInput(message.inflationRateChange, 18).atomics); } - if (message.inflationMax !== "") { - writer.uint32(26).string(message.inflationMax); + writer.uint32(26).string(Decimal.fromUserInput(message.inflationMax, 18).atomics); } - if (message.inflationMin !== "") { - writer.uint32(34).string(message.inflationMin); + writer.uint32(34).string(Decimal.fromUserInput(message.inflationMin, 18).atomics); } - if (message.goalBonded !== "") { - writer.uint32(42).string(message.goalBonded); + writer.uint32(42).string(Decimal.fromUserInput(message.goalBonded, 18).atomics); } - - if (!message.blocksPerYear.isZero()) { + if (message.blocksPerYear !== BigInt(0)) { writer.uint32(48).uint64(message.blocksPerYear); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.mintDenom = reader.string(); break; - case 2: - message.inflationRateChange = reader.string(); + message.inflationRateChange = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 3: - message.inflationMax = reader.string(); + message.inflationMax = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 4: - message.inflationMin = reader.string(); + message.inflationMin = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 5: - message.goalBonded = reader.string(); + message.goalBonded = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 6: - message.blocksPerYear = (reader.uint64() as Long); + message.blocksPerYear = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): 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 !== undefined && object.blocksPerYear !== null ? Long.fromValue(object.blocksPerYear) : Long.UZERO; + message.blocksPerYear = object.blocksPerYear !== undefined && object.blocksPerYear !== null ? BigInt(object.blocksPerYear.toString()) : BigInt(0); return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.mint_denom !== undefined && object.mint_denom !== null) { + message.mintDenom = object.mint_denom; + } + if (object.inflation_rate_change !== undefined && object.inflation_rate_change !== null) { + message.inflationRateChange = object.inflation_rate_change; + } + if (object.inflation_max !== undefined && object.inflation_max !== null) { + message.inflationMax = object.inflation_max; + } + if (object.inflation_min !== undefined && object.inflation_min !== null) { + message.inflationMin = object.inflation_min; + } + if (object.goal_bonded !== undefined && object.goal_bonded !== null) { + message.goalBonded = object.goal_bonded; + } + if (object.blocks_per_year !== undefined && object.blocks_per_year !== null) { + message.blocksPerYear = BigInt(object.blocks_per_year); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.mint_denom = message.mintDenom; + obj.inflation_rate_change = message.inflationRateChange; + obj.inflation_max = message.inflationMax; + obj.inflation_min = message.inflationMin; + obj.goal_bonded = message.goalBonded; + obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.Params", + value: Params.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/mint/v1beta1/query.lcd.ts b/src/codegen/cosmos/mint/v1beta1/query.lcd.ts index 9208604..ad985b0 100644 --- a/src/codegen/cosmos/mint/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/mint/v1beta1/query.lcd.ts @@ -1,8 +1,7 @@ -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryParamsRequest, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -14,25 +13,18 @@ export class LCDQueryClient { this.annualProvisions = this.annualProvisions.bind(this); } /* Params returns the total set of minting parameters. */ - - async params(_params: QueryParamsRequest = {}): Promise { const endpoint = `cosmos/mint/v1beta1/params`; return await this.req.get(endpoint); } /* Inflation returns the current minting inflation value. */ - - async inflation(_params: QueryInflationRequest = {}): Promise { const endpoint = `cosmos/mint/v1beta1/inflation`; return await this.req.get(endpoint); } /* AnnualProvisions current minting annual provisions value. */ - - async annualProvisions(_params: QueryAnnualProvisionsRequest = {}): Promise { const endpoint = `cosmos/mint/v1beta1/annual_provisions`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/mint/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/mint/v1beta1/query.rpc.Query.ts index 4e7ca73..71e9177 100644 --- a/src/codegen/cosmos/mint/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/mint/v1beta1/query.rpc.Query.ts @@ -1,47 +1,39 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsResponse, QueryInflationRequest, QueryInflationResponse, QueryAnnualProvisionsRequest, QueryAnnualProvisionsResponse } from "./query"; /** Query provides defines the gRPC querier service. */ - export interface Query { /** Params returns the total set of minting parameters. */ params(request?: QueryParamsRequest): Promise; /** Inflation returns the current minting inflation value. */ - inflation(request?: QueryInflationRequest): Promise; /** AnnualProvisions current minting annual provisions value. */ - annualProvisions(request?: QueryAnnualProvisionsRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.mint.v1beta1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(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("cosmos.mint.v1beta1.Query", "Inflation", data); - return promise.then(data => QueryInflationResponse.decode(new _m0.Reader(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("cosmos.mint.v1beta1.Query", "AnnualProvisions", data); - return promise.then(data => QueryAnnualProvisionsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAnnualProvisionsResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -50,14 +42,11 @@ export const createRpcQueryExtension = (base: QueryClient) => { params(request?: QueryParamsRequest): Promise { return queryService.params(request); }, - inflation(request?: QueryInflationRequest): Promise { return queryService.inflation(request); }, - annualProvisions(request?: QueryAnnualProvisionsRequest): Promise { return queryService.annualProvisions(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/mint/v1beta1/query.ts b/src/codegen/cosmos/mint/v1beta1/query.ts index 1b02f77..5039128 100644 --- a/src/codegen/cosmos/mint/v1beta1/query.ts +++ b/src/codegen/cosmos/mint/v1beta1/query.ts @@ -1,312 +1,513 @@ -import { Params, ParamsSDKType } from "./mint"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Params, ParamsAmino, ParamsSDKType } from "./mint"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - export interface QueryParamsRequestSDKType {} /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** params defines the parameters of the module. */ - params?: Params; + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse"; + value: Uint8Array; } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** params defines the parameters of the module. */ - params?: ParamsSDKType; + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; } /** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ - export interface QueryInflationRequest {} +export interface QueryInflationRequestProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest"; + value: Uint8Array; +} +/** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ +export interface QueryInflationRequestAmino {} +export interface QueryInflationRequestAminoMsg { + type: "cosmos-sdk/QueryInflationRequest"; + value: QueryInflationRequestAmino; +} /** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ - export interface QueryInflationRequestSDKType {} /** * QueryInflationResponse is the response type for the Query/Inflation RPC * method. */ - export interface QueryInflationResponse { /** inflation is the current minting inflation value. */ inflation: Uint8Array; } +export interface QueryInflationResponseProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse"; + value: Uint8Array; +} /** * QueryInflationResponse is the response type for the Query/Inflation RPC * method. */ - -export interface QueryInflationResponseSDKType { +export interface QueryInflationResponseAmino { /** inflation is the current minting inflation value. */ + inflation?: string; +} +export interface QueryInflationResponseAminoMsg { + type: "cosmos-sdk/QueryInflationResponse"; + value: QueryInflationResponseAmino; +} +/** + * QueryInflationResponse is the response type for the Query/Inflation RPC + * method. + */ +export interface QueryInflationResponseSDKType { inflation: Uint8Array; } /** * QueryAnnualProvisionsRequest is the request type for the * Query/AnnualProvisions RPC method. */ - export interface QueryAnnualProvisionsRequest {} +export interface QueryAnnualProvisionsRequestProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest"; + value: Uint8Array; +} +/** + * QueryAnnualProvisionsRequest is the request type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsRequestAmino {} +export interface QueryAnnualProvisionsRequestAminoMsg { + type: "cosmos-sdk/QueryAnnualProvisionsRequest"; + value: QueryAnnualProvisionsRequestAmino; +} /** * QueryAnnualProvisionsRequest is the request type for the * Query/AnnualProvisions RPC method. */ - export interface QueryAnnualProvisionsRequestSDKType {} /** * 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; } +export interface QueryAnnualProvisionsResponseProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse"; + value: Uint8Array; +} /** * QueryAnnualProvisionsResponse is the response type for the * Query/AnnualProvisions RPC method. */ - -export interface QueryAnnualProvisionsResponseSDKType { +export interface QueryAnnualProvisionsResponseAmino { /** annual_provisions is the current minting annual provisions value. */ + annual_provisions?: string; +} +export interface QueryAnnualProvisionsResponseAminoMsg { + type: "cosmos-sdk/QueryAnnualProvisionsResponse"; + value: QueryAnnualProvisionsResponseAmino; +} +/** + * QueryAnnualProvisionsResponse is the response type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsResponseSDKType { annual_provisions: Uint8Array; } - function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } - export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParamsRequest { + fromPartial(_: Partial): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + params: Params.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryInflationRequest(): QueryInflationRequest { return {}; } - export const QueryInflationRequest = { - encode(_: QueryInflationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", + encode(_: QueryInflationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryInflationRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryInflationRequest { + fromPartial(_: Partial): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, + fromAmino(_: QueryInflationRequestAmino): QueryInflationRequest { const message = createBaseQueryInflationRequest(); return message; + }, + toAmino(_: QueryInflationRequest): QueryInflationRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryInflationRequestAminoMsg): QueryInflationRequest { + return QueryInflationRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryInflationRequest): QueryInflationRequestAminoMsg { + return { + type: "cosmos-sdk/QueryInflationRequest", + value: QueryInflationRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryInflationRequestProtoMsg): QueryInflationRequest { + return QueryInflationRequest.decode(message.value); + }, + toProto(message: QueryInflationRequest): Uint8Array { + return QueryInflationRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryInflationRequest): QueryInflationRequestProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", + value: QueryInflationRequest.encode(message).finish() + }; } - }; - function createBaseQueryInflationResponse(): QueryInflationResponse { return { inflation: new Uint8Array() }; } - export const QueryInflationResponse = { - encode(message: QueryInflationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", + encode(message: QueryInflationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflation.length !== 0) { writer.uint32(10).bytes(message.inflation); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryInflationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.inflation = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryInflationResponse { + fromPartial(object: Partial): QueryInflationResponse { const message = createBaseQueryInflationResponse(); message.inflation = object.inflation ?? new Uint8Array(); return message; + }, + fromAmino(object: QueryInflationResponseAmino): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + if (object.inflation !== undefined && object.inflation !== null) { + message.inflation = bytesFromBase64(object.inflation); + } + return message; + }, + toAmino(message: QueryInflationResponse): QueryInflationResponseAmino { + const obj: any = {}; + obj.inflation = message.inflation ? base64FromBytes(message.inflation) : undefined; + return obj; + }, + fromAminoMsg(object: QueryInflationResponseAminoMsg): QueryInflationResponse { + return QueryInflationResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryInflationResponse): QueryInflationResponseAminoMsg { + return { + type: "cosmos-sdk/QueryInflationResponse", + value: QueryInflationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryInflationResponseProtoMsg): QueryInflationResponse { + return QueryInflationResponse.decode(message.value); + }, + toProto(message: QueryInflationResponse): Uint8Array { + return QueryInflationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryInflationResponse): QueryInflationResponseProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", + value: QueryInflationResponse.encode(message).finish() + }; } - }; - function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { return {}; } - export const QueryAnnualProvisionsRequest = { - encode(_: QueryAnnualProvisionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", + encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryAnnualProvisionsRequest { + fromPartial(_: Partial): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, + fromAmino(_: QueryAnnualProvisionsRequestAmino): QueryAnnualProvisionsRequest { const message = createBaseQueryAnnualProvisionsRequest(); return message; + }, + toAmino(_: QueryAnnualProvisionsRequest): QueryAnnualProvisionsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryAnnualProvisionsRequestAminoMsg): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAnnualProvisionsRequest): QueryAnnualProvisionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAnnualProvisionsRequest", + value: QueryAnnualProvisionsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAnnualProvisionsRequestProtoMsg): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.decode(message.value); + }, + toProto(message: QueryAnnualProvisionsRequest): Uint8Array { + return QueryAnnualProvisionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAnnualProvisionsRequest): QueryAnnualProvisionsRequestProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", + value: QueryAnnualProvisionsRequest.encode(message).finish() + }; } - }; - function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { return { annualProvisions: new Uint8Array() }; } - export const QueryAnnualProvisionsResponse = { - encode(message: QueryAnnualProvisionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", + encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.annualProvisions.length !== 0) { writer.uint32(10).bytes(message.annualProvisions); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.annualProvisions = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAnnualProvisionsResponse { + fromPartial(object: Partial): QueryAnnualProvisionsResponse { const message = createBaseQueryAnnualProvisionsResponse(); message.annualProvisions = object.annualProvisions ?? new Uint8Array(); return message; + }, + fromAmino(object: QueryAnnualProvisionsResponseAmino): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + if (object.annual_provisions !== undefined && object.annual_provisions !== null) { + message.annualProvisions = bytesFromBase64(object.annual_provisions); + } + return message; + }, + toAmino(message: QueryAnnualProvisionsResponse): QueryAnnualProvisionsResponseAmino { + const obj: any = {}; + obj.annual_provisions = message.annualProvisions ? base64FromBytes(message.annualProvisions) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAnnualProvisionsResponseAminoMsg): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAnnualProvisionsResponse): QueryAnnualProvisionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAnnualProvisionsResponse", + value: QueryAnnualProvisionsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAnnualProvisionsResponseProtoMsg): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.decode(message.value); + }, + toProto(message: QueryAnnualProvisionsResponse): Uint8Array { + return QueryAnnualProvisionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAnnualProvisionsResponse): QueryAnnualProvisionsResponseProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", + value: QueryAnnualProvisionsResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/event.ts b/src/codegen/cosmos/nft/v1beta1/event.ts index 88a73f5..217a8b5 100644 --- a/src/codegen/cosmos/nft/v1beta1/event.ts +++ b/src/codegen/cosmos/nft/v1beta1/event.ts @@ -1,15 +1,27 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** EventSend is emitted on Msg/Send */ - export interface EventSend { classId: string; id: string; sender: string; receiver: string; } +export interface EventSendProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.EventSend"; + value: Uint8Array; +} +/** EventSend is emitted on Msg/Send */ +export interface EventSendAmino { + class_id?: string; + id?: string; + sender?: string; + receiver?: string; +} +export interface EventSendAminoMsg { + type: "cosmos-sdk/EventSend"; + value: EventSendAmino; +} /** EventSend is emitted on Msg/Send */ - export interface EventSendSDKType { class_id: string; id: string; @@ -17,34 +29,57 @@ export interface EventSendSDKType { receiver: string; } /** EventMint is emitted on Mint */ - export interface EventMint { classId: string; id: string; owner: string; } +export interface EventMintProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.EventMint"; + value: Uint8Array; +} +/** EventMint is emitted on Mint */ +export interface EventMintAmino { + class_id?: string; + id?: string; + owner?: string; +} +export interface EventMintAminoMsg { + type: "cosmos-sdk/EventMint"; + value: EventMintAmino; +} /** EventMint is emitted on Mint */ - export interface EventMintSDKType { class_id: string; id: string; owner: string; } /** EventBurn is emitted on Burn */ - export interface EventBurn { classId: string; id: string; owner: string; } +export interface EventBurnProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.EventBurn"; + value: Uint8Array; +} +/** EventBurn is emitted on Burn */ +export interface EventBurnAmino { + class_id?: string; + id?: string; + owner?: string; +} +export interface EventBurnAminoMsg { + type: "cosmos-sdk/EventBurn"; + value: EventBurnAmino; +} /** EventBurn is emitted on Burn */ - export interface EventBurnSDKType { class_id: string; id: string; owner: string; } - function createBaseEventSend(): EventSend { return { classId: "", @@ -53,73 +88,103 @@ function createBaseEventSend(): EventSend { receiver: "" }; } - export const EventSend = { - encode(message: EventSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.EventSend", + encode(message: EventSend, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): EventSend { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - case 2: message.id = reader.string(); break; - case 3: message.sender = reader.string(); break; - case 4: message.receiver = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventSend { + fromPartial(object: Partial): EventSend { const message = createBaseEventSend(); message.classId = object.classId ?? ""; message.id = object.id ?? ""; message.sender = object.sender ?? ""; message.receiver = object.receiver ?? ""; return message; + }, + fromAmino(object: EventSendAmino): EventSend { + const message = createBaseEventSend(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.receiver !== undefined && object.receiver !== null) { + message.receiver = object.receiver; + } + return message; + }, + toAmino(message: EventSend): EventSendAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.id = message.id; + obj.sender = message.sender; + obj.receiver = message.receiver; + return obj; + }, + fromAminoMsg(object: EventSendAminoMsg): EventSend { + return EventSend.fromAmino(object.value); + }, + toAminoMsg(message: EventSend): EventSendAminoMsg { + return { + type: "cosmos-sdk/EventSend", + value: EventSend.toAmino(message) + }; + }, + fromProtoMsg(message: EventSendProtoMsg): EventSend { + return EventSend.decode(message.value); + }, + toProto(message: EventSend): Uint8Array { + return EventSend.encode(message).finish(); + }, + toProtoMsg(message: EventSend): EventSendProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.EventSend", + value: EventSend.encode(message).finish() + }; } - }; - function createBaseEventMint(): EventMint { return { classId: "", @@ -127,64 +192,92 @@ function createBaseEventMint(): EventMint { owner: "" }; } - export const EventMint = { - encode(message: EventMint, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.EventMint", + encode(message: EventMint, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): EventMint { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - case 2: message.id = reader.string(); break; - case 3: message.owner = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventMint { + fromPartial(object: Partial): EventMint { const message = createBaseEventMint(); message.classId = object.classId ?? ""; message.id = object.id ?? ""; message.owner = object.owner ?? ""; return message; + }, + fromAmino(object: EventMintAmino): EventMint { + const message = createBaseEventMint(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + return message; + }, + toAmino(message: EventMint): EventMintAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.id = message.id; + obj.owner = message.owner; + return obj; + }, + fromAminoMsg(object: EventMintAminoMsg): EventMint { + return EventMint.fromAmino(object.value); + }, + toAminoMsg(message: EventMint): EventMintAminoMsg { + return { + type: "cosmos-sdk/EventMint", + value: EventMint.toAmino(message) + }; + }, + fromProtoMsg(message: EventMintProtoMsg): EventMint { + return EventMint.decode(message.value); + }, + toProto(message: EventMint): Uint8Array { + return EventMint.encode(message).finish(); + }, + toProtoMsg(message: EventMint): EventMintProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.EventMint", + value: EventMint.encode(message).finish() + }; } - }; - function createBaseEventBurn(): EventBurn { return { classId: "", @@ -192,60 +285,89 @@ function createBaseEventBurn(): EventBurn { owner: "" }; } - export const EventBurn = { - encode(message: EventBurn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.EventBurn", + encode(message: EventBurn, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): EventBurn { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - case 2: message.id = reader.string(); break; - case 3: message.owner = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventBurn { + fromPartial(object: Partial): EventBurn { const message = createBaseEventBurn(); message.classId = object.classId ?? ""; message.id = object.id ?? ""; message.owner = object.owner ?? ""; return message; + }, + fromAmino(object: EventBurnAmino): EventBurn { + const message = createBaseEventBurn(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + return message; + }, + toAmino(message: EventBurn): EventBurnAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.id = message.id; + obj.owner = message.owner; + return obj; + }, + fromAminoMsg(object: EventBurnAminoMsg): EventBurn { + return EventBurn.fromAmino(object.value); + }, + toAminoMsg(message: EventBurn): EventBurnAminoMsg { + return { + type: "cosmos-sdk/EventBurn", + value: EventBurn.toAmino(message) + }; + }, + fromProtoMsg(message: EventBurnProtoMsg): EventBurn { + return EventBurn.decode(message.value); + }, + toProto(message: EventBurn): Uint8Array { + return EventBurn.encode(message).finish(); + }, + toProtoMsg(message: EventBurn): EventBurnProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.EventBurn", + value: EventBurn.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/genesis.ts b/src/codegen/cosmos/nft/v1beta1/genesis.ts index 2809c55..804462a 100644 --- a/src/codegen/cosmos/nft/v1beta1/genesis.ts +++ b/src/codegen/cosmos/nft/v1beta1/genesis.ts @@ -1,145 +1,222 @@ -import { Class, ClassSDKType, NFT, NFTSDKType } from "./nft"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Class, ClassAmino, ClassSDKType, NFT, NFTAmino, NFTSDKType } from "./nft"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the nft module's genesis state. */ - export interface GenesisState { /** class defines the class of the nft type. */ classes: Class[]; entries: Entry[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the nft module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** class defines the class of the nft type. */ + classes?: ClassAmino[]; + entries?: EntryAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the nft module's genesis state. */ +export interface GenesisStateSDKType { classes: ClassSDKType[]; entries: EntrySDKType[]; } /** 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[]; } +export interface EntryProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.Entry"; + value: Uint8Array; +} /** Entry Defines all nft owned by a person */ - -export interface EntrySDKType { +export interface EntryAmino { /** owner is the owner address of the following nft */ - owner: string; + owner?: string; /** nfts is a group of nfts of the same owner */ - + nfts?: NFTAmino[]; +} +export interface EntryAminoMsg { + type: "cosmos-sdk/Entry"; + value: EntryAmino; +} +/** Entry Defines all nft owned by a person */ +export interface EntrySDKType { + owner: string; nfts: NFTSDKType[]; } - function createBaseGenesisState(): GenesisState { return { classes: [], entries: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.classes) { Class.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.entries) { Entry.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.classes.push(Class.decode(reader, reader.uint32())); break; - case 2: message.entries.push(Entry.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.classes = object.classes?.map(e => Class.fromPartial(e)) || []; message.entries = object.entries?.map(e => Entry.fromPartial(e)) || []; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.classes = object.classes?.map(e => Class.fromAmino(e)) || []; + message.entries = object.entries?.map(e => Entry.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.classes) { + obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); + } else { + obj.classes = []; + } + if (message.entries) { + obj.entries = message.entries.map(e => e ? Entry.toAmino(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; - function createBaseEntry(): Entry { return { owner: "", nfts: [] }; } - export const Entry = { - encode(message: Entry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.Entry", + encode(message: Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); } - for (const v of message.nfts) { NFT.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Entry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.owner = reader.string(); break; - case 2: message.nfts.push(NFT.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Entry { + fromPartial(object: Partial): Entry { const message = createBaseEntry(); message.owner = object.owner ?? ""; message.nfts = object.nfts?.map(e => NFT.fromPartial(e)) || []; return message; + }, + fromAmino(object: EntryAmino): Entry { + const message = createBaseEntry(); + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + message.nfts = object.nfts?.map(e => NFT.fromAmino(e)) || []; + return message; + }, + toAmino(message: Entry): EntryAmino { + const obj: any = {}; + obj.owner = message.owner; + if (message.nfts) { + obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); + } else { + obj.nfts = []; + } + return obj; + }, + fromAminoMsg(object: EntryAminoMsg): Entry { + return Entry.fromAmino(object.value); + }, + toAminoMsg(message: Entry): EntryAminoMsg { + return { + type: "cosmos-sdk/Entry", + value: Entry.toAmino(message) + }; + }, + fromProtoMsg(message: EntryProtoMsg): Entry { + return Entry.decode(message.value); + }, + toProto(message: Entry): Uint8Array { + return Entry.encode(message).finish(); + }, + toProtoMsg(message: Entry): EntryProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.Entry", + value: Entry.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/nft.ts b/src/codegen/cosmos/nft/v1beta1/nft.ts index 420a63b..ab57989 100644 --- a/src/codegen/cosmos/nft/v1beta1/nft.ts +++ b/src/codegen/cosmos/nft/v1beta1/nft.ts @@ -1,91 +1,99 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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; } +export interface ClassProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.Class"; + value: Uint8Array; +} /** Class defines the class of the nft type. */ - -export interface ClassSDKType { +export interface ClassAmino { /** id defines the unique identifier of the NFT classification, similar to the contract address of ERC721 */ - id: string; + id?: string; /** name defines the human-readable name of the NFT classification. Optional */ - - name: string; + name?: string; /** symbol is an abbreviated name for nft classification. Optional */ - - symbol: string; + symbol?: string; /** description is a brief description of nft classification. Optional */ - - description: string; + description?: string; /** uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional */ - - uri: string; + uri?: string; /** uri_hash is a hash of the document pointed by uri. Optional */ - - uri_hash: string; + uri_hash?: string; /** data is the app specific metadata of the NFT class. Optional */ - + data?: AnyAmino; +} +export interface ClassAminoMsg { + type: "cosmos-sdk/Class"; + value: ClassAmino; +} +/** Class defines the class of the nft type. */ +export interface ClassSDKType { + id: string; + name: string; + symbol: string; + description: string; + uri: string; + uri_hash: string; data?: AnySDKType; } /** 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; } +export interface NFTProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.NFT"; + value: Uint8Array; +} /** NFT defines the NFT. */ - -export interface NFTSDKType { +export interface NFTAmino { /** class_id associated with the NFT, similar to the contract address of ERC721 */ - class_id: string; + class_id?: string; /** id is a unique identifier of the NFT */ - - id: string; + id?: string; /** uri for the NFT metadata stored off chain */ - - uri: string; + uri?: string; /** uri_hash is a hash of the document pointed by uri */ - - uri_hash: string; + uri_hash?: string; /** data is an app specific data of the NFT. Optional */ - + data?: AnyAmino; +} +export interface NFTAminoMsg { + type: "cosmos-sdk/NFT"; + value: NFTAmino; +} +/** NFT defines the NFT. */ +export interface NFTSDKType { + class_id: string; + id: string; + uri: string; + uri_hash: string; data?: AnySDKType; } - function createBaseClass(): Class { return { id: "", @@ -97,87 +105,68 @@ function createBaseClass(): Class { data: undefined }; } - export const Class = { - encode(message: Class, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.Class", + encode(message: Class, writer: BinaryWriter = BinaryWriter.create()): 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()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Class { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.id = reader.string(); break; - case 2: message.name = reader.string(); break; - case 3: message.symbol = reader.string(); break; - case 4: message.description = reader.string(); break; - case 5: message.uri = reader.string(); break; - case 6: message.uriHash = reader.string(); break; - case 7: message.data = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Class { + fromPartial(object: Partial): Class { const message = createBaseClass(); message.id = object.id ?? ""; message.name = object.name ?? ""; @@ -187,10 +176,65 @@ export const Class = { message.uriHash = object.uriHash ?? ""; message.data = object.data !== undefined && object.data !== null ? Any.fromPartial(object.data) : undefined; return message; + }, + fromAmino(object: ClassAmino): Class { + const message = createBaseClass(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.symbol !== undefined && object.symbol !== null) { + message.symbol = object.symbol; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.uri !== undefined && object.uri !== null) { + message.uri = object.uri; + } + if (object.uri_hash !== undefined && object.uri_hash !== null) { + message.uriHash = object.uri_hash; + } + if (object.data !== undefined && object.data !== null) { + message.data = Any.fromAmino(object.data); + } + return message; + }, + toAmino(message: Class): ClassAmino { + const obj: any = {}; + obj.id = message.id; + obj.name = message.name; + obj.symbol = message.symbol; + obj.description = message.description; + obj.uri = message.uri; + obj.uri_hash = message.uriHash; + obj.data = message.data ? Any.toAmino(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: ClassAminoMsg): Class { + return Class.fromAmino(object.value); + }, + toAminoMsg(message: Class): ClassAminoMsg { + return { + type: "cosmos-sdk/Class", + value: Class.toAmino(message) + }; + }, + fromProtoMsg(message: ClassProtoMsg): Class { + return Class.decode(message.value); + }, + toProto(message: Class): Uint8Array { + return Class.encode(message).finish(); + }, + toProtoMsg(message: Class): ClassProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.Class", + value: Class.encode(message).finish() + }; } - }; - function createBaseNFT(): NFT { return { classId: "", @@ -200,71 +244,56 @@ function createBaseNFT(): NFT { data: undefined }; } - export const NFT = { - encode(message: NFT, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.NFT", + encode(message: NFT, writer: BinaryWriter = BinaryWriter.create()): 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()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): NFT { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - case 2: message.id = reader.string(); break; - case 3: message.uri = reader.string(); break; - case 4: message.uriHash = reader.string(); break; - case 10: message.data = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): NFT { + fromPartial(object: Partial): NFT { const message = createBaseNFT(); message.classId = object.classId ?? ""; message.id = object.id ?? ""; @@ -272,6 +301,54 @@ export const NFT = { message.uriHash = object.uriHash ?? ""; message.data = object.data !== undefined && object.data !== null ? Any.fromPartial(object.data) : undefined; return message; + }, + fromAmino(object: NFTAmino): NFT { + const message = createBaseNFT(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.uri !== undefined && object.uri !== null) { + message.uri = object.uri; + } + if (object.uri_hash !== undefined && object.uri_hash !== null) { + message.uriHash = object.uri_hash; + } + if (object.data !== undefined && object.data !== null) { + message.data = Any.fromAmino(object.data); + } + return message; + }, + toAmino(message: NFT): NFTAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.id = message.id; + obj.uri = message.uri; + obj.uri_hash = message.uriHash; + obj.data = message.data ? Any.toAmino(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: NFTAminoMsg): NFT { + return NFT.fromAmino(object.value); + }, + toAminoMsg(message: NFT): NFTAminoMsg { + return { + type: "cosmos-sdk/NFT", + value: NFT.toAmino(message) + }; + }, + fromProtoMsg(message: NFTProtoMsg): NFT { + return NFT.decode(message.value); + }, + toProto(message: NFT): Uint8Array { + return NFT.encode(message).finish(); + }, + toProtoMsg(message: NFT): NFTProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.NFT", + value: NFT.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/query.lcd.ts b/src/codegen/cosmos/nft/v1beta1/query.lcd.ts index ca3a1dc..a8dec9f 100644 --- a/src/codegen/cosmos/nft/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/nft/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryBalanceRequest, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTResponseSDKType, QueryClassRequest, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -19,80 +18,59 @@ export class LCDQueryClient { this.classes = this.classes.bind(this); } /* Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 */ - - async balance(params: QueryBalanceRequest): Promise { const endpoint = `cosmos/nft/v1beta1/balance/${params.owner}/${params.classId}`; return await this.req.get(endpoint); } /* Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 */ - - async owner(params: QueryOwnerRequest): Promise { const endpoint = `cosmos/nft/v1beta1/owner/${params.classId}/${params.id}`; return await this.req.get(endpoint); } /* Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. */ - - async supply(params: QuerySupplyRequest): Promise { const endpoint = `cosmos/nft/v1beta1/supply/${params.classId}`; return await this.req.get(endpoint); } /* NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in ERC721Enumerable */ - - async nFTs(params: QueryNFTsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.classId !== "undefined") { options.params.class_id = params.classId; } - if (typeof params?.owner !== "undefined") { options.params.owner = params.owner; } - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/nft/v1beta1/nfts`; return await this.req.get(endpoint, options); } /* NFT queries an NFT based on its class and id. */ - - async nFT(params: QueryNFTRequest): Promise { const endpoint = `cosmos/nft/v1beta1/nfts/${params.classId}/${params.id}`; return await this.req.get(endpoint); } /* Class queries an NFT class based on its id */ - - async class(params: QueryClassRequest): Promise { const endpoint = `cosmos/nft/v1beta1/classes/${params.classId}`; return await this.req.get(endpoint); } /* Classes queries all NFT classes */ - - async classes(params: QueryClassesRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/nft/v1beta1/classes`; return await this.req.get(endpoint, options); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/nft/v1beta1/query.rpc.Query.ts index 72e6381..4b96e9e 100644 --- a/src/codegen/cosmos/nft/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/nft/v1beta1/query.rpc.Query.ts @@ -1,37 +1,29 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryBalanceRequest, QueryBalanceResponse, QueryOwnerRequest, QueryOwnerResponse, QuerySupplyRequest, QuerySupplyResponse, QueryNFTsRequest, QueryNFTsResponse, QueryNFTRequest, QueryNFTResponse, QueryClassRequest, QueryClassResponse, QueryClassesRequest, QueryClassesResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 */ balance(request: QueryBalanceRequest): Promise; /** Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 */ - owner(request: QueryOwnerRequest): Promise; /** Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. */ - supply(request: QuerySupplyRequest): Promise; /** * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in * ERC721Enumerable */ - nFTs(request: QueryNFTsRequest): Promise; /** NFT queries an NFT based on its class and id. */ - nFT(request: QueryNFTRequest): Promise; /** Class queries an NFT class based on its id */ - class(request: QueryClassRequest): Promise; /** Classes queries all NFT classes */ - classes(request?: QueryClassesRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.balance = this.balance.bind(this); @@ -42,51 +34,43 @@ export class QueryClientImpl implements Query { 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("cosmos.nft.v1beta1.Query", "Balance", data); - return promise.then(data => QueryBalanceResponse.decode(new _m0.Reader(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("cosmos.nft.v1beta1.Query", "Owner", data); - return promise.then(data => QueryOwnerResponse.decode(new _m0.Reader(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("cosmos.nft.v1beta1.Query", "Supply", data); - return promise.then(data => QuerySupplyResponse.decode(new _m0.Reader(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("cosmos.nft.v1beta1.Query", "NFTs", data); - return promise.then(data => QueryNFTsResponse.decode(new _m0.Reader(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("cosmos.nft.v1beta1.Query", "NFT", data); - return promise.then(data => QueryNFTResponse.decode(new _m0.Reader(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("cosmos.nft.v1beta1.Query", "Class", data); - return promise.then(data => QueryClassResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryClassResponse.decode(new BinaryReader(data))); } - classes(request: QueryClassesRequest = { pagination: undefined }): Promise { const data = QueryClassesRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.nft.v1beta1.Query", "Classes", data); - return promise.then(data => QueryClassesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryClassesResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -95,30 +79,23 @@ export const createRpcQueryExtension = (base: QueryClient) => { balance(request: QueryBalanceRequest): Promise { return queryService.balance(request); }, - owner(request: QueryOwnerRequest): Promise { return queryService.owner(request); }, - supply(request: QuerySupplyRequest): Promise { return queryService.supply(request); }, - nFTs(request: QueryNFTsRequest): Promise { return queryService.nFTs(request); }, - nFT(request: QueryNFTRequest): Promise { return queryService.nFT(request); }, - class(request: QueryClassRequest): Promise { return queryService.class(request); }, - classes(request?: QueryClassesRequest): Promise { return queryService.classes(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/query.ts b/src/codegen/cosmos/nft/v1beta1/query.ts index 91d2a17..60e943b 100644 --- a/src/codegen/cosmos/nft/v1beta1/query.ts +++ b/src/codegen/cosmos/nft/v1beta1/query.ts @@ -1,454 +1,747 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { NFT, NFTAmino, NFTSDKType, Class, ClassAmino, ClassSDKType } from "./nft"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ - export interface QueryBalanceRequest { classId: string; owner: string; } +export interface QueryBalanceRequestProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest"; + value: Uint8Array; +} +/** QueryBalanceRequest is the request type for the Query/Balance RPC method */ +export interface QueryBalanceRequestAmino { + class_id?: string; + owner?: string; +} +export interface QueryBalanceRequestAminoMsg { + type: "cosmos-sdk/QueryBalanceRequest"; + value: QueryBalanceRequestAmino; +} /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ - export interface QueryBalanceRequestSDKType { class_id: string; owner: string; } /** QueryBalanceResponse is the response type for the Query/Balance RPC method */ - export interface QueryBalanceResponse { - amount: Long; + amount: bigint; +} +export interface QueryBalanceResponseProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse"; + value: Uint8Array; +} +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponseAmino { + amount?: string; +} +export interface QueryBalanceResponseAminoMsg { + type: "cosmos-sdk/QueryBalanceResponse"; + value: QueryBalanceResponseAmino; } /** QueryBalanceResponse is the response type for the Query/Balance RPC method */ - export interface QueryBalanceResponseSDKType { - amount: Long; + amount: bigint; } /** QueryOwnerRequest is the request type for the Query/Owner RPC method */ - export interface QueryOwnerRequest { classId: string; id: string; } +export interface QueryOwnerRequestProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest"; + value: Uint8Array; +} +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequestAmino { + class_id?: string; + id?: string; +} +export interface QueryOwnerRequestAminoMsg { + type: "cosmos-sdk/QueryOwnerRequest"; + value: QueryOwnerRequestAmino; +} /** QueryOwnerRequest is the request type for the Query/Owner RPC method */ - export interface QueryOwnerRequestSDKType { class_id: string; id: string; } /** QueryOwnerResponse is the response type for the Query/Owner RPC method */ - export interface QueryOwnerResponse { owner: string; } +export interface QueryOwnerResponseProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse"; + value: Uint8Array; +} +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponseAmino { + owner?: string; +} +export interface QueryOwnerResponseAminoMsg { + type: "cosmos-sdk/QueryOwnerResponse"; + value: QueryOwnerResponseAmino; +} /** QueryOwnerResponse is the response type for the Query/Owner RPC method */ - export interface QueryOwnerResponseSDKType { owner: string; } /** QuerySupplyRequest is the request type for the Query/Supply RPC method */ - export interface QuerySupplyRequest { classId: string; } +export interface QuerySupplyRequestProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest"; + value: Uint8Array; +} +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequestAmino { + class_id?: string; +} +export interface QuerySupplyRequestAminoMsg { + type: "cosmos-sdk/QuerySupplyRequest"; + value: QuerySupplyRequestAmino; +} /** QuerySupplyRequest is the request type for the Query/Supply RPC method */ - export interface QuerySupplyRequestSDKType { class_id: string; } /** QuerySupplyResponse is the response type for the Query/Supply RPC method */ - export interface QuerySupplyResponse { - amount: Long; + amount: bigint; +} +export interface QuerySupplyResponseProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse"; + value: Uint8Array; +} +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponseAmino { + amount?: string; +} +export interface QuerySupplyResponseAminoMsg { + type: "cosmos-sdk/QuerySupplyResponse"; + value: QuerySupplyResponseAmino; } /** QuerySupplyResponse is the response type for the Query/Supply RPC method */ - export interface QuerySupplyResponseSDKType { - amount: Long; + amount: bigint; } /** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ - export interface QueryNFTsRequest { classId: string; owner: string; pagination?: PageRequest; } +export interface QueryNFTsRequestProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest"; + value: Uint8Array; +} +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequestAmino { + class_id?: string; + owner?: string; + pagination?: PageRequestAmino; +} +export interface QueryNFTsRequestAminoMsg { + type: "cosmos-sdk/QueryNFTsRequest"; + value: QueryNFTsRequestAmino; +} /** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ - export interface QueryNFTsRequestSDKType { class_id: string; owner: string; pagination?: PageRequestSDKType; } /** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ - export interface QueryNFTsResponse { nfts: NFT[]; pagination?: PageResponse; } +export interface QueryNFTsResponseProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse"; + value: Uint8Array; +} +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponseAmino { + nfts?: NFTAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryNFTsResponseAminoMsg { + type: "cosmos-sdk/QueryNFTsResponse"; + value: QueryNFTsResponseAmino; +} /** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ - export interface QueryNFTsResponseSDKType { nfts: NFTSDKType[]; pagination?: PageResponseSDKType; } /** QueryNFTRequest is the request type for the Query/NFT RPC method */ - export interface QueryNFTRequest { classId: string; id: string; } +export interface QueryNFTRequestProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest"; + value: Uint8Array; +} +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequestAmino { + class_id?: string; + id?: string; +} +export interface QueryNFTRequestAminoMsg { + type: "cosmos-sdk/QueryNFTRequest"; + value: QueryNFTRequestAmino; +} /** QueryNFTRequest is the request type for the Query/NFT RPC method */ - export interface QueryNFTRequestSDKType { class_id: string; id: string; } /** QueryNFTResponse is the response type for the Query/NFT RPC method */ - export interface QueryNFTResponse { nft?: NFT; } +export interface QueryNFTResponseProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse"; + value: Uint8Array; +} +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponseAmino { + nft?: NFTAmino; +} +export interface QueryNFTResponseAminoMsg { + type: "cosmos-sdk/QueryNFTResponse"; + value: QueryNFTResponseAmino; +} /** QueryNFTResponse is the response type for the Query/NFT RPC method */ - export interface QueryNFTResponseSDKType { nft?: NFTSDKType; } /** QueryClassRequest is the request type for the Query/Class RPC method */ - export interface QueryClassRequest { classId: string; } +export interface QueryClassRequestProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest"; + value: Uint8Array; +} +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequestAmino { + class_id?: string; +} +export interface QueryClassRequestAminoMsg { + type: "cosmos-sdk/QueryClassRequest"; + value: QueryClassRequestAmino; +} /** QueryClassRequest is the request type for the Query/Class RPC method */ - export interface QueryClassRequestSDKType { class_id: string; } /** QueryClassResponse is the response type for the Query/Class RPC method */ - export interface QueryClassResponse { class?: Class; } +export interface QueryClassResponseProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse"; + value: Uint8Array; +} +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponseAmino { + class?: ClassAmino; +} +export interface QueryClassResponseAminoMsg { + type: "cosmos-sdk/QueryClassResponse"; + value: QueryClassResponseAmino; +} /** QueryClassResponse is the response type for the Query/Class RPC method */ - export interface QueryClassResponseSDKType { class?: ClassSDKType; } /** QueryClassesRequest is the request type for the Query/Classes RPC method */ - export interface QueryClassesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryClassesRequestProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest"; + value: Uint8Array; +} /** QueryClassesRequest is the request type for the Query/Classes RPC method */ - -export interface QueryClassesRequestSDKType { +export interface QueryClassesRequestAmino { /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryClassesRequestAminoMsg { + type: "cosmos-sdk/QueryClassesRequest"; + value: QueryClassesRequestAmino; +} +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequestSDKType { pagination?: PageRequestSDKType; } /** QueryClassesResponse is the response type for the Query/Classes RPC method */ - export interface QueryClassesResponse { classes: Class[]; pagination?: PageResponse; } +export interface QueryClassesResponseProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse"; + value: Uint8Array; +} +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponseAmino { + classes?: ClassAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryClassesResponseAminoMsg { + type: "cosmos-sdk/QueryClassesResponse"; + value: QueryClassesResponseAmino; +} /** QueryClassesResponse is the response type for the Query/Classes RPC method */ - export interface QueryClassesResponseSDKType { classes: ClassSDKType[]; pagination?: PageResponseSDKType; } - function createBaseQueryBalanceRequest(): QueryBalanceRequest { return { classId: "", owner: "" }; } - export const QueryBalanceRequest = { - encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest", + encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.owner !== "") { writer.uint32(18).string(message.owner); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryBalanceRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - case 2: message.owner = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryBalanceRequest { + fromPartial(object: Partial): QueryBalanceRequest { const message = createBaseQueryBalanceRequest(); message.classId = object.classId ?? ""; message.owner = object.owner ?? ""; return message; + }, + fromAmino(object: QueryBalanceRequestAmino): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + return message; + }, + toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.owner = message.owner; + return obj; + }, + fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { + return QueryBalanceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryBalanceRequest): QueryBalanceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryBalanceRequest", + value: QueryBalanceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBalanceRequestProtoMsg): QueryBalanceRequest { + return QueryBalanceRequest.decode(message.value); + }, + toProto(message: QueryBalanceRequest): Uint8Array { + return QueryBalanceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryBalanceRequest): QueryBalanceRequestProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest", + value: QueryBalanceRequest.encode(message).finish() + }; } - }; - function createBaseQueryBalanceResponse(): QueryBalanceResponse { return { - amount: Long.UZERO + amount: BigInt(0) }; } - export const QueryBalanceResponse = { - encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.amount.isZero()) { + typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", + encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.amount !== BigInt(0)) { writer.uint32(8).uint64(message.amount); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryBalanceResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.amount = (reader.uint64() as Long); + message.amount = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryBalanceResponse { + fromPartial(object: Partial): QueryBalanceResponse { const message = createBaseQueryBalanceResponse(); - message.amount = object.amount !== undefined && object.amount !== null ? Long.fromValue(object.amount) : Long.UZERO; + message.amount = object.amount !== undefined && object.amount !== null ? BigInt(object.amount.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryBalanceResponseAmino): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + if (object.amount !== undefined && object.amount !== null) { + message.amount = BigInt(object.amount); + } + return message; + }, + toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { + const obj: any = {}; + obj.amount = message.amount ? message.amount.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { + return QueryBalanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryBalanceResponse): QueryBalanceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryBalanceResponse", + value: QueryBalanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBalanceResponseProtoMsg): QueryBalanceResponse { + return QueryBalanceResponse.decode(message.value); + }, + toProto(message: QueryBalanceResponse): Uint8Array { + return QueryBalanceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryBalanceResponse): QueryBalanceResponseProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", + value: QueryBalanceResponse.encode(message).finish() + }; } - }; - function createBaseQueryOwnerRequest(): QueryOwnerRequest { return { classId: "", id: "" }; } - export const QueryOwnerRequest = { - encode(message: QueryOwnerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", + encode(message: QueryOwnerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== "") { writer.uint32(18).string(message.id); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryOwnerRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.classId = reader.string(); break; - case 2: message.id = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryOwnerRequest { + fromPartial(object: Partial): QueryOwnerRequest { const message = createBaseQueryOwnerRequest(); message.classId = object.classId ?? ""; message.id = object.id ?? ""; return message; + }, + fromAmino(object: QueryOwnerRequestAmino): QueryOwnerRequest { + const message = createBaseQueryOwnerRequest(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + return message; + }, + toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.id = message.id; + return obj; + }, + fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { + return QueryOwnerRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryOwnerRequest): QueryOwnerRequestAminoMsg { + return { + type: "cosmos-sdk/QueryOwnerRequest", + value: QueryOwnerRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryOwnerRequestProtoMsg): QueryOwnerRequest { + return QueryOwnerRequest.decode(message.value); + }, + toProto(message: QueryOwnerRequest): Uint8Array { + return QueryOwnerRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryOwnerRequest): QueryOwnerRequestProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", + value: QueryOwnerRequest.encode(message).finish() + }; } - }; - function createBaseQueryOwnerResponse(): QueryOwnerResponse { return { owner: "" }; } - export const QueryOwnerResponse = { - encode(message: QueryOwnerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", + encode(message: QueryOwnerResponse, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.owner = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryOwnerResponse { + fromPartial(object: Partial): QueryOwnerResponse { const message = createBaseQueryOwnerResponse(); message.owner = object.owner ?? ""; return message; + }, + fromAmino(object: QueryOwnerResponseAmino): QueryOwnerResponse { + const message = createBaseQueryOwnerResponse(); + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + return message; + }, + toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { + const obj: any = {}; + obj.owner = message.owner; + return obj; + }, + fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { + return QueryOwnerResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryOwnerResponse): QueryOwnerResponseAminoMsg { + return { + type: "cosmos-sdk/QueryOwnerResponse", + value: QueryOwnerResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryOwnerResponseProtoMsg): QueryOwnerResponse { + return QueryOwnerResponse.decode(message.value); + }, + toProto(message: QueryOwnerResponse): Uint8Array { + return QueryOwnerResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryOwnerResponse): QueryOwnerResponseProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", + value: QueryOwnerResponse.encode(message).finish() + }; } - }; - function createBaseQuerySupplyRequest(): QuerySupplyRequest { return { classId: "" }; } - export const QuerySupplyRequest = { - encode(message: QuerySupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", + encode(message: QuerySupplyRequest, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySupplyRequest { + fromPartial(object: Partial): QuerySupplyRequest { const message = createBaseQuerySupplyRequest(); message.classId = object.classId ?? ""; return message; + }, + fromAmino(object: QuerySupplyRequestAmino): QuerySupplyRequest { + const message = createBaseQuerySupplyRequest(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + return message; + }, + toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { + const obj: any = {}; + obj.class_id = message.classId; + return obj; + }, + fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { + return QuerySupplyRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySupplyRequest): QuerySupplyRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySupplyRequest", + value: QuerySupplyRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySupplyRequestProtoMsg): QuerySupplyRequest { + return QuerySupplyRequest.decode(message.value); + }, + toProto(message: QuerySupplyRequest): Uint8Array { + return QuerySupplyRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySupplyRequest): QuerySupplyRequestProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", + value: QuerySupplyRequest.encode(message).finish() + }; } - }; - function createBaseQuerySupplyResponse(): QuerySupplyResponse { return { - amount: Long.UZERO + amount: BigInt(0) }; } - export const QuerySupplyResponse = { - encode(message: QuerySupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.amount.isZero()) { + typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", + encode(message: QuerySupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.amount !== BigInt(0)) { writer.uint32(8).uint64(message.amount); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.amount = (reader.uint64() as Long); + message.amount = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySupplyResponse { + fromPartial(object: Partial): QuerySupplyResponse { const message = createBaseQuerySupplyResponse(); - message.amount = object.amount !== undefined && object.amount !== null ? Long.fromValue(object.amount) : Long.UZERO; + message.amount = object.amount !== undefined && object.amount !== null ? BigInt(object.amount.toString()) : BigInt(0); return message; + }, + fromAmino(object: QuerySupplyResponseAmino): QuerySupplyResponse { + const message = createBaseQuerySupplyResponse(); + if (object.amount !== undefined && object.amount !== null) { + message.amount = BigInt(object.amount); + } + return message; + }, + toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { + const obj: any = {}; + obj.amount = message.amount ? message.amount.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { + return QuerySupplyResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySupplyResponse): QuerySupplyResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySupplyResponse", + value: QuerySupplyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySupplyResponseProtoMsg): QuerySupplyResponse { + return QuerySupplyResponse.decode(message.value); + }, + toProto(message: QuerySupplyResponse): Uint8Array { + return QuerySupplyResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySupplyResponse): QuerySupplyResponseProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", + value: QuerySupplyResponse.encode(message).finish() + }; } - }; - function createBaseQueryNFTsRequest(): QueryNFTsRequest { return { classId: "", @@ -456,405 +749,612 @@ function createBaseQueryNFTsRequest(): QueryNFTsRequest { pagination: undefined }; } - export const QueryNFTsRequest = { - encode(message: QueryNFTsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", + encode(message: QueryNFTsRequest, writer: BinaryWriter = BinaryWriter.create()): 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()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - case 2: message.owner = reader.string(); break; - case 3: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryNFTsRequest { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryNFTsRequestAmino): QueryNFTsRequest { + const message = createBaseQueryNFTsRequest(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.owner = message.owner; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryNFTsRequestAminoMsg): QueryNFTsRequest { + return QueryNFTsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryNFTsRequest): QueryNFTsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryNFTsRequest", + value: QueryNFTsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryNFTsRequestProtoMsg): QueryNFTsRequest { + return QueryNFTsRequest.decode(message.value); + }, + toProto(message: QueryNFTsRequest): Uint8Array { + return QueryNFTsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryNFTsRequest): QueryNFTsRequestProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", + value: QueryNFTsRequest.encode(message).finish() + }; } - }; - function createBaseQueryNFTsResponse(): QueryNFTsResponse { return { nfts: [], pagination: undefined }; } - export const QueryNFTsResponse = { - encode(message: QueryNFTsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse", + encode(message: QueryNFTsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.nfts) { NFT.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.nfts.push(NFT.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryNFTsResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryNFTsResponseAmino): QueryNFTsResponse { + const message = createBaseQueryNFTsResponse(); + message.nfts = object.nfts?.map(e => NFT.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryNFTsResponse): QueryNFTsResponseAmino { + const obj: any = {}; + if (message.nfts) { + obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); + } else { + obj.nfts = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryNFTsResponseAminoMsg): QueryNFTsResponse { + return QueryNFTsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryNFTsResponse): QueryNFTsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryNFTsResponse", + value: QueryNFTsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryNFTsResponseProtoMsg): QueryNFTsResponse { + return QueryNFTsResponse.decode(message.value); + }, + toProto(message: QueryNFTsResponse): Uint8Array { + return QueryNFTsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryNFTsResponse): QueryNFTsResponseProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse", + value: QueryNFTsResponse.encode(message).finish() + }; } - }; - function createBaseQueryNFTRequest(): QueryNFTRequest { return { classId: "", id: "" }; } - export const QueryNFTRequest = { - encode(message: QueryNFTRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", + encode(message: QueryNFTRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== "") { writer.uint32(18).string(message.id); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.classId = reader.string(); break; - case 2: message.id = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryNFTRequest { + fromPartial(object: Partial): QueryNFTRequest { const message = createBaseQueryNFTRequest(); message.classId = object.classId ?? ""; message.id = object.id ?? ""; return message; + }, + fromAmino(object: QueryNFTRequestAmino): QueryNFTRequest { + const message = createBaseQueryNFTRequest(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + return message; + }, + toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.id = message.id; + return obj; + }, + fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { + return QueryNFTRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryNFTRequest): QueryNFTRequestAminoMsg { + return { + type: "cosmos-sdk/QueryNFTRequest", + value: QueryNFTRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryNFTRequestProtoMsg): QueryNFTRequest { + return QueryNFTRequest.decode(message.value); + }, + toProto(message: QueryNFTRequest): Uint8Array { + return QueryNFTRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryNFTRequest): QueryNFTRequestProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", + value: QueryNFTRequest.encode(message).finish() + }; } - }; - function createBaseQueryNFTResponse(): QueryNFTResponse { return { nft: undefined }; } - export const QueryNFTResponse = { - encode(message: QueryNFTResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse", + encode(message: QueryNFTResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nft !== undefined) { NFT.encode(message.nft, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.nft = NFT.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryNFTResponse { + fromPartial(object: Partial): QueryNFTResponse { const message = createBaseQueryNFTResponse(); message.nft = object.nft !== undefined && object.nft !== null ? NFT.fromPartial(object.nft) : undefined; return message; + }, + fromAmino(object: QueryNFTResponseAmino): QueryNFTResponse { + const message = createBaseQueryNFTResponse(); + if (object.nft !== undefined && object.nft !== null) { + message.nft = NFT.fromAmino(object.nft); + } + return message; + }, + toAmino(message: QueryNFTResponse): QueryNFTResponseAmino { + const obj: any = {}; + obj.nft = message.nft ? NFT.toAmino(message.nft) : undefined; + return obj; + }, + fromAminoMsg(object: QueryNFTResponseAminoMsg): QueryNFTResponse { + return QueryNFTResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryNFTResponse): QueryNFTResponseAminoMsg { + return { + type: "cosmos-sdk/QueryNFTResponse", + value: QueryNFTResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryNFTResponseProtoMsg): QueryNFTResponse { + return QueryNFTResponse.decode(message.value); + }, + toProto(message: QueryNFTResponse): Uint8Array { + return QueryNFTResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryNFTResponse): QueryNFTResponseProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse", + value: QueryNFTResponse.encode(message).finish() + }; } - }; - function createBaseQueryClassRequest(): QueryClassRequest { return { classId: "" }; } - export const QueryClassRequest = { - encode(message: QueryClassRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", + encode(message: QueryClassRequest, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClassRequest { + fromPartial(object: Partial): QueryClassRequest { const message = createBaseQueryClassRequest(); message.classId = object.classId ?? ""; return message; + }, + fromAmino(object: QueryClassRequestAmino): QueryClassRequest { + const message = createBaseQueryClassRequest(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + return message; + }, + toAmino(message: QueryClassRequest): QueryClassRequestAmino { + const obj: any = {}; + obj.class_id = message.classId; + return obj; + }, + fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { + return QueryClassRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClassRequest): QueryClassRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClassRequest", + value: QueryClassRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClassRequestProtoMsg): QueryClassRequest { + return QueryClassRequest.decode(message.value); + }, + toProto(message: QueryClassRequest): Uint8Array { + return QueryClassRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClassRequest): QueryClassRequestProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", + value: QueryClassRequest.encode(message).finish() + }; } - }; - function createBaseQueryClassResponse(): QueryClassResponse { return { class: undefined }; } - export const QueryClassResponse = { - encode(message: QueryClassResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse", + encode(message: QueryClassResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.class !== undefined) { Class.encode(message.class, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.class = Class.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClassResponse { + fromPartial(object: Partial): QueryClassResponse { const message = createBaseQueryClassResponse(); message.class = object.class !== undefined && object.class !== null ? Class.fromPartial(object.class) : undefined; return message; + }, + fromAmino(object: QueryClassResponseAmino): QueryClassResponse { + const message = createBaseQueryClassResponse(); + if (object.class !== undefined && object.class !== null) { + message.class = Class.fromAmino(object.class); + } + return message; + }, + toAmino(message: QueryClassResponse): QueryClassResponseAmino { + const obj: any = {}; + obj.class = message.class ? Class.toAmino(message.class) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClassResponseAminoMsg): QueryClassResponse { + return QueryClassResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClassResponse): QueryClassResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClassResponse", + value: QueryClassResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClassResponseProtoMsg): QueryClassResponse { + return QueryClassResponse.decode(message.value); + }, + toProto(message: QueryClassResponse): Uint8Array { + return QueryClassResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClassResponse): QueryClassResponseProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse", + value: QueryClassResponse.encode(message).finish() + }; } - }; - function createBaseQueryClassesRequest(): QueryClassesRequest { return { pagination: undefined }; } - export const QueryClassesRequest = { - encode(message: QueryClassesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest", + encode(message: QueryClassesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClassesRequest { + fromPartial(object: Partial): QueryClassesRequest { const message = createBaseQueryClassesRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryClassesRequestAmino): QueryClassesRequest { + const message = createBaseQueryClassesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryClassesRequest): QueryClassesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClassesRequestAminoMsg): QueryClassesRequest { + return QueryClassesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClassesRequest): QueryClassesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClassesRequest", + value: QueryClassesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClassesRequestProtoMsg): QueryClassesRequest { + return QueryClassesRequest.decode(message.value); + }, + toProto(message: QueryClassesRequest): Uint8Array { + return QueryClassesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClassesRequest): QueryClassesRequestProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest", + value: QueryClassesRequest.encode(message).finish() + }; } - }; - function createBaseQueryClassesResponse(): QueryClassesResponse { return { classes: [], pagination: undefined }; } - export const QueryClassesResponse = { - encode(message: QueryClassesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse", + encode(message: QueryClassesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.classes) { Class.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.classes.push(Class.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClassesResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QueryClassesResponseAmino): QueryClassesResponse { + const message = createBaseQueryClassesResponse(); + message.classes = object.classes?.map(e => Class.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryClassesResponse): QueryClassesResponseAmino { + const obj: any = {}; + if (message.classes) { + obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); + } else { + obj.classes = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClassesResponseAminoMsg): QueryClassesResponse { + return QueryClassesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClassesResponse): QueryClassesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClassesResponse", + value: QueryClassesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClassesResponseProtoMsg): QueryClassesResponse { + return QueryClassesResponse.decode(message.value); + }, + toProto(message: QueryClassesResponse): Uint8Array { + return QueryClassesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClassesResponse): QueryClassesResponseProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse", + value: QueryClassesResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/tx.amino.ts b/src/codegen/cosmos/nft/v1beta1/tx.amino.ts index 68f2beb..a10e415 100644 --- a/src/codegen/cosmos/nft/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/nft/v1beta1/tx.amino.ts @@ -1,42 +1,8 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgSend } from "./tx"; -export interface AminoMsgSend extends AminoMsg { - type: "cosmos-sdk/MsgNFTSend"; - value: { - class_id: string; - id: string; - sender: string; - receiver: string; - }; -} export const AminoConverter = { "/cosmos.nft.v1beta1.MsgSend": { aminoType: "cosmos-sdk/MsgNFTSend", - toAmino: ({ - classId, - id, - sender, - receiver - }: MsgSend): AminoMsgSend["value"] => { - return { - class_id: classId, - id, - sender, - receiver - }; - }, - fromAmino: ({ - class_id, - id, - sender, - receiver - }: AminoMsgSend["value"]): MsgSend => { - return { - classId: class_id, - id, - sender, - receiver - }; - } + toAmino: MsgSend.toAmino, + fromAmino: MsgSend.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/tx.registry.ts b/src/codegen/cosmos/nft/v1beta1/tx.registry.ts index 0d93075..d8c4062 100644 --- a/src/codegen/cosmos/nft/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/nft/v1beta1/tx.registry.ts @@ -14,7 +14,6 @@ export const MessageComposer = { value: MsgSend.encode(value).finish() }; } - }, withTypeUrl: { send(value: MsgSend) { @@ -23,7 +22,6 @@ export const MessageComposer = { value }; } - }, fromPartial: { send(value: MsgSend) { @@ -32,6 +30,5 @@ export const MessageComposer = { value: MsgSend.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/nft/v1beta1/tx.rpc.msg.ts index b6ad14c..5461819 100644 --- a/src/codegen/cosmos/nft/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/nft/v1beta1/tx.rpc.msg.ts @@ -1,24 +1,20 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendResponse } from "./tx"; /** Msg defines the nft Msg service. */ - export interface Msg { /** Send defines a method to send a nft from one account to another account. */ send(request: MsgSend): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.send = this.send.bind(this); } - send(request: MsgSend): Promise { const data = MsgSend.encode(request).finish(); const promise = this.rpc.request("cosmos.nft.v1beta1.Msg", "Send", data); - return promise.then(data => MsgSendResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgSendResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/nft/v1beta1/tx.ts b/src/codegen/cosmos/nft/v1beta1/tx.ts index 05798b1..d484118 100644 --- a/src/codegen/cosmos/nft/v1beta1/tx.ts +++ b/src/codegen/cosmos/nft/v1beta1/tx.ts @@ -1,42 +1,55 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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; } +export interface MsgSendProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.MsgSend"; + value: Uint8Array; +} /** MsgSend represents a message to send a nft from one account to another account. */ - -export interface MsgSendSDKType { +export interface MsgSendAmino { /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ - class_id: string; + class_id?: string; /** id defines the unique identification of nft */ - - id: string; + id?: string; /** sender is the address of the owner of nft */ - - sender: string; + sender?: string; /** receiver is the receiver address of nft */ - + receiver?: string; +} +export interface MsgSendAminoMsg { + type: "cosmos-sdk/MsgNFTSend"; + value: MsgSendAmino; +} +/** MsgSend represents a message to send a nft from one account to another account. */ +export interface MsgSendSDKType { + class_id: string; + id: string; + sender: string; receiver: string; } /** MsgSendResponse defines the Msg/Send response type. */ - export interface MsgSendResponse {} +export interface MsgSendResponseProtoMsg { + typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse"; + value: Uint8Array; +} +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponseAmino {} +export interface MsgSendResponseAminoMsg { + type: "cosmos-sdk/MsgSendResponse"; + value: MsgSendResponseAmino; +} /** MsgSendResponse defines the Msg/Send response type. */ - export interface MsgSendResponseSDKType {} - function createBaseMsgSend(): MsgSend { return { classId: "", @@ -45,103 +58,156 @@ function createBaseMsgSend(): MsgSend { receiver: "" }; } - export const MsgSend = { - encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.MsgSend", + encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): MsgSend { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.classId = reader.string(); break; - case 2: message.id = reader.string(); break; - case 3: message.sender = reader.string(); break; - case 4: message.receiver = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSend { + fromPartial(object: Partial): MsgSend { const message = createBaseMsgSend(); message.classId = object.classId ?? ""; message.id = object.id ?? ""; message.sender = object.sender ?? ""; message.receiver = object.receiver ?? ""; return message; + }, + fromAmino(object: MsgSendAmino): MsgSend { + const message = createBaseMsgSend(); + if (object.class_id !== undefined && object.class_id !== null) { + message.classId = object.class_id; + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.receiver !== undefined && object.receiver !== null) { + message.receiver = object.receiver; + } + return message; + }, + toAmino(message: MsgSend): MsgSendAmino { + const obj: any = {}; + obj.class_id = message.classId; + obj.id = message.id; + obj.sender = message.sender; + obj.receiver = message.receiver; + return obj; + }, + fromAminoMsg(object: MsgSendAminoMsg): MsgSend { + return MsgSend.fromAmino(object.value); + }, + toAminoMsg(message: MsgSend): MsgSendAminoMsg { + return { + type: "cosmos-sdk/MsgNFTSend", + value: MsgSend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendProtoMsg): MsgSend { + return MsgSend.decode(message.value); + }, + toProto(message: MsgSend): Uint8Array { + return MsgSend.encode(message).finish(); + }, + toProtoMsg(message: MsgSend): MsgSendProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.MsgSend", + value: MsgSend.encode(message).finish() + }; } - }; - function createBaseMsgSendResponse(): MsgSendResponse { return {}; } - export const MsgSendResponse = { - encode(_: MsgSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse", + encode(_: MsgSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgSendResponse { + fromPartial(_: Partial): MsgSendResponse { const message = createBaseMsgSendResponse(); return message; + }, + fromAmino(_: MsgSendResponseAmino): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, + toAmino(_: MsgSendResponse): MsgSendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSendResponseAminoMsg): MsgSendResponse { + return MsgSendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSendResponse): MsgSendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSendResponse", + value: MsgSendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendResponseProtoMsg): MsgSendResponse { + return MsgSendResponse.decode(message.value); + }, + toProto(message: MsgSendResponse): Uint8Array { + return MsgSendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSendResponse): MsgSendResponseProtoMsg { + return { + typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse", + value: MsgSendResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/orm/v1/orm.ts b/src/codegen/cosmos/orm/v1/orm.ts index fc215e8..1185b8c 100644 --- a/src/codegen/cosmos/orm/v1/orm.ts +++ b/src/codegen/cosmos/orm/v1/orm.ts @@ -1,39 +1,45 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** TableDescriptor describes an ORM table. */ - export interface TableDescriptor { /** primary_key defines the primary key for the table. */ primaryKey?: PrimaryKeyDescriptor; /** index defines one or more secondary indexes. */ - index: SecondaryIndexDescriptor[]; /** * id is a non-zero integer ID that must be unique within the * tables and singletons in this file. It may be deprecated in the future when this * can be auto-generated. */ - id: number; } +export interface TableDescriptorProtoMsg { + typeUrl: "/cosmos.orm.v1.TableDescriptor"; + value: Uint8Array; +} /** TableDescriptor describes an ORM table. */ - -export interface TableDescriptorSDKType { +export interface TableDescriptorAmino { /** primary_key defines the primary key for the table. */ - primary_key?: PrimaryKeyDescriptorSDKType; + primary_key?: PrimaryKeyDescriptorAmino; /** index defines one or more secondary indexes. */ - - index: SecondaryIndexDescriptorSDKType[]; + index?: SecondaryIndexDescriptorAmino[]; /** * 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; +} +export interface TableDescriptorAminoMsg { + type: "cosmos-sdk/TableDescriptor"; + value: TableDescriptorAmino; +} +/** TableDescriptor describes an ORM table. */ +export interface TableDescriptorSDKType { + primary_key?: PrimaryKeyDescriptorSDKType; + index: SecondaryIndexDescriptorSDKType[]; 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 @@ -73,12 +79,14 @@ export interface PrimaryKeyDescriptor { * auto-incrementing integer. If this is set to true fields must only * contain one field of that is of type uint64. */ - autoIncrement: boolean; } +export interface PrimaryKeyDescriptorProtoMsg { + typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor"; + value: Uint8Array; +} /** PrimaryKeyDescriptor describes a table primary key. */ - -export interface PrimaryKeyDescriptorSDKType { +export interface PrimaryKeyDescriptorAmino { /** * 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 @@ -111,17 +119,24 @@ export interface PrimaryKeyDescriptorSDKType { * Primary keys are prefixed by the varint encoded table id and the byte 0x0 * plus any additional prefix specified by the schema. */ - fields: string; + fields?: string; /** * auto_increment specifies that the primary key is generated by an * auto-incrementing integer. If this is set to true fields must only * contain one field of that is of type uint64. */ - + auto_increment?: boolean; +} +export interface PrimaryKeyDescriptorAminoMsg { + type: "cosmos-sdk/PrimaryKeyDescriptor"; + value: PrimaryKeyDescriptorAmino; +} +/** PrimaryKeyDescriptor describes a table primary key. */ +export interface PrimaryKeyDescriptorSDKType { + fields: string; auto_increment: boolean; } /** PrimaryKeyDescriptor describes a table secondary index. */ - export interface SecondaryIndexDescriptor { /** * fields is a comma-separated list of fields in the index. The supported @@ -140,15 +155,16 @@ export interface SecondaryIndexDescriptor { * 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; } +export interface SecondaryIndexDescriptorProtoMsg { + typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor"; + value: Uint8Array; +} /** PrimaryKeyDescriptor describes a table secondary index. */ - -export interface SecondaryIndexDescriptorSDKType { +export interface SecondaryIndexDescriptorAmino { /** * fields is a comma-separated list of fields in the index. The supported * field types are the same as those for PrimaryKeyDescriptor.fields. @@ -160,20 +176,27 @@ export interface SecondaryIndexDescriptorSDKType { * primary key can be reconstructed. Unique indexes instead of being suffixed * store the remaining primary key fields in the value.. */ - fields: string; + 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; + id?: number; /** unique specifies that this an unique index. */ - + unique?: boolean; +} +export interface SecondaryIndexDescriptorAminoMsg { + type: "cosmos-sdk/SecondaryIndexDescriptor"; + value: SecondaryIndexDescriptorAmino; +} +/** PrimaryKeyDescriptor describes a table secondary index. */ +export interface SecondaryIndexDescriptorSDKType { + fields: string; + id: number; 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 @@ -182,17 +205,27 @@ export interface SingletonDescriptor { */ id: number; } +export interface SingletonDescriptorProtoMsg { + typeUrl: "/cosmos.orm.v1.SingletonDescriptor"; + value: Uint8Array; +} /** TableDescriptor describes an ORM singleton table which has at most one instance. */ - -export interface SingletonDescriptorSDKType { +export interface SingletonDescriptorAmino { /** * 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; +} +export interface SingletonDescriptorAminoMsg { + type: "cosmos-sdk/SingletonDescriptor"; + value: SingletonDescriptorAmino; +} +/** TableDescriptor describes an ORM singleton table which has at most one instance. */ +export interface SingletonDescriptorSDKType { id: number; } - function createBaseTableDescriptor(): TableDescriptor { return { primaryKey: undefined, @@ -200,119 +233,175 @@ function createBaseTableDescriptor(): TableDescriptor { id: 0 }; } - export const TableDescriptor = { - encode(message: TableDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.orm.v1.TableDescriptor", + encode(message: TableDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.primaryKey !== undefined) { PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).ldelim(); } - for (const v of message.index) { SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.id !== 0) { writer.uint32(24).uint32(message.id); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TableDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.primaryKey = PrimaryKeyDescriptor.decode(reader, reader.uint32()); break; - case 2: message.index.push(SecondaryIndexDescriptor.decode(reader, reader.uint32())); break; - case 3: message.id = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TableDescriptor { + fromPartial(object: Partial): 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; + }, + fromAmino(object: TableDescriptorAmino): TableDescriptor { + const message = createBaseTableDescriptor(); + if (object.primary_key !== undefined && object.primary_key !== null) { + message.primaryKey = PrimaryKeyDescriptor.fromAmino(object.primary_key); + } + message.index = object.index?.map(e => SecondaryIndexDescriptor.fromAmino(e)) || []; + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + return message; + }, + toAmino(message: TableDescriptor): TableDescriptorAmino { + const obj: any = {}; + obj.primary_key = message.primaryKey ? PrimaryKeyDescriptor.toAmino(message.primaryKey) : undefined; + if (message.index) { + obj.index = message.index.map(e => e ? SecondaryIndexDescriptor.toAmino(e) : undefined); + } else { + obj.index = []; + } + obj.id = message.id; + return obj; + }, + fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { + return TableDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: TableDescriptor): TableDescriptorAminoMsg { + return { + type: "cosmos-sdk/TableDescriptor", + value: TableDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: TableDescriptorProtoMsg): TableDescriptor { + return TableDescriptor.decode(message.value); + }, + toProto(message: TableDescriptor): Uint8Array { + return TableDescriptor.encode(message).finish(); + }, + toProtoMsg(message: TableDescriptor): TableDescriptorProtoMsg { + return { + typeUrl: "/cosmos.orm.v1.TableDescriptor", + value: TableDescriptor.encode(message).finish() + }; } - }; - function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { return { fields: "", autoIncrement: false }; } - export const PrimaryKeyDescriptor = { - encode(message: PrimaryKeyDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", + encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fields !== "") { writer.uint32(10).string(message.fields); } - if (message.autoIncrement === true) { writer.uint32(16).bool(message.autoIncrement); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PrimaryKeyDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.fields = reader.string(); break; - case 2: message.autoIncrement = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PrimaryKeyDescriptor { + fromPartial(object: Partial): PrimaryKeyDescriptor { const message = createBasePrimaryKeyDescriptor(); message.fields = object.fields ?? ""; message.autoIncrement = object.autoIncrement ?? false; return message; + }, + fromAmino(object: PrimaryKeyDescriptorAmino): PrimaryKeyDescriptor { + const message = createBasePrimaryKeyDescriptor(); + if (object.fields !== undefined && object.fields !== null) { + message.fields = object.fields; + } + if (object.auto_increment !== undefined && object.auto_increment !== null) { + message.autoIncrement = object.auto_increment; + } + return message; + }, + toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { + const obj: any = {}; + obj.fields = message.fields; + obj.auto_increment = message.autoIncrement; + return obj; + }, + fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { + return PrimaryKeyDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAminoMsg { + return { + type: "cosmos-sdk/PrimaryKeyDescriptor", + value: PrimaryKeyDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: PrimaryKeyDescriptorProtoMsg): PrimaryKeyDescriptor { + return PrimaryKeyDescriptor.decode(message.value); + }, + toProto(message: PrimaryKeyDescriptor): Uint8Array { + return PrimaryKeyDescriptor.encode(message).finish(); + }, + toProtoMsg(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorProtoMsg { + return { + typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", + value: PrimaryKeyDescriptor.encode(message).finish() + }; } - }; - function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { return { fields: "", @@ -320,105 +409,158 @@ function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { unique: false }; } - export const SecondaryIndexDescriptor = { - encode(message: SecondaryIndexDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", + encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fields !== "") { writer.uint32(10).string(message.fields); } - if (message.id !== 0) { writer.uint32(16).uint32(message.id); } - if (message.unique === true) { writer.uint32(24).bool(message.unique); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SecondaryIndexDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.fields = reader.string(); break; - case 2: message.id = reader.uint32(); break; - case 3: message.unique = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SecondaryIndexDescriptor { + fromPartial(object: Partial): SecondaryIndexDescriptor { const message = createBaseSecondaryIndexDescriptor(); message.fields = object.fields ?? ""; message.id = object.id ?? 0; message.unique = object.unique ?? false; return message; + }, + fromAmino(object: SecondaryIndexDescriptorAmino): SecondaryIndexDescriptor { + const message = createBaseSecondaryIndexDescriptor(); + if (object.fields !== undefined && object.fields !== null) { + message.fields = object.fields; + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.unique !== undefined && object.unique !== null) { + message.unique = object.unique; + } + return message; + }, + toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { + const obj: any = {}; + obj.fields = message.fields; + obj.id = message.id; + obj.unique = message.unique; + return obj; + }, + fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { + return SecondaryIndexDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAminoMsg { + return { + type: "cosmos-sdk/SecondaryIndexDescriptor", + value: SecondaryIndexDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: SecondaryIndexDescriptorProtoMsg): SecondaryIndexDescriptor { + return SecondaryIndexDescriptor.decode(message.value); + }, + toProto(message: SecondaryIndexDescriptor): Uint8Array { + return SecondaryIndexDescriptor.encode(message).finish(); + }, + toProtoMsg(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorProtoMsg { + return { + typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", + value: SecondaryIndexDescriptor.encode(message).finish() + }; } - }; - function createBaseSingletonDescriptor(): SingletonDescriptor { return { id: 0 }; } - export const SingletonDescriptor = { - encode(message: SingletonDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.orm.v1.SingletonDescriptor", + encode(message: SingletonDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SingletonDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.id = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SingletonDescriptor { + fromPartial(object: Partial): SingletonDescriptor { const message = createBaseSingletonDescriptor(); message.id = object.id ?? 0; return message; + }, + fromAmino(object: SingletonDescriptorAmino): SingletonDescriptor { + const message = createBaseSingletonDescriptor(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + return message; + }, + toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { + const obj: any = {}; + obj.id = message.id; + return obj; + }, + fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { + return SingletonDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: SingletonDescriptor): SingletonDescriptorAminoMsg { + return { + type: "cosmos-sdk/SingletonDescriptor", + value: SingletonDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: SingletonDescriptorProtoMsg): SingletonDescriptor { + return SingletonDescriptor.decode(message.value); + }, + toProto(message: SingletonDescriptor): Uint8Array { + return SingletonDescriptor.encode(message).finish(); + }, + toProtoMsg(message: SingletonDescriptor): SingletonDescriptorProtoMsg { + return { + typeUrl: "/cosmos.orm.v1.SingletonDescriptor", + value: SingletonDescriptor.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/orm/v1alpha1/schema.ts b/src/codegen/cosmos/orm/v1alpha1/schema.ts index 69c3510..933c9cd 100644 --- a/src/codegen/cosmos/orm/v1alpha1/schema.ts +++ b/src/codegen/cosmos/orm/v1alpha1/schema.ts @@ -1,7 +1,6 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** StorageType */ - export enum StorageType { /** * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent @@ -11,7 +10,6 @@ export enum StorageType { * does not support this. */ STORAGE_TYPE_DEFAULT_UNSPECIFIED = 0, - /** * STORAGE_TYPE_MEMORY - STORAGE_TYPE_MEMORY indicates in-memory storage that will be * reloaded every time an app restarts. Tables with this type of storage @@ -19,7 +17,6 @@ export enum StorageType { * 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 @@ -27,62 +24,12 @@ export enum StorageType { * state from JSON. */ STORAGE_TYPE_TRANSIENT = 2, - /** * STORAGE_TYPE_INDEX - STORAGE_TYPE_INDEX indicates persistent storage which is not backed * by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK * before store/v2alpha1 does not support this. */ STORAGE_TYPE_INDEX = 3, - - /** - * STORAGE_TYPE_COMMITMENT - STORAGE_TYPE_INDEX indicates persistent storage which is backed by - * a merkle-tree. With this type of storage, both primary and index keys - * will affect the app hash and this is generally less efficient - * than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index - * keys into index storage. Note that modules built with the - * Cosmos SDK before store/v2alpha1 must specify STORAGE_TYPE_COMMITMENT - * instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX - * because this is the only type of persistent storage available. - */ - STORAGE_TYPE_COMMITMENT = 4, - UNRECOGNIZED = -1, -} -/** StorageType */ - -export enum StorageTypeSDKType { - /** - * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent - * KV-storage where primary key entries are stored in merkle-tree - * backed commitment storage and indexes and seqs are stored in - * fast index storage. Note that the Cosmos SDK before store/v2alpha1 - * does not support this. - */ - STORAGE_TYPE_DEFAULT_UNSPECIFIED = 0, - - /** - * STORAGE_TYPE_MEMORY - STORAGE_TYPE_MEMORY indicates in-memory storage that will be - * reloaded every time an app restarts. Tables with this type of storage - * will by default be ignored when importing and exporting a module's - * state from JSON. - */ - STORAGE_TYPE_MEMORY = 1, - - /** - * STORAGE_TYPE_TRANSIENT - STORAGE_TYPE_TRANSIENT indicates transient storage that is reset - * at the end of every block. Tables with this type of storage - * will by default be ignored when importing and exporting a module's - * state from JSON. - */ - STORAGE_TYPE_TRANSIENT = 2, - - /** - * STORAGE_TYPE_INDEX - STORAGE_TYPE_INDEX indicates persistent storage which is not backed - * by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK - * before store/v2alpha1 does not support this. - */ - STORAGE_TYPE_INDEX = 3, - /** * STORAGE_TYPE_COMMITMENT - STORAGE_TYPE_INDEX indicates persistent storage which is backed by * a merkle-tree. With this type of storage, both primary and index keys @@ -96,28 +43,25 @@ export enum StorageTypeSDKType { STORAGE_TYPE_COMMITMENT = 4, UNRECOGNIZED = -1, } +export const StorageTypeSDKType = StorageType; +export const StorageTypeAmino = StorageType; export function storageTypeFromJSON(object: any): StorageType { switch (object) { case 0: case "STORAGE_TYPE_DEFAULT_UNSPECIFIED": return StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED; - case 1: case "STORAGE_TYPE_MEMORY": return StorageType.STORAGE_TYPE_MEMORY; - case 2: case "STORAGE_TYPE_TRANSIENT": return StorageType.STORAGE_TYPE_TRANSIENT; - case 3: case "STORAGE_TYPE_INDEX": return StorageType.STORAGE_TYPE_INDEX; - case 4: case "STORAGE_TYPE_COMMITMENT": return StorageType.STORAGE_TYPE_COMMITMENT; - case -1: case "UNRECOGNIZED": default: @@ -128,48 +72,51 @@ export function storageTypeToJSON(object: StorageType): string { switch (object) { case StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED: return "STORAGE_TYPE_DEFAULT_UNSPECIFIED"; - case StorageType.STORAGE_TYPE_MEMORY: return "STORAGE_TYPE_MEMORY"; - case StorageType.STORAGE_TYPE_TRANSIENT: return "STORAGE_TYPE_TRANSIENT"; - case StorageType.STORAGE_TYPE_INDEX: return "STORAGE_TYPE_INDEX"; - case StorageType.STORAGE_TYPE_COMMITMENT: return "STORAGE_TYPE_COMMITMENT"; - case StorageType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** ModuleSchemaDescriptor describe's a module's ORM schema. */ - export interface ModuleSchemaDescriptor { schemaFile: ModuleSchemaDescriptor_FileEntry[]; /** * prefix is an optional prefix that precedes all keys in this module's * store. */ - prefix: Uint8Array; } +export interface ModuleSchemaDescriptorProtoMsg { + typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor"; + value: Uint8Array; +} /** ModuleSchemaDescriptor describe's a module's ORM schema. */ - -export interface ModuleSchemaDescriptorSDKType { - schema_file: ModuleSchemaDescriptor_FileEntrySDKType[]; +export interface ModuleSchemaDescriptorAmino { + schema_file?: ModuleSchemaDescriptor_FileEntryAmino[]; /** * prefix is an optional prefix that precedes all keys in this module's * store. */ - + prefix?: string; +} +export interface ModuleSchemaDescriptorAminoMsg { + type: "cosmos-sdk/ModuleSchemaDescriptor"; + value: ModuleSchemaDescriptorAmino; +} +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptorSDKType { + schema_file: ModuleSchemaDescriptor_FileEntrySDKType[]; 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 @@ -181,95 +128,131 @@ export interface ModuleSchemaDescriptor_FileEntry { * 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; } +export interface ModuleSchemaDescriptor_FileEntryProtoMsg { + typeUrl: "/cosmos.orm.v1alpha1.FileEntry"; + value: Uint8Array; +} /** FileEntry describes an ORM file used in a module. */ - -export interface ModuleSchemaDescriptor_FileEntrySDKType { +export interface ModuleSchemaDescriptor_FileEntryAmino { /** * id is a prefix that will be varint encoded and prepended to all the * table keys specified in the file's tables. */ - id: number; + id?: number; /** * proto_file_name is the name of a file .proto in that contains * table definitions. The .proto file must be in a package that the * module has referenced using cosmos.app.v1.ModuleDescriptor.use_package. */ - - proto_file_name: string; + proto_file_name?: string; /** * storage_type optionally indicates the type of storage this file's * tables should used. If it is left unspecified, the default KV-storage * of the app will be used. */ - - storage_type: StorageTypeSDKType; + storage_type?: StorageType; +} +export interface ModuleSchemaDescriptor_FileEntryAminoMsg { + type: "cosmos-sdk/FileEntry"; + value: ModuleSchemaDescriptor_FileEntryAmino; +} +/** FileEntry describes an ORM file used in a module. */ +export interface ModuleSchemaDescriptor_FileEntrySDKType { + id: number; + proto_file_name: string; + storage_type: StorageType; } - function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { return { schemaFile: [], prefix: new Uint8Array() }; } - export const ModuleSchemaDescriptor = { - encode(message: ModuleSchemaDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor", + encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.schemaFile) { ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.prefix.length !== 0) { writer.uint32(18).bytes(message.prefix); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ModuleSchemaDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.schemaFile.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); break; - case 2: message.prefix = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModuleSchemaDescriptor { + fromPartial(object: Partial): ModuleSchemaDescriptor { const message = createBaseModuleSchemaDescriptor(); message.schemaFile = object.schemaFile?.map(e => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; message.prefix = object.prefix ?? new Uint8Array(); return message; + }, + fromAmino(object: ModuleSchemaDescriptorAmino): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schemaFile = object.schema_file?.map(e => ModuleSchemaDescriptor_FileEntry.fromAmino(e)) || []; + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = bytesFromBase64(object.prefix); + } + return message; + }, + toAmino(message: ModuleSchemaDescriptor): ModuleSchemaDescriptorAmino { + const obj: any = {}; + if (message.schemaFile) { + obj.schema_file = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toAmino(e) : undefined); + } else { + obj.schema_file = []; + } + obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; + return obj; + }, + fromAminoMsg(object: ModuleSchemaDescriptorAminoMsg): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: ModuleSchemaDescriptor): ModuleSchemaDescriptorAminoMsg { + return { + type: "cosmos-sdk/ModuleSchemaDescriptor", + value: ModuleSchemaDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleSchemaDescriptorProtoMsg): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.decode(message.value); + }, + toProto(message: ModuleSchemaDescriptor): Uint8Array { + return ModuleSchemaDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ModuleSchemaDescriptor): ModuleSchemaDescriptorProtoMsg { + return { + typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor", + value: ModuleSchemaDescriptor.encode(message).finish() + }; } - }; - function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { return { id: 0, @@ -277,60 +260,89 @@ function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_Fi storageType: 0 }; } - export const ModuleSchemaDescriptor_FileEntry = { - encode(message: ModuleSchemaDescriptor_FileEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.orm.v1alpha1.FileEntry", + encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.id = reader.uint32(); break; - case 2: message.protoFileName = reader.string(); break; - case 3: message.storageType = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModuleSchemaDescriptor_FileEntry { + fromPartial(object: Partial): ModuleSchemaDescriptor_FileEntry { const message = createBaseModuleSchemaDescriptor_FileEntry(); message.id = object.id ?? 0; message.protoFileName = object.protoFileName ?? ""; message.storageType = object.storageType ?? 0; return message; + }, + fromAmino(object: ModuleSchemaDescriptor_FileEntryAmino): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.proto_file_name !== undefined && object.proto_file_name !== null) { + message.protoFileName = object.proto_file_name; + } + if (object.storage_type !== undefined && object.storage_type !== null) { + message.storageType = storageTypeFromJSON(object.storage_type); + } + return message; + }, + toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { + const obj: any = {}; + obj.id = message.id; + obj.proto_file_name = message.protoFileName; + obj.storage_type = storageTypeToJSON(message.storageType); + return obj; + }, + fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.fromAmino(object.value); + }, + toAminoMsg(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAminoMsg { + return { + type: "cosmos-sdk/FileEntry", + value: ModuleSchemaDescriptor_FileEntry.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleSchemaDescriptor_FileEntryProtoMsg): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.decode(message.value); + }, + toProto(message: ModuleSchemaDescriptor_FileEntry): Uint8Array { + return ModuleSchemaDescriptor_FileEntry.encode(message).finish(); + }, + toProtoMsg(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryProtoMsg { + return { + typeUrl: "/cosmos.orm.v1alpha1.FileEntry", + value: ModuleSchemaDescriptor_FileEntry.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/params/v1beta1/params.ts b/src/codegen/cosmos/params/v1beta1/params.ts index 73eaaac..140de2f 100644 --- a/src/codegen/cosmos/params/v1beta1/params.ts +++ b/src/codegen/cosmos/params/v1beta1/params.ts @@ -1,14 +1,25 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ - export interface ParameterChangeProposal { title: string; description: string; changes: ParamChange[]; } +export interface ParameterChangeProposalProtoMsg { + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal"; + value: Uint8Array; +} +/** ParameterChangeProposal defines a proposal to change one or more parameters. */ +export interface ParameterChangeProposalAmino { + title?: string; + description?: string; + changes?: ParamChangeAmino[]; +} +export interface ParameterChangeProposalAminoMsg { + type: "cosmos-sdk/ParameterChangeProposal"; + value: ParameterChangeProposalAmino; +} /** ParameterChangeProposal defines a proposal to change one or more parameters. */ - export interface ParameterChangeProposalSDKType { title: string; description: string; @@ -18,23 +29,37 @@ export interface ParameterChangeProposalSDKType { * ParamChange defines an individual parameter change, for use in * ParameterChangeProposal. */ - export interface ParamChange { subspace: string; key: string; value: string; } +export interface ParamChangeProtoMsg { + typeUrl: "/cosmos.params.v1beta1.ParamChange"; + value: Uint8Array; +} +/** + * ParamChange defines an individual parameter change, for use in + * ParameterChangeProposal. + */ +export interface ParamChangeAmino { + subspace?: string; + key?: string; + value?: string; +} +export interface ParamChangeAminoMsg { + type: "cosmos-sdk/ParamChange"; + value: ParamChangeAmino; +} /** * ParamChange defines an individual parameter change, for use in * ParameterChangeProposal. */ - export interface ParamChangeSDKType { subspace: string; key: string; value: string; } - function createBaseParameterChangeProposal(): ParameterChangeProposal { return { title: "", @@ -42,64 +67,94 @@ function createBaseParameterChangeProposal(): ParameterChangeProposal { changes: [] }; } - export const ParameterChangeProposal = { - encode(message: ParameterChangeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + encode(message: ParameterChangeProposal, writer: BinaryWriter = BinaryWriter.create()): 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()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ParameterChangeProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.title = reader.string(); break; - case 2: message.description = reader.string(); break; - case 3: message.changes.push(ParamChange.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ParameterChangeProposal { + fromPartial(object: Partial): ParameterChangeProposal { const message = createBaseParameterChangeProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; message.changes = object.changes?.map(e => ParamChange.fromPartial(e)) || []; return message; + }, + fromAmino(object: ParameterChangeProposalAmino): ParameterChangeProposal { + const message = createBaseParameterChangeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.changes = object.changes?.map(e => ParamChange.fromAmino(e)) || []; + return message; + }, + toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + if (message.changes) { + obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); + } else { + obj.changes = []; + } + return obj; + }, + fromAminoMsg(object: ParameterChangeProposalAminoMsg): ParameterChangeProposal { + return ParameterChangeProposal.fromAmino(object.value); + }, + toAminoMsg(message: ParameterChangeProposal): ParameterChangeProposalAminoMsg { + return { + type: "cosmos-sdk/ParameterChangeProposal", + value: ParameterChangeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: ParameterChangeProposalProtoMsg): ParameterChangeProposal { + return ParameterChangeProposal.decode(message.value); + }, + toProto(message: ParameterChangeProposal): Uint8Array { + return ParameterChangeProposal.encode(message).finish(); + }, + toProtoMsg(message: ParameterChangeProposal): ParameterChangeProposalProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + value: ParameterChangeProposal.encode(message).finish() + }; } - }; - function createBaseParamChange(): ParamChange { return { subspace: "", @@ -107,60 +162,89 @@ function createBaseParamChange(): ParamChange { value: "" }; } - export const ParamChange = { - encode(message: ParamChange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.params.v1beta1.ParamChange", + encode(message: ParamChange, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): ParamChange { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.subspace = reader.string(); break; - case 2: message.key = reader.string(); break; - case 3: message.value = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ParamChange { + fromPartial(object: Partial): ParamChange { const message = createBaseParamChange(); message.subspace = object.subspace ?? ""; message.key = object.key ?? ""; message.value = object.value ?? ""; return message; + }, + fromAmino(object: ParamChangeAmino): ParamChange { + const message = createBaseParamChange(); + if (object.subspace !== undefined && object.subspace !== null) { + message.subspace = object.subspace; + } + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: ParamChange): ParamChangeAmino { + const obj: any = {}; + obj.subspace = message.subspace; + obj.key = message.key; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { + return ParamChange.fromAmino(object.value); + }, + toAminoMsg(message: ParamChange): ParamChangeAminoMsg { + return { + type: "cosmos-sdk/ParamChange", + value: ParamChange.toAmino(message) + }; + }, + fromProtoMsg(message: ParamChangeProtoMsg): ParamChange { + return ParamChange.decode(message.value); + }, + toProto(message: ParamChange): Uint8Array { + return ParamChange.encode(message).finish(); + }, + toProtoMsg(message: ParamChange): ParamChangeProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.ParamChange", + value: ParamChange.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/params/v1beta1/query.lcd.ts b/src/codegen/cosmos/params/v1beta1/query.lcd.ts index 7feab29..b58d984 100644 --- a/src/codegen/cosmos/params/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/params/v1beta1/query.lcd.ts @@ -1,8 +1,7 @@ -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryParamsRequest, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -14,30 +13,22 @@ export class LCDQueryClient { } /* Params queries a specific parameter of a module, given its subspace and key. */ - - async params(params: QueryParamsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.subspace !== "undefined") { options.params.subspace = params.subspace; } - if (typeof params?.key !== "undefined") { options.params.key = params.key; } - const endpoint = `cosmos/params/v1beta1/params`; return await this.req.get(endpoint, options); } /* Subspaces queries for all registered subspaces and all keys for a subspace. */ - - async subspaces(_params: QuerySubspacesRequest = {}): Promise { const endpoint = `cosmos/params/v1beta1/subspaces`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/params/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/params/v1beta1/query.rpc.Query.ts index 4f50551..64cd6b4 100644 --- a/src/codegen/cosmos/params/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/params/v1beta1/query.rpc.Query.ts @@ -1,9 +1,8 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsResponse, QuerySubspacesRequest, QuerySubspacesResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** * Params queries a specific parameter of a module, given its subspace and @@ -11,30 +10,25 @@ export interface Query { */ params(request: QueryParamsRequest): Promise; /** Subspaces queries for all registered subspaces and all keys for a subspace. */ - subspaces(request?: QuerySubspacesRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.params.v1beta1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(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("cosmos.params.v1beta1.Query", "Subspaces", data); - return promise.then(data => QuerySubspacesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QuerySubspacesResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -43,10 +37,8 @@ export const createRpcQueryExtension = (base: QueryClient) => { params(request: QueryParamsRequest): Promise { return queryService.params(request); }, - subspaces(request?: QuerySubspacesRequest): Promise { return queryService.subspaces(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/params/v1beta1/query.ts b/src/codegen/cosmos/params/v1beta1/query.ts index 8860ecf..8c3724e 100644 --- a/src/codegen/cosmos/params/v1beta1/query.ts +++ b/src/codegen/cosmos/params/v1beta1/query.ts @@ -1,61 +1,103 @@ -import { ParamChange, ParamChangeSDKType } from "./params"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { ParamChange, ParamChangeAmino, ParamChangeSDKType } from "./params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** 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; } +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} /** QueryParamsRequest is request type for the Query/Params RPC method. */ - -export interface QueryParamsRequestSDKType { +export interface QueryParamsRequestAmino { /** subspace defines the module to query the parameter for. */ - subspace: string; + subspace?: string; /** key defines the key of the parameter in the subspace. */ - + key?: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType { + subspace: string; key: string; } /** QueryParamsResponse is response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** param defines the queried parameter. */ - param?: ParamChange; + param: ParamChange; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse"; + value: Uint8Array; } /** QueryParamsResponse is response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** param defines the queried parameter. */ - param?: ParamChangeSDKType; + param?: ParamChangeAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + param: ParamChangeSDKType; } /** * QuerySubspacesRequest defines a request type for querying for all registered * subspaces and all keys for a subspace. */ - export interface QuerySubspacesRequest {} +export interface QuerySubspacesRequestProtoMsg { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest"; + value: Uint8Array; +} +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + */ +export interface QuerySubspacesRequestAmino {} +export interface QuerySubspacesRequestAminoMsg { + type: "cosmos-sdk/QuerySubspacesRequest"; + value: QuerySubspacesRequestAmino; +} /** * QuerySubspacesRequest defines a request type for querying for all registered * subspaces and all keys for a subspace. */ - export interface QuerySubspacesRequestSDKType {} /** * QuerySubspacesResponse defines the response types for querying for all * registered subspaces and all keys for a subspace. */ - export interface QuerySubspacesResponse { subspaces: Subspace[]; } +export interface QuerySubspacesResponseProtoMsg { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse"; + value: Uint8Array; +} +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + */ +export interface QuerySubspacesResponseAmino { + subspaces?: SubspaceAmino[]; +} +export interface QuerySubspacesResponseAminoMsg { + type: "cosmos-sdk/QuerySubspacesResponse"; + value: QuerySubspacesResponseAmino; +} /** * QuerySubspacesResponse defines the response types for querying for all * registered subspaces and all keys for a subspace. */ - export interface QuerySubspacesResponseSDKType { subspaces: SubspaceSDKType[]; } @@ -63,251 +105,391 @@ export interface QuerySubspacesResponseSDKType { * Subspace defines a parameter subspace name and all the keys that exist for * the subspace. */ - export interface Subspace { subspace: string; keys: string[]; } +export interface SubspaceProtoMsg { + typeUrl: "/cosmos.params.v1beta1.Subspace"; + value: Uint8Array; +} +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + */ +export interface SubspaceAmino { + subspace?: string; + keys?: string[]; +} +export interface SubspaceAminoMsg { + type: "cosmos-sdk/Subspace"; + value: SubspaceAmino; +} /** * Subspace defines a parameter subspace name and all the keys that exist for * the subspace. */ - export interface SubspaceSDKType { subspace: string; keys: string[]; } - function createBaseQueryParamsRequest(): QueryParamsRequest { return { subspace: "", key: "" }; } - export const QueryParamsRequest = { - encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", + encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subspace !== "") { writer.uint32(10).string(message.subspace); } - if (message.key !== "") { writer.uint32(18).string(message.key); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParamsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.subspace = reader.string(); break; - case 2: message.key = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsRequest { + fromPartial(object: Partial): QueryParamsRequest { const message = createBaseQueryParamsRequest(); message.subspace = object.subspace ?? ""; message.key = object.key ?? ""; return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + if (object.subspace !== undefined && object.subspace !== null) { + message.subspace = object.subspace; + } + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + return message; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.subspace = message.subspace; + obj.key = message.key; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - param: undefined + param: ParamChange.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.param !== undefined) { ParamChange.encode(message.param, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParamsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.param = ParamChange.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.param = object.param !== undefined && object.param !== null ? ParamChange.fromPartial(object.param) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.param !== undefined && object.param !== null) { + message.param = ParamChange.fromAmino(object.param); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.param = message.param ? ParamChange.toAmino(message.param) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { return {}; } - export const QuerySubspacesRequest = { - encode(_: QuerySubspacesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", + encode(_: QuerySubspacesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySubspacesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QuerySubspacesRequest { + fromPartial(_: Partial): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, + fromAmino(_: QuerySubspacesRequestAmino): QuerySubspacesRequest { const message = createBaseQuerySubspacesRequest(); return message; + }, + toAmino(_: QuerySubspacesRequest): QuerySubspacesRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QuerySubspacesRequestAminoMsg): QuerySubspacesRequest { + return QuerySubspacesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySubspacesRequest): QuerySubspacesRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySubspacesRequest", + value: QuerySubspacesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySubspacesRequestProtoMsg): QuerySubspacesRequest { + return QuerySubspacesRequest.decode(message.value); + }, + toProto(message: QuerySubspacesRequest): Uint8Array { + return QuerySubspacesRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySubspacesRequest): QuerySubspacesRequestProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", + value: QuerySubspacesRequest.encode(message).finish() + }; } - }; - function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { return { subspaces: [] }; } - export const QuerySubspacesResponse = { - encode(message: QuerySubspacesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", + encode(message: QuerySubspacesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.subspaces) { Subspace.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySubspacesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.subspaces.push(Subspace.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySubspacesResponse { + fromPartial(object: Partial): QuerySubspacesResponse { const message = createBaseQuerySubspacesResponse(); message.subspaces = object.subspaces?.map(e => Subspace.fromPartial(e)) || []; return message; + }, + fromAmino(object: QuerySubspacesResponseAmino): QuerySubspacesResponse { + const message = createBaseQuerySubspacesResponse(); + message.subspaces = object.subspaces?.map(e => Subspace.fromAmino(e)) || []; + return message; + }, + toAmino(message: QuerySubspacesResponse): QuerySubspacesResponseAmino { + const obj: any = {}; + if (message.subspaces) { + obj.subspaces = message.subspaces.map(e => e ? Subspace.toAmino(e) : undefined); + } else { + obj.subspaces = []; + } + return obj; + }, + fromAminoMsg(object: QuerySubspacesResponseAminoMsg): QuerySubspacesResponse { + return QuerySubspacesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySubspacesResponse): QuerySubspacesResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySubspacesResponse", + value: QuerySubspacesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySubspacesResponseProtoMsg): QuerySubspacesResponse { + return QuerySubspacesResponse.decode(message.value); + }, + toProto(message: QuerySubspacesResponse): Uint8Array { + return QuerySubspacesResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySubspacesResponse): QuerySubspacesResponseProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", + value: QuerySubspacesResponse.encode(message).finish() + }; } - }; - function createBaseSubspace(): Subspace { return { subspace: "", keys: [] }; } - export const Subspace = { - encode(message: Subspace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.params.v1beta1.Subspace", + encode(message: Subspace, writer: BinaryWriter = BinaryWriter.create()): 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: _m0.Reader | Uint8Array, length?: number): Subspace { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.subspace = reader.string(); break; - case 2: message.keys.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Subspace { + fromPartial(object: Partial): Subspace { const message = createBaseSubspace(); message.subspace = object.subspace ?? ""; message.keys = object.keys?.map(e => e) || []; return message; + }, + fromAmino(object: SubspaceAmino): Subspace { + const message = createBaseSubspace(); + if (object.subspace !== undefined && object.subspace !== null) { + message.subspace = object.subspace; + } + message.keys = object.keys?.map(e => e) || []; + return message; + }, + toAmino(message: Subspace): SubspaceAmino { + const obj: any = {}; + obj.subspace = message.subspace; + if (message.keys) { + obj.keys = message.keys.map(e => e); + } else { + obj.keys = []; + } + return obj; + }, + fromAminoMsg(object: SubspaceAminoMsg): Subspace { + return Subspace.fromAmino(object.value); + }, + toAminoMsg(message: Subspace): SubspaceAminoMsg { + return { + type: "cosmos-sdk/Subspace", + value: Subspace.toAmino(message) + }; + }, + fromProtoMsg(message: SubspaceProtoMsg): Subspace { + return Subspace.decode(message.value); + }, + toProto(message: Subspace): Uint8Array { + return Subspace.encode(message).finish(); + }, + toProtoMsg(message: Subspace): SubspaceProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.Subspace", + value: Subspace.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/genesis.ts b/src/codegen/cosmos/slashing/v1beta1/genesis.ts index 8cba87f..7e4ef3b 100644 --- a/src/codegen/cosmos/slashing/v1beta1/genesis.ts +++ b/src/codegen/cosmos/slashing/v1beta1/genesis.ts @@ -1,329 +1,478 @@ -import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the slashing module's genesis state. */ - export interface GenesisState { /** params defines all the paramaters of related to deposit. */ - params?: Params; + params: Params; /** * 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[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the slashing module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** params defines all the paramaters of related to deposit. */ - params?: ParamsSDKType; + params?: ParamsAmino; /** * signing_infos represents a map between validator addresses and their * signing infos. */ - - signing_infos: SigningInfoSDKType[]; + signing_infos?: SigningInfoAmino[]; /** * missed_blocks represents a map between validator addresses and their * missed blocks. */ - + missed_blocks?: ValidatorMissedBlocksAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the slashing module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + signing_infos: SigningInfoSDKType[]; missed_blocks: ValidatorMissedBlocksSDKType[]; } /** 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; + validatorSigningInfo: ValidatorSigningInfo; +} +export interface SigningInfoProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.SigningInfo"; + value: Uint8Array; } /** SigningInfo stores validator signing info of corresponding address. */ - -export interface SigningInfoSDKType { +export interface SigningInfoAmino { /** address is the validator address. */ - address: string; + address?: string; /** validator_signing_info represents the signing info of this validator. */ - - validator_signing_info?: ValidatorSigningInfoSDKType; + validator_signing_info?: ValidatorSigningInfoAmino; +} +export interface SigningInfoAminoMsg { + type: "cosmos-sdk/SigningInfo"; + value: SigningInfoAmino; +} +/** SigningInfo stores validator signing info of corresponding address. */ +export interface SigningInfoSDKType { + address: string; + validator_signing_info: ValidatorSigningInfoSDKType; } /** * 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[]; } +export interface ValidatorMissedBlocksProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks"; + value: Uint8Array; +} /** * ValidatorMissedBlocks contains array of missed blocks of corresponding * address. */ - -export interface ValidatorMissedBlocksSDKType { +export interface ValidatorMissedBlocksAmino { /** address is the validator address. */ - address: string; + address?: string; /** missed_blocks is an array of missed blocks by the validator. */ - + missed_blocks?: MissedBlockAmino[]; +} +export interface ValidatorMissedBlocksAminoMsg { + type: "cosmos-sdk/ValidatorMissedBlocks"; + value: ValidatorMissedBlocksAmino; +} +/** + * ValidatorMissedBlocks contains array of missed blocks of corresponding + * address. + */ +export interface ValidatorMissedBlocksSDKType { + address: string; missed_blocks: MissedBlockSDKType[]; } /** MissedBlock contains height and missed status as boolean. */ - export interface MissedBlock { /** index is the height at which the block was missed. */ - index: Long; + index: bigint; /** missed is the missed status. */ - missed: boolean; } +export interface MissedBlockProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.MissedBlock"; + value: Uint8Array; +} /** MissedBlock contains height and missed status as boolean. */ - -export interface MissedBlockSDKType { +export interface MissedBlockAmino { /** index is the height at which the block was missed. */ - index: Long; + index?: string; /** missed is the missed status. */ - + missed?: boolean; +} +export interface MissedBlockAminoMsg { + type: "cosmos-sdk/MissedBlock"; + value: MissedBlockAmino; +} +/** MissedBlock contains height and missed status as boolean. */ +export interface MissedBlockSDKType { + index: bigint; missed: boolean; } - function createBaseGenesisState(): GenesisState { return { - params: undefined, + params: Params.fromPartial({}), signingInfos: [], missedBlocks: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - for (const v of message.signingInfos) { SigningInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.missedBlocks) { ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.params = Params.decode(reader, reader.uint32()); break; - case 2: message.signingInfos.push(SigningInfo.decode(reader, reader.uint32())); break; - case 3: message.missedBlocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): 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; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.signingInfos = object.signing_infos?.map(e => SigningInfo.fromAmino(e)) || []; + message.missedBlocks = object.missed_blocks?.map(e => ValidatorMissedBlocks.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.signingInfos) { + obj.signing_infos = message.signingInfos.map(e => e ? SigningInfo.toAmino(e) : undefined); + } else { + obj.signing_infos = []; + } + if (message.missedBlocks) { + obj.missed_blocks = message.missedBlocks.map(e => e ? ValidatorMissedBlocks.toAmino(e) : undefined); + } else { + obj.missed_blocks = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; - function createBaseSigningInfo(): SigningInfo { return { address: "", - validatorSigningInfo: undefined + validatorSigningInfo: ValidatorSigningInfo.fromPartial({}) }; } - export const SigningInfo = { - encode(message: SigningInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", + encode(message: SigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.validatorSigningInfo !== undefined) { ValidatorSigningInfo.encode(message.validatorSigningInfo, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SigningInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - case 2: message.validatorSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SigningInfo { + fromPartial(object: Partial): SigningInfo { const message = createBaseSigningInfo(); message.address = object.address ?? ""; message.validatorSigningInfo = object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null ? ValidatorSigningInfo.fromPartial(object.validatorSigningInfo) : undefined; return message; + }, + fromAmino(object: SigningInfoAmino): SigningInfo { + const message = createBaseSigningInfo(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.validator_signing_info !== undefined && object.validator_signing_info !== null) { + message.validatorSigningInfo = ValidatorSigningInfo.fromAmino(object.validator_signing_info); + } + return message; + }, + toAmino(message: SigningInfo): SigningInfoAmino { + const obj: any = {}; + obj.address = message.address; + obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; + return obj; + }, + fromAminoMsg(object: SigningInfoAminoMsg): SigningInfo { + return SigningInfo.fromAmino(object.value); + }, + toAminoMsg(message: SigningInfo): SigningInfoAminoMsg { + return { + type: "cosmos-sdk/SigningInfo", + value: SigningInfo.toAmino(message) + }; + }, + fromProtoMsg(message: SigningInfoProtoMsg): SigningInfo { + return SigningInfo.decode(message.value); + }, + toProto(message: SigningInfo): Uint8Array { + return SigningInfo.encode(message).finish(); + }, + toProtoMsg(message: SigningInfo): SigningInfoProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", + value: SigningInfo.encode(message).finish() + }; } - }; - function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { return { address: "", missedBlocks: [] }; } - export const ValidatorMissedBlocks = { - encode(message: ValidatorMissedBlocks, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", + encode(message: ValidatorMissedBlocks, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - for (const v of message.missedBlocks) { MissedBlock.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorMissedBlocks { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - case 2: message.missedBlocks.push(MissedBlock.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorMissedBlocks { + fromPartial(object: Partial): ValidatorMissedBlocks { const message = createBaseValidatorMissedBlocks(); message.address = object.address ?? ""; message.missedBlocks = object.missedBlocks?.map(e => MissedBlock.fromPartial(e)) || []; return message; + }, + fromAmino(object: ValidatorMissedBlocksAmino): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.missedBlocks = object.missed_blocks?.map(e => MissedBlock.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { + const obj: any = {}; + obj.address = message.address; + if (message.missedBlocks) { + obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); + } else { + obj.missed_blocks = []; + } + return obj; + }, + fromAminoMsg(object: ValidatorMissedBlocksAminoMsg): ValidatorMissedBlocks { + return ValidatorMissedBlocks.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorMissedBlocks): ValidatorMissedBlocksAminoMsg { + return { + type: "cosmos-sdk/ValidatorMissedBlocks", + value: ValidatorMissedBlocks.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorMissedBlocksProtoMsg): ValidatorMissedBlocks { + return ValidatorMissedBlocks.decode(message.value); + }, + toProto(message: ValidatorMissedBlocks): Uint8Array { + return ValidatorMissedBlocks.encode(message).finish(); + }, + toProtoMsg(message: ValidatorMissedBlocks): ValidatorMissedBlocksProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", + value: ValidatorMissedBlocks.encode(message).finish() + }; } - }; - function createBaseMissedBlock(): MissedBlock { return { - index: Long.ZERO, + index: BigInt(0), missed: false }; } - export const MissedBlock = { - encode(message: MissedBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.index.isZero()) { + typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", + encode(message: MissedBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.index !== BigInt(0)) { writer.uint32(8).int64(message.index); } - if (message.missed === true) { writer.uint32(16).bool(message.missed); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MissedBlock { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.index = (reader.int64() as Long); + message.index = reader.int64(); break; - case 2: message.missed = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MissedBlock { + fromPartial(object: Partial): MissedBlock { const message = createBaseMissedBlock(); - message.index = object.index !== undefined && object.index !== null ? Long.fromValue(object.index) : Long.ZERO; + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); message.missed = object.missed ?? false; return message; + }, + fromAmino(object: MissedBlockAmino): MissedBlock { + const message = createBaseMissedBlock(); + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + if (object.missed !== undefined && object.missed !== null) { + message.missed = object.missed; + } + return message; + }, + toAmino(message: MissedBlock): MissedBlockAmino { + const obj: any = {}; + obj.index = message.index ? message.index.toString() : undefined; + obj.missed = message.missed; + return obj; + }, + fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { + return MissedBlock.fromAmino(object.value); + }, + toAminoMsg(message: MissedBlock): MissedBlockAminoMsg { + return { + type: "cosmos-sdk/MissedBlock", + value: MissedBlock.toAmino(message) + }; + }, + fromProtoMsg(message: MissedBlockProtoMsg): MissedBlock { + return MissedBlock.decode(message.value); + }, + toProto(message: MissedBlock): Uint8Array { + return MissedBlock.encode(message).finish(); + }, + toProtoMsg(message: MissedBlock): MissedBlockProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", + value: MissedBlock.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/query.lcd.ts b/src/codegen/cosmos/slashing/v1beta1/query.lcd.ts index 346fd6c..dbce402 100644 --- a/src/codegen/cosmos/slashing/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/slashing/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryParamsRequest, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -15,35 +14,26 @@ export class LCDQueryClient { this.signingInfos = this.signingInfos.bind(this); } /* Params queries the parameters of slashing module */ - - async params(_params: QueryParamsRequest = {}): Promise { const endpoint = `cosmos/slashing/v1beta1/params`; return await this.req.get(endpoint); } /* SigningInfo queries the signing info of given cons address */ - - async signingInfo(params: QuerySigningInfoRequest): Promise { const endpoint = `cosmos/slashing/v1beta1/signing_infos/${params.consAddress}`; return await this.req.get(endpoint); } /* SigningInfos queries signing info of all validators */ - - async signingInfos(params: QuerySigningInfosRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/slashing/v1beta1/signing_infos`; return await this.req.get(endpoint, options); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/slashing/v1beta1/query.rpc.Query.ts index 94cb5ce..83586b5 100644 --- a/src/codegen/cosmos/slashing/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/slashing/v1beta1/query.rpc.Query.ts @@ -1,49 +1,41 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsResponse, QuerySigningInfoRequest, QuerySigningInfoResponse, QuerySigningInfosRequest, QuerySigningInfosResponse } from "./query"; /** Query provides defines the gRPC querier service */ - export interface Query { /** Params queries the parameters of slashing module */ params(request?: QueryParamsRequest): Promise; /** SigningInfo queries the signing info of given cons address */ - signingInfo(request: QuerySigningInfoRequest): Promise; /** SigningInfos queries signing info of all validators */ - signingInfos(request?: QuerySigningInfosRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.slashing.v1beta1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(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("cosmos.slashing.v1beta1.Query", "SigningInfo", data); - return promise.then(data => QuerySigningInfoResponse.decode(new _m0.Reader(data))); + return promise.then(data => QuerySigningInfoResponse.decode(new BinaryReader(data))); } - signingInfos(request: QuerySigningInfosRequest = { pagination: undefined }): Promise { const data = QuerySigningInfosRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.slashing.v1beta1.Query", "SigningInfos", data); - return promise.then(data => QuerySigningInfosResponse.decode(new _m0.Reader(data))); + return promise.then(data => QuerySigningInfosResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -52,14 +44,11 @@ export const createRpcQueryExtension = (base: QueryClient) => { params(request?: QueryParamsRequest): Promise { return queryService.params(request); }, - signingInfo(request: QuerySigningInfoRequest): Promise { return queryService.signingInfo(request); }, - signingInfos(request?: QuerySigningInfosRequest): Promise { return queryService.signingInfos(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/query.ts b/src/codegen/cosmos/slashing/v1beta1/query.ts index 9f2a3b9..d81bc6b 100644 --- a/src/codegen/cosmos/slashing/v1beta1/query.ts +++ b/src/codegen/cosmos/slashing/v1beta1/query.ts @@ -1,72 +1,128 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ - export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsRequest is the request type for the Query/Params RPC method */ - export interface QueryParamsRequestSDKType {} /** QueryParamsResponse is the response type for the Query/Params RPC method */ - export interface QueryParamsResponse { - params?: Params; + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; } /** QueryParamsResponse is the response type for the Query/Params RPC method */ - export interface QueryParamsResponseSDKType { - params?: ParamsSDKType; + params: ParamsSDKType; } /** * 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; } +export interface QuerySigningInfoRequestProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest"; + value: Uint8Array; +} /** * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC * method */ - -export interface QuerySigningInfoRequestSDKType { +export interface QuerySigningInfoRequestAmino { /** cons_address is the address to query signing info of */ + cons_address?: string; +} +export interface QuerySigningInfoRequestAminoMsg { + type: "cosmos-sdk/QuerySigningInfoRequest"; + value: QuerySigningInfoRequestAmino; +} +/** + * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoRequestSDKType { cons_address: string; } /** * QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC * method */ - export interface QuerySigningInfoResponse { /** val_signing_info is the signing info of requested val cons address */ - valSigningInfo?: ValidatorSigningInfo; + valSigningInfo: ValidatorSigningInfo; +} +export interface QuerySigningInfoResponseProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse"; + value: Uint8Array; } /** * QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC * method */ - -export interface QuerySigningInfoResponseSDKType { +export interface QuerySigningInfoResponseAmino { /** val_signing_info is the signing info of requested val cons address */ - val_signing_info?: ValidatorSigningInfoSDKType; + val_signing_info?: ValidatorSigningInfoAmino; +} +export interface QuerySigningInfoResponseAminoMsg { + type: "cosmos-sdk/QuerySigningInfoResponse"; + value: QuerySigningInfoResponseAmino; +} +/** + * QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoResponseSDKType { + val_signing_info: ValidatorSigningInfoSDKType; } /** * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC * method */ - export interface QuerySigningInfosRequest { pagination?: PageRequest; } +export interface QuerySigningInfosRequestProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest"; + value: Uint8Array; +} +/** + * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosRequestAmino { + pagination?: PageRequestAmino; +} +export interface QuerySigningInfosRequestAminoMsg { + type: "cosmos-sdk/QuerySigningInfosRequest"; + value: QuerySigningInfosRequestAmino; +} /** * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC * method */ - export interface QuerySigningInfosRequestSDKType { pagination?: PageRequestSDKType; } @@ -74,288 +130,448 @@ export interface QuerySigningInfosRequestSDKType { * 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; } +export interface QuerySigningInfosResponseProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse"; + value: Uint8Array; +} /** * QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC * method */ - -export interface QuerySigningInfosResponseSDKType { +export interface QuerySigningInfosResponseAmino { /** info is the signing info of all validators */ + info?: ValidatorSigningInfoAmino[]; + pagination?: PageResponseAmino; +} +export interface QuerySigningInfosResponseAminoMsg { + type: "cosmos-sdk/QuerySigningInfosResponse"; + value: QuerySigningInfosResponseAmino; +} +/** + * QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosResponseSDKType { info: ValidatorSigningInfoSDKType[]; pagination?: PageResponseSDKType; } - function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } - export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParamsRequest { + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + params: Params.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { return { consAddress: "" }; } - export const QuerySigningInfoRequest = { - encode(message: QuerySigningInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", + encode(message: QuerySigningInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consAddress !== "") { writer.uint32(10).string(message.consAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfoRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.consAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySigningInfoRequest { + fromPartial(object: Partial): QuerySigningInfoRequest { const message = createBaseQuerySigningInfoRequest(); message.consAddress = object.consAddress ?? ""; return message; + }, + fromAmino(object: QuerySigningInfoRequestAmino): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + if (object.cons_address !== undefined && object.cons_address !== null) { + message.consAddress = object.cons_address; + } + return message; + }, + toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { + const obj: any = {}; + obj.cons_address = message.consAddress; + return obj; + }, + fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { + return QuerySigningInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySigningInfoRequest): QuerySigningInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySigningInfoRequest", + value: QuerySigningInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySigningInfoRequestProtoMsg): QuerySigningInfoRequest { + return QuerySigningInfoRequest.decode(message.value); + }, + toProto(message: QuerySigningInfoRequest): Uint8Array { + return QuerySigningInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySigningInfoRequest): QuerySigningInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", + value: QuerySigningInfoRequest.encode(message).finish() + }; } - }; - function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { return { - valSigningInfo: undefined + valSigningInfo: ValidatorSigningInfo.fromPartial({}) }; } - export const QuerySigningInfoResponse = { - encode(message: QuerySigningInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse", + encode(message: QuerySigningInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.valSigningInfo !== undefined) { ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfoResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.valSigningInfo = ValidatorSigningInfo.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySigningInfoResponse { + fromPartial(object: Partial): QuerySigningInfoResponse { const message = createBaseQuerySigningInfoResponse(); message.valSigningInfo = object.valSigningInfo !== undefined && object.valSigningInfo !== null ? ValidatorSigningInfo.fromPartial(object.valSigningInfo) : undefined; return message; + }, + fromAmino(object: QuerySigningInfoResponseAmino): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + if (object.val_signing_info !== undefined && object.val_signing_info !== null) { + message.valSigningInfo = ValidatorSigningInfo.fromAmino(object.val_signing_info); + } + return message; + }, + toAmino(message: QuerySigningInfoResponse): QuerySigningInfoResponseAmino { + const obj: any = {}; + obj.val_signing_info = message.valSigningInfo ? ValidatorSigningInfo.toAmino(message.valSigningInfo) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySigningInfoResponseAminoMsg): QuerySigningInfoResponse { + return QuerySigningInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySigningInfoResponse): QuerySigningInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySigningInfoResponse", + value: QuerySigningInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySigningInfoResponseProtoMsg): QuerySigningInfoResponse { + return QuerySigningInfoResponse.decode(message.value); + }, + toProto(message: QuerySigningInfoResponse): Uint8Array { + return QuerySigningInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySigningInfoResponse): QuerySigningInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse", + value: QuerySigningInfoResponse.encode(message).finish() + }; } - }; - function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { return { pagination: undefined }; } - export const QuerySigningInfosRequest = { - encode(message: QuerySigningInfosRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest", + encode(message: QuerySigningInfosRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfosRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySigningInfosRequest { + fromPartial(object: Partial): QuerySigningInfosRequest { const message = createBaseQuerySigningInfosRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QuerySigningInfosRequestAmino): QuerySigningInfosRequest { + const message = createBaseQuerySigningInfosRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySigningInfosRequest): QuerySigningInfosRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySigningInfosRequestAminoMsg): QuerySigningInfosRequest { + return QuerySigningInfosRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySigningInfosRequest): QuerySigningInfosRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySigningInfosRequest", + value: QuerySigningInfosRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySigningInfosRequestProtoMsg): QuerySigningInfosRequest { + return QuerySigningInfosRequest.decode(message.value); + }, + toProto(message: QuerySigningInfosRequest): Uint8Array { + return QuerySigningInfosRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySigningInfosRequest): QuerySigningInfosRequestProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest", + value: QuerySigningInfosRequest.encode(message).finish() + }; } - }; - function createBaseQuerySigningInfosResponse(): QuerySigningInfosResponse { return { info: [], pagination: undefined }; } - export const QuerySigningInfosResponse = { - encode(message: QuerySigningInfosResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse", + encode(message: QuerySigningInfosResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.info) { ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfosResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySigningInfosResponse { + fromPartial(object: Partial): 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; + }, + fromAmino(object: QuerySigningInfosResponseAmino): QuerySigningInfosResponse { + const message = createBaseQuerySigningInfosResponse(); + message.info = object.info?.map(e => ValidatorSigningInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySigningInfosResponse): QuerySigningInfosResponseAmino { + const obj: any = {}; + if (message.info) { + obj.info = message.info.map(e => e ? ValidatorSigningInfo.toAmino(e) : undefined); + } else { + obj.info = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySigningInfosResponseAminoMsg): QuerySigningInfosResponse { + return QuerySigningInfosResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySigningInfosResponse): QuerySigningInfosResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySigningInfosResponse", + value: QuerySigningInfosResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySigningInfosResponseProtoMsg): QuerySigningInfosResponse { + return QuerySigningInfosResponse.decode(message.value); + }, + toProto(message: QuerySigningInfosResponse): Uint8Array { + return QuerySigningInfosResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySigningInfosResponse): QuerySigningInfosResponseProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse", + value: QuerySigningInfosResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/slashing.ts b/src/codegen/cosmos/slashing/v1beta1/slashing.ts index d587cd9..bcd01c2 100644 --- a/src/codegen/cosmos/slashing/v1beta1/slashing.ts +++ b/src/codegen/cosmos/slashing/v1beta1/slashing.ts @@ -1,268 +1,356 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; -import * as _m0 from "protobufjs/minimal"; -import { toTimestamp, Long, fromTimestamp, DeepPartial } from "../../../helpers"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their * liveness activity. */ - export interface ValidatorSigningInfo { address: string; /** Height at which validator was first a candidate OR was unjailed */ - - startHeight: Long; + startHeight: bigint; /** * Index which is incremented each time the validator was a bonded * in a block and may have signed a precommit or not. This in conjunction with the * `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. */ - - indexOffset: Long; + indexOffset: bigint; /** Timestamp until which the validator is jailed due to liveness downtime. */ - - jailedUntil?: Date; + jailedUntil: Date; /** * Whether or not a validator has been tombstoned (killed out of validator set). It is set * once the validator commits an equivocation or for any other configured misbehiavor. */ - tombstoned: boolean; /** * A counter kept to avoid unnecessary array reads. * Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. */ - - missedBlocksCounter: Long; + missedBlocksCounter: bigint; +} +export interface ValidatorSigningInfoProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo"; + value: Uint8Array; } /** * ValidatorSigningInfo defines a validator's signing info for monitoring their * liveness activity. */ - -export interface ValidatorSigningInfoSDKType { - address: string; +export interface ValidatorSigningInfoAmino { + address?: string; /** Height at which validator was first a candidate OR was unjailed */ - - start_height: Long; + start_height?: string; /** * Index which is incremented each time the validator was a bonded * in a block and may have signed a precommit or not. This in conjunction with the * `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. */ - - index_offset: Long; + index_offset?: string; /** Timestamp until which the validator is jailed due to liveness downtime. */ - - jailed_until?: Date; + jailed_until?: string; /** * Whether or not a validator has been tombstoned (killed out of validator set). It is set * once the validator commits an equivocation or for any other configured misbehiavor. */ - - tombstoned: boolean; + tombstoned?: boolean; /** * A counter kept to avoid unnecessary array reads. * Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. */ - - missed_blocks_counter: Long; + missed_blocks_counter?: string; +} +export interface ValidatorSigningInfoAminoMsg { + type: "cosmos-sdk/ValidatorSigningInfo"; + value: ValidatorSigningInfoAmino; +} +/** + * ValidatorSigningInfo defines a validator's signing info for monitoring their + * liveness activity. + */ +export interface ValidatorSigningInfoSDKType { + address: string; + start_height: bigint; + index_offset: bigint; + jailed_until: Date; + tombstoned: boolean; + missed_blocks_counter: bigint; } /** Params represents the parameters used for by the slashing module. */ - export interface Params { - signedBlocksWindow: Long; + signedBlocksWindow: bigint; minSignedPerWindow: Uint8Array; - downtimeJailDuration?: Duration; + downtimeJailDuration: Duration; slashFractionDoubleSign: Uint8Array; slashFractionDowntime: Uint8Array; } +export interface ParamsProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.Params"; + value: Uint8Array; +} +/** Params represents the parameters used for by the slashing module. */ +export interface ParamsAmino { + signed_blocks_window?: string; + min_signed_per_window?: string; + downtime_jail_duration?: DurationAmino; + slash_fraction_double_sign?: string; + slash_fraction_downtime?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} /** Params represents the parameters used for by the slashing module. */ - export interface ParamsSDKType { - signed_blocks_window: Long; + signed_blocks_window: bigint; min_signed_per_window: Uint8Array; - downtime_jail_duration?: DurationSDKType; + downtime_jail_duration: DurationSDKType; slash_fraction_double_sign: Uint8Array; slash_fraction_downtime: Uint8Array; } - function createBaseValidatorSigningInfo(): ValidatorSigningInfo { return { address: "", - startHeight: Long.ZERO, - indexOffset: Long.ZERO, - jailedUntil: undefined, + startHeight: BigInt(0), + indexOffset: BigInt(0), + jailedUntil: new Date(), tombstoned: false, - missedBlocksCounter: Long.ZERO + missedBlocksCounter: BigInt(0) }; } - export const ValidatorSigningInfo = { - encode(message: ValidatorSigningInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", + encode(message: ValidatorSigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - - if (!message.startHeight.isZero()) { + if (message.startHeight !== BigInt(0)) { writer.uint32(16).int64(message.startHeight); } - - if (!message.indexOffset.isZero()) { + if (message.indexOffset !== BigInt(0)) { writer.uint32(24).int64(message.indexOffset); } - if (message.jailedUntil !== undefined) { Timestamp.encode(toTimestamp(message.jailedUntil), writer.uint32(34).fork()).ldelim(); } - if (message.tombstoned === true) { writer.uint32(40).bool(message.tombstoned); } - - if (!message.missedBlocksCounter.isZero()) { + if (message.missedBlocksCounter !== BigInt(0)) { writer.uint32(48).int64(message.missedBlocksCounter); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSigningInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - case 2: - message.startHeight = (reader.int64() as Long); + message.startHeight = reader.int64(); break; - case 3: - message.indexOffset = (reader.int64() as Long); + message.indexOffset = reader.int64(); break; - case 4: message.jailedUntil = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 5: message.tombstoned = reader.bool(); break; - case 6: - message.missedBlocksCounter = (reader.int64() as Long); + message.missedBlocksCounter = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorSigningInfo { + fromPartial(object: Partial): ValidatorSigningInfo { const message = createBaseValidatorSigningInfo(); message.address = object.address ?? ""; - message.startHeight = object.startHeight !== undefined && object.startHeight !== null ? Long.fromValue(object.startHeight) : Long.ZERO; - message.indexOffset = object.indexOffset !== undefined && object.indexOffset !== null ? Long.fromValue(object.indexOffset) : Long.ZERO; + message.startHeight = object.startHeight !== undefined && object.startHeight !== null ? BigInt(object.startHeight.toString()) : BigInt(0); + message.indexOffset = object.indexOffset !== undefined && object.indexOffset !== null ? BigInt(object.indexOffset.toString()) : BigInt(0); message.jailedUntil = object.jailedUntil ?? undefined; message.tombstoned = object.tombstoned ?? false; - message.missedBlocksCounter = object.missedBlocksCounter !== undefined && object.missedBlocksCounter !== null ? Long.fromValue(object.missedBlocksCounter) : Long.ZERO; + message.missedBlocksCounter = object.missedBlocksCounter !== undefined && object.missedBlocksCounter !== null ? BigInt(object.missedBlocksCounter.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorSigningInfoAmino): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.start_height !== undefined && object.start_height !== null) { + message.startHeight = BigInt(object.start_height); + } + if (object.index_offset !== undefined && object.index_offset !== null) { + message.indexOffset = BigInt(object.index_offset); + } + if (object.jailed_until !== undefined && object.jailed_until !== null) { + message.jailedUntil = fromTimestamp(Timestamp.fromAmino(object.jailed_until)); + } + if (object.tombstoned !== undefined && object.tombstoned !== null) { + message.tombstoned = object.tombstoned; + } + if (object.missed_blocks_counter !== undefined && object.missed_blocks_counter !== null) { + message.missedBlocksCounter = BigInt(object.missed_blocks_counter); + } return message; + }, + toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { + const obj: any = {}; + obj.address = message.address; + obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; + obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; + obj.tombstoned = message.tombstoned; + obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { + return ValidatorSigningInfo.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSigningInfo): ValidatorSigningInfoAminoMsg { + return { + type: "cosmos-sdk/ValidatorSigningInfo", + value: ValidatorSigningInfo.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSigningInfoProtoMsg): ValidatorSigningInfo { + return ValidatorSigningInfo.decode(message.value); + }, + toProto(message: ValidatorSigningInfo): Uint8Array { + return ValidatorSigningInfo.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSigningInfo): ValidatorSigningInfoProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", + value: ValidatorSigningInfo.encode(message).finish() + }; } - }; - function createBaseParams(): Params { return { - signedBlocksWindow: Long.ZERO, + signedBlocksWindow: BigInt(0), minSignedPerWindow: new Uint8Array(), - downtimeJailDuration: undefined, + downtimeJailDuration: Duration.fromPartial({}), slashFractionDoubleSign: new Uint8Array(), slashFractionDowntime: new Uint8Array() }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.signedBlocksWindow.isZero()) { + typeUrl: "/cosmos.slashing.v1beta1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signedBlocksWindow !== BigInt(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()).ldelim(); } - 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: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.signedBlocksWindow = (reader.int64() as Long); + message.signedBlocksWindow = reader.int64(); break; - case 2: message.minSignedPerWindow = reader.bytes(); break; - case 3: message.downtimeJailDuration = Duration.decode(reader, reader.uint32()); break; - case 4: message.slashFractionDoubleSign = reader.bytes(); break; - case 5: message.slashFractionDowntime = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); - message.signedBlocksWindow = object.signedBlocksWindow !== undefined && object.signedBlocksWindow !== null ? Long.fromValue(object.signedBlocksWindow) : Long.ZERO; + message.signedBlocksWindow = object.signedBlocksWindow !== undefined && object.signedBlocksWindow !== null ? BigInt(object.signedBlocksWindow.toString()) : BigInt(0); message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(); message.downtimeJailDuration = object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null ? Duration.fromPartial(object.downtimeJailDuration) : undefined; message.slashFractionDoubleSign = object.slashFractionDoubleSign ?? new Uint8Array(); message.slashFractionDowntime = object.slashFractionDowntime ?? new Uint8Array(); return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.signed_blocks_window !== undefined && object.signed_blocks_window !== null) { + message.signedBlocksWindow = BigInt(object.signed_blocks_window); + } + if (object.min_signed_per_window !== undefined && object.min_signed_per_window !== null) { + message.minSignedPerWindow = bytesFromBase64(object.min_signed_per_window); + } + if (object.downtime_jail_duration !== undefined && object.downtime_jail_duration !== null) { + message.downtimeJailDuration = Duration.fromAmino(object.downtime_jail_duration); + } + if (object.slash_fraction_double_sign !== undefined && object.slash_fraction_double_sign !== null) { + message.slashFractionDoubleSign = bytesFromBase64(object.slash_fraction_double_sign); + } + if (object.slash_fraction_downtime !== undefined && object.slash_fraction_downtime !== null) { + message.slashFractionDowntime = bytesFromBase64(object.slash_fraction_downtime); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.min_signed_per_window = message.minSignedPerWindow ? base64FromBytes(message.minSignedPerWindow) : undefined; + obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; + obj.slash_fraction_double_sign = message.slashFractionDoubleSign ? base64FromBytes(message.slashFractionDoubleSign) : undefined; + obj.slash_fraction_downtime = message.slashFractionDowntime ? base64FromBytes(message.slashFractionDowntime) : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.Params", + value: Params.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/tx.amino.ts b/src/codegen/cosmos/slashing/v1beta1/tx.amino.ts index 2947b60..9f63825 100644 --- a/src/codegen/cosmos/slashing/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/slashing/v1beta1/tx.amino.ts @@ -1,27 +1,8 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgUnjail } from "./tx"; -export interface AminoMsgUnjail extends AminoMsg { - type: "cosmos-sdk/MsgUnjail"; - value: { - validator_addr: string; - }; -} export const AminoConverter = { "/cosmos.slashing.v1beta1.MsgUnjail": { aminoType: "cosmos-sdk/MsgUnjail", - toAmino: ({ - validatorAddr - }: MsgUnjail): AminoMsgUnjail["value"] => { - return { - validator_addr: validatorAddr - }; - }, - fromAmino: ({ - validator_addr - }: AminoMsgUnjail["value"]): MsgUnjail => { - return { - validatorAddr: validator_addr - }; - } + toAmino: MsgUnjail.toAmino, + fromAmino: MsgUnjail.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/tx.registry.ts b/src/codegen/cosmos/slashing/v1beta1/tx.registry.ts index 449d8a3..76feebd 100644 --- a/src/codegen/cosmos/slashing/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/slashing/v1beta1/tx.registry.ts @@ -14,7 +14,6 @@ export const MessageComposer = { value: MsgUnjail.encode(value).finish() }; } - }, withTypeUrl: { unjail(value: MsgUnjail) { @@ -23,7 +22,6 @@ export const MessageComposer = { value }; } - }, fromPartial: { unjail(value: MsgUnjail) { @@ -32,6 +30,5 @@ export const MessageComposer = { value: MsgUnjail.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/slashing/v1beta1/tx.rpc.msg.ts index 622712b..5a4b327 100644 --- a/src/codegen/cosmos/slashing/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/slashing/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgUnjail, MsgUnjailResponse } from "./tx"; /** Msg defines the slashing Msg service. */ - export interface Msg { /** * Unjail defines a method for unjailing a jailed validator, thus returning @@ -13,16 +12,13 @@ export interface Msg { } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.unjail = this.unjail.bind(this); } - unjail(request: MsgUnjail): Promise { const data = MsgUnjail.encode(request).finish(); const promise = this.rpc.request("cosmos.slashing.v1beta1.Msg", "Unjail", data); - return promise.then(data => MsgUnjailResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgUnjailResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/slashing/v1beta1/tx.ts b/src/codegen/cosmos/slashing/v1beta1/tx.ts index 2a7e57e..f82292e 100644 --- a/src/codegen/cosmos/slashing/v1beta1/tx.ts +++ b/src/codegen/cosmos/slashing/v1beta1/tx.ts @@ -1,97 +1,160 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** MsgUnjail defines the Msg/Unjail request type */ - export interface MsgUnjail { validatorAddr: string; } +export interface MsgUnjailProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail"; + value: Uint8Array; +} +/** MsgUnjail defines the Msg/Unjail request type */ +export interface MsgUnjailAmino { + validator_addr?: string; +} +export interface MsgUnjailAminoMsg { + type: "cosmos-sdk/MsgUnjail"; + value: MsgUnjailAmino; +} /** MsgUnjail defines the Msg/Unjail request type */ - export interface MsgUnjailSDKType { validator_addr: string; } /** MsgUnjailResponse defines the Msg/Unjail response type */ - export interface MsgUnjailResponse {} +export interface MsgUnjailResponseProtoMsg { + typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse"; + value: Uint8Array; +} +/** MsgUnjailResponse defines the Msg/Unjail response type */ +export interface MsgUnjailResponseAmino {} +export interface MsgUnjailResponseAminoMsg { + type: "cosmos-sdk/MsgUnjailResponse"; + value: MsgUnjailResponseAmino; +} /** MsgUnjailResponse defines the Msg/Unjail response type */ - export interface MsgUnjailResponseSDKType {} - function createBaseMsgUnjail(): MsgUnjail { return { validatorAddr: "" }; } - export const MsgUnjail = { - encode(message: MsgUnjail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", + encode(message: MsgUnjail, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnjail { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUnjail { + fromPartial(object: Partial): MsgUnjail { const message = createBaseMsgUnjail(); message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: MsgUnjailAmino): MsgUnjail { + const message = createBaseMsgUnjail(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: MsgUnjail): MsgUnjailAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: MsgUnjailAminoMsg): MsgUnjail { + return MsgUnjail.fromAmino(object.value); + }, + toAminoMsg(message: MsgUnjail): MsgUnjailAminoMsg { + return { + type: "cosmos-sdk/MsgUnjail", + value: MsgUnjail.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUnjailProtoMsg): MsgUnjail { + return MsgUnjail.decode(message.value); + }, + toProto(message: MsgUnjail): Uint8Array { + return MsgUnjail.encode(message).finish(); + }, + toProtoMsg(message: MsgUnjail): MsgUnjailProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", + value: MsgUnjail.encode(message).finish() + }; } - }; - function createBaseMsgUnjailResponse(): MsgUnjailResponse { return {}; } - export const MsgUnjailResponse = { - encode(_: MsgUnjailResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse", + encode(_: MsgUnjailResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnjailResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUnjailResponse { + fromPartial(_: Partial): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, + fromAmino(_: MsgUnjailResponseAmino): MsgUnjailResponse { const message = createBaseMsgUnjailResponse(); return message; + }, + toAmino(_: MsgUnjailResponse): MsgUnjailResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUnjailResponseAminoMsg): MsgUnjailResponse { + return MsgUnjailResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUnjailResponse): MsgUnjailResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUnjailResponse", + value: MsgUnjailResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUnjailResponseProtoMsg): MsgUnjailResponse { + return MsgUnjailResponse.decode(message.value); + }, + toProto(message: MsgUnjailResponse): Uint8Array { + return MsgUnjailResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUnjailResponse): MsgUnjailResponseProtoMsg { + return { + typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse", + value: MsgUnjailResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/authz.ts b/src/codegen/cosmos/staking/v1beta1/authz.ts index aed0bd5..131243d 100644 --- a/src/codegen/cosmos/staking/v1beta1/authz.ts +++ b/src/codegen/cosmos/staking/v1beta1/authz.ts @@ -1,64 +1,37 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * AuthorizationType defines the type of staking module authorization type * * Since: cosmos-sdk 0.43 */ - export enum AuthorizationType { /** AUTHORIZATION_TYPE_UNSPECIFIED - AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type */ AUTHORIZATION_TYPE_UNSPECIFIED = 0, - /** AUTHORIZATION_TYPE_DELEGATE - AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate */ AUTHORIZATION_TYPE_DELEGATE = 1, - /** AUTHORIZATION_TYPE_UNDELEGATE - AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate */ AUTHORIZATION_TYPE_UNDELEGATE = 2, - - /** AUTHORIZATION_TYPE_REDELEGATE - AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate */ - AUTHORIZATION_TYPE_REDELEGATE = 3, - UNRECOGNIZED = -1, -} -/** - * AuthorizationType defines the type of staking module authorization type - * - * Since: cosmos-sdk 0.43 - */ - -export enum AuthorizationTypeSDKType { - /** AUTHORIZATION_TYPE_UNSPECIFIED - AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type */ - AUTHORIZATION_TYPE_UNSPECIFIED = 0, - - /** AUTHORIZATION_TYPE_DELEGATE - AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate */ - AUTHORIZATION_TYPE_DELEGATE = 1, - - /** AUTHORIZATION_TYPE_UNDELEGATE - AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate */ - AUTHORIZATION_TYPE_UNDELEGATE = 2, - /** AUTHORIZATION_TYPE_REDELEGATE - AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate */ AUTHORIZATION_TYPE_REDELEGATE = 3, UNRECOGNIZED = -1, } +export const AuthorizationTypeSDKType = AuthorizationType; +export const AuthorizationTypeAmino = AuthorizationType; export function authorizationTypeFromJSON(object: any): AuthorizationType { switch (object) { case 0: case "AUTHORIZATION_TYPE_UNSPECIFIED": return AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED; - case 1: case "AUTHORIZATION_TYPE_DELEGATE": return AuthorizationType.AUTHORIZATION_TYPE_DELEGATE; - case 2: case "AUTHORIZATION_TYPE_UNDELEGATE": return AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE; - case 3: case "AUTHORIZATION_TYPE_REDELEGATE": return AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE; - case -1: case "UNRECOGNIZED": default: @@ -69,16 +42,12 @@ export function authorizationTypeToJSON(object: AuthorizationType): string { switch (object) { case AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED: return "AUTHORIZATION_TYPE_UNSPECIFIED"; - case AuthorizationType.AUTHORIZATION_TYPE_DELEGATE: return "AUTHORIZATION_TYPE_DELEGATE"; - case AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE: return "AUTHORIZATION_TYPE_UNDELEGATE"; - case AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE: return "AUTHORIZATION_TYPE_REDELEGATE"; - case AuthorizationType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -89,7 +58,6 @@ export function authorizationTypeToJSON(object: AuthorizationType): string { * * 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 @@ -100,51 +68,72 @@ export interface StakeAuthorization { * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's * account. */ - allowList?: StakeAuthorization_Validators; /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ - denyList?: StakeAuthorization_Validators; /** authorization_type defines one of AuthorizationType. */ - authorizationType: AuthorizationType; } +export interface StakeAuthorizationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization"; + value: Uint8Array; +} /** * StakeAuthorization defines authorization for delegate/undelegate/redelegate. * * Since: cosmos-sdk 0.43 */ - -export interface StakeAuthorizationSDKType { +export interface StakeAuthorizationAmino { /** * max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is * empty, there is no spend limit and any amount of coins can be delegated. */ - max_tokens?: CoinSDKType; + max_tokens?: CoinAmino; /** * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's * account. */ - - allow_list?: StakeAuthorization_ValidatorsSDKType; + allow_list?: StakeAuthorization_ValidatorsAmino; /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ - - deny_list?: StakeAuthorization_ValidatorsSDKType; + deny_list?: StakeAuthorization_ValidatorsAmino; /** authorization_type defines one of AuthorizationType. */ - - authorization_type: AuthorizationTypeSDKType; + authorization_type?: AuthorizationType; +} +export interface StakeAuthorizationAminoMsg { + type: "cosmos-sdk/StakeAuthorization"; + value: StakeAuthorizationAmino; +} +/** + * StakeAuthorization defines authorization for delegate/undelegate/redelegate. + * + * Since: cosmos-sdk 0.43 + */ +export interface StakeAuthorizationSDKType { + max_tokens?: CoinSDKType; + allow_list?: StakeAuthorization_ValidatorsSDKType; + deny_list?: StakeAuthorization_ValidatorsSDKType; + authorization_type: AuthorizationType; } /** Validators defines list of validator addresses. */ - export interface StakeAuthorization_Validators { address: string[]; } +export interface StakeAuthorization_ValidatorsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Validators"; + value: Uint8Array; +} +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_ValidatorsAmino { + address?: string[]; +} +export interface StakeAuthorization_ValidatorsAminoMsg { + type: "cosmos-sdk/Validators"; + value: StakeAuthorization_ValidatorsAmino; +} /** Validators defines list of validator addresses. */ - export interface StakeAuthorization_ValidatorsSDKType { address: string[]; } - function createBaseStakeAuthorization(): StakeAuthorization { return { maxTokens: undefined, @@ -153,114 +142,171 @@ function createBaseStakeAuthorization(): StakeAuthorization { authorizationType: 0 }; } - export const StakeAuthorization = { - encode(message: StakeAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", + encode(message: StakeAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxTokens !== undefined) { Coin.encode(message.maxTokens, writer.uint32(10).fork()).ldelim(); } - if (message.allowList !== undefined) { StakeAuthorization_Validators.encode(message.allowList, writer.uint32(18).fork()).ldelim(); } - if (message.denyList !== undefined) { StakeAuthorization_Validators.encode(message.denyList, writer.uint32(26).fork()).ldelim(); } - if (message.authorizationType !== 0) { writer.uint32(32).int32(message.authorizationType); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StakeAuthorization { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.maxTokens = Coin.decode(reader, reader.uint32()); break; - case 2: message.allowList = StakeAuthorization_Validators.decode(reader, reader.uint32()); break; - case 3: message.denyList = StakeAuthorization_Validators.decode(reader, reader.uint32()); break; - case 4: message.authorizationType = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): StakeAuthorization { + fromPartial(object: Partial): 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; + }, + fromAmino(object: StakeAuthorizationAmino): StakeAuthorization { + const message = createBaseStakeAuthorization(); + if (object.max_tokens !== undefined && object.max_tokens !== null) { + message.maxTokens = Coin.fromAmino(object.max_tokens); + } + if (object.allow_list !== undefined && object.allow_list !== null) { + message.allowList = StakeAuthorization_Validators.fromAmino(object.allow_list); + } + if (object.deny_list !== undefined && object.deny_list !== null) { + message.denyList = StakeAuthorization_Validators.fromAmino(object.deny_list); + } + if (object.authorization_type !== undefined && object.authorization_type !== null) { + message.authorizationType = authorizationTypeFromJSON(object.authorization_type); + } + return message; + }, + toAmino(message: StakeAuthorization): StakeAuthorizationAmino { + const obj: any = {}; + obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; + obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; + obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; + obj.authorization_type = authorizationTypeToJSON(message.authorizationType); + return obj; + }, + fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { + return StakeAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: StakeAuthorization): StakeAuthorizationAminoMsg { + return { + type: "cosmos-sdk/StakeAuthorization", + value: StakeAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: StakeAuthorizationProtoMsg): StakeAuthorization { + return StakeAuthorization.decode(message.value); + }, + toProto(message: StakeAuthorization): Uint8Array { + return StakeAuthorization.encode(message).finish(); + }, + toProtoMsg(message: StakeAuthorization): StakeAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", + value: StakeAuthorization.encode(message).finish() + }; } - }; - function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { return { address: [] }; } - export const StakeAuthorization_Validators = { - encode(message: StakeAuthorization_Validators, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.Validators", + encode(message: StakeAuthorization_Validators, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.address) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StakeAuthorization_Validators { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): StakeAuthorization_Validators { + fromPartial(object: Partial): StakeAuthorization_Validators { + const message = createBaseStakeAuthorization_Validators(); + message.address = object.address?.map(e => e) || []; + return message; + }, + fromAmino(object: StakeAuthorization_ValidatorsAmino): StakeAuthorization_Validators { const message = createBaseStakeAuthorization_Validators(); message.address = object.address?.map(e => e) || []; return message; + }, + toAmino(message: StakeAuthorization_Validators): StakeAuthorization_ValidatorsAmino { + const obj: any = {}; + if (message.address) { + obj.address = message.address.map(e => e); + } else { + obj.address = []; + } + return obj; + }, + fromAminoMsg(object: StakeAuthorization_ValidatorsAminoMsg): StakeAuthorization_Validators { + return StakeAuthorization_Validators.fromAmino(object.value); + }, + toAminoMsg(message: StakeAuthorization_Validators): StakeAuthorization_ValidatorsAminoMsg { + return { + type: "cosmos-sdk/Validators", + value: StakeAuthorization_Validators.toAmino(message) + }; + }, + fromProtoMsg(message: StakeAuthorization_ValidatorsProtoMsg): StakeAuthorization_Validators { + return StakeAuthorization_Validators.decode(message.value); + }, + toProto(message: StakeAuthorization_Validators): Uint8Array { + return StakeAuthorization_Validators.encode(message).finish(); + }, + toProtoMsg(message: StakeAuthorization_Validators): StakeAuthorization_ValidatorsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Validators", + value: StakeAuthorization_Validators.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/genesis.ts b/src/codegen/cosmos/staking/v1beta1/genesis.ts index ce9cf3b..8dccf42 100644 --- a/src/codegen/cosmos/staking/v1beta1/genesis.ts +++ b/src/codegen/cosmos/staking/v1beta1/genesis.ts @@ -1,90 +1,103 @@ -import { Params, ParamsSDKType, Validator, ValidatorSDKType, Delegation, DelegationSDKType, UnbondingDelegation, UnbondingDelegationSDKType, Redelegation, RedelegationSDKType } from "./staking"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Params, ParamsAmino, ParamsSDKType, Validator, ValidatorAmino, ValidatorSDKType, Delegation, DelegationAmino, DelegationSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, Redelegation, RedelegationAmino, RedelegationSDKType } from "./staking"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** GenesisState defines the staking module's genesis state. */ - export interface GenesisState { /** params defines all the paramaters of related to deposit. */ - params?: Params; + params: Params; /** * 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[]; /** delegations defines the validator set at genesis. */ - validators: Validator[]; /** delegations defines the delegations active at genesis. */ - delegations: Delegation[]; /** unbonding_delegations defines the unbonding delegations active at genesis. */ - unbondingDelegations: UnbondingDelegation[]; /** redelegations defines the redelegations active at genesis. */ - redelegations: Redelegation[]; exported: boolean; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.GenesisState"; + value: Uint8Array; +} /** GenesisState defines the staking module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** params defines all the paramaters of related to deposit. */ - params?: ParamsSDKType; + params?: ParamsAmino; /** * last_total_power tracks the total amounts of bonded tokens recorded during * the previous end block. */ - - last_total_power: Uint8Array; + last_total_power?: string; /** * last_validator_powers is a special index that provides a historical list * of the last-block's bonded validators. */ - - last_validator_powers: LastValidatorPowerSDKType[]; + last_validator_powers?: LastValidatorPowerAmino[]; /** delegations defines the validator set at genesis. */ - - validators: ValidatorSDKType[]; + validators?: ValidatorAmino[]; /** delegations defines the delegations active at genesis. */ - - delegations: DelegationSDKType[]; + delegations?: DelegationAmino[]; /** unbonding_delegations defines the unbonding delegations active at genesis. */ - - unbonding_delegations: UnbondingDelegationSDKType[]; + unbonding_delegations?: UnbondingDelegationAmino[]; /** redelegations defines the redelegations active at genesis. */ - + redelegations?: RedelegationAmino[]; + exported?: boolean; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the staking module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + last_total_power: Uint8Array; + last_validator_powers: LastValidatorPowerSDKType[]; + validators: ValidatorSDKType[]; + delegations: DelegationSDKType[]; + unbonding_delegations: UnbondingDelegationSDKType[]; redelegations: RedelegationSDKType[]; 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: Long; + power: bigint; +} +export interface LastValidatorPowerProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower"; + value: Uint8Array; } /** LastValidatorPower required for validator set update logic. */ - -export interface LastValidatorPowerSDKType { +export interface LastValidatorPowerAmino { /** address is the address of the validator. */ - address: string; + address?: string; /** power defines the power of the validator. */ - - power: Long; + power?: string; +} +export interface LastValidatorPowerAminoMsg { + type: "cosmos-sdk/LastValidatorPower"; + value: LastValidatorPowerAmino; +} +/** LastValidatorPower required for validator set update logic. */ +export interface LastValidatorPowerSDKType { + address: string; + power: bigint; } - function createBaseGenesisState(): GenesisState { return { - params: undefined, + params: Params.fromPartial({}), lastTotalPower: new Uint8Array(), lastValidatorPowers: [], validators: [], @@ -94,95 +107,74 @@ function createBaseGenesisState(): GenesisState { exported: false }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - if (message.lastTotalPower.length !== 0) { writer.uint32(18).bytes(message.lastTotalPower); } - for (const v of message.lastValidatorPowers) { LastValidatorPower.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.validators) { Validator.encode(v!, writer.uint32(34).fork()).ldelim(); } - for (const v of message.delegations) { Delegation.encode(v!, writer.uint32(42).fork()).ldelim(); } - for (const v of message.unbondingDelegations) { UnbondingDelegation.encode(v!, writer.uint32(50).fork()).ldelim(); } - for (const v of message.redelegations) { Redelegation.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.exported === true) { writer.uint32(64).bool(message.exported); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.params = Params.decode(reader, reader.uint32()); break; - case 2: message.lastTotalPower = reader.bytes(); break; - case 3: message.lastValidatorPowers.push(LastValidatorPower.decode(reader, reader.uint32())); break; - case 4: message.validators.push(Validator.decode(reader, reader.uint32())); break; - case 5: message.delegations.push(Delegation.decode(reader, reader.uint32())); break; - case 6: message.unbondingDelegations.push(UnbondingDelegation.decode(reader, reader.uint32())); break; - case 7: message.redelegations.push(Redelegation.decode(reader, reader.uint32())); break; - case 8: message.exported = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(); @@ -193,61 +185,157 @@ export const GenesisState = { message.redelegations = object.redelegations?.map(e => Redelegation.fromPartial(e)) || []; message.exported = object.exported ?? false; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + if (object.last_total_power !== undefined && object.last_total_power !== null) { + message.lastTotalPower = bytesFromBase64(object.last_total_power); + } + message.lastValidatorPowers = object.last_validator_powers?.map(e => LastValidatorPower.fromAmino(e)) || []; + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + message.delegations = object.delegations?.map(e => Delegation.fromAmino(e)) || []; + message.unbondingDelegations = object.unbonding_delegations?.map(e => UnbondingDelegation.fromAmino(e)) || []; + message.redelegations = object.redelegations?.map(e => Redelegation.fromAmino(e)) || []; + if (object.exported !== undefined && object.exported !== null) { + message.exported = object.exported; + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.last_total_power = message.lastTotalPower ? base64FromBytes(message.lastTotalPower) : undefined; + if (message.lastValidatorPowers) { + obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e) : undefined); + } else { + obj.last_validator_powers = []; + } + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = []; + } + if (message.delegations) { + obj.delegations = message.delegations.map(e => e ? Delegation.toAmino(e) : undefined); + } else { + obj.delegations = []; + } + if (message.unbondingDelegations) { + obj.unbonding_delegations = message.unbondingDelegations.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); + } else { + obj.unbonding_delegations = []; + } + if (message.redelegations) { + obj.redelegations = message.redelegations.map(e => e ? Redelegation.toAmino(e) : undefined); + } else { + obj.redelegations = []; + } + obj.exported = message.exported; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; - function createBaseLastValidatorPower(): LastValidatorPower { return { address: "", - power: Long.ZERO + power: BigInt(0) }; } - export const LastValidatorPower = { - encode(message: LastValidatorPower, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", + encode(message: LastValidatorPower, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - - if (!message.power.isZero()) { + if (message.power !== BigInt(0)) { writer.uint32(16).int64(message.power); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): LastValidatorPower { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.address = reader.string(); break; - case 2: - message.power = (reader.int64() as Long); + message.power = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): LastValidatorPower { + fromPartial(object: Partial): LastValidatorPower { const message = createBaseLastValidatorPower(); message.address = object.address ?? ""; - message.power = object.power !== undefined && object.power !== null ? Long.fromValue(object.power) : Long.ZERO; + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); + return message; + }, + fromAmino(object: LastValidatorPowerAmino): LastValidatorPower { + const message = createBaseLastValidatorPower(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } return message; + }, + toAmino(message: LastValidatorPower): LastValidatorPowerAmino { + const obj: any = {}; + obj.address = message.address; + obj.power = message.power ? message.power.toString() : undefined; + return obj; + }, + fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { + return LastValidatorPower.fromAmino(object.value); + }, + toAminoMsg(message: LastValidatorPower): LastValidatorPowerAminoMsg { + return { + type: "cosmos-sdk/LastValidatorPower", + value: LastValidatorPower.toAmino(message) + }; + }, + fromProtoMsg(message: LastValidatorPowerProtoMsg): LastValidatorPower { + return LastValidatorPower.decode(message.value); + }, + toProto(message: LastValidatorPower): Uint8Array { + return LastValidatorPower.encode(message).finish(); + }, + toProtoMsg(message: LastValidatorPower): LastValidatorPowerProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", + value: LastValidatorPower.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/query.lcd.ts b/src/codegen/cosmos/staking/v1beta1/query.lcd.ts index 7507dc0..4ba0b02 100644 --- a/src/codegen/cosmos/staking/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/staking/v1beta1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryValidatorsRequest, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -26,174 +25,128 @@ export class LCDQueryClient { this.params = this.params.bind(this); } /* Validators queries all validators that match the given status. */ - - async validators(params: QueryValidatorsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.status !== "undefined") { options.params.status = params.status; } - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/staking/v1beta1/validators`; return await this.req.get(endpoint, options); } /* Validator queries validator info for given validator address. */ - - async validator(params: QueryValidatorRequest): Promise { const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}`; return await this.req.get(endpoint); } /* ValidatorDelegations queries delegate info for given validator. */ - - async validatorDelegations(params: QueryValidatorDelegationsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations`; return await this.req.get(endpoint, options); } /* ValidatorUnbondingDelegations queries unbonding delegations of a validator. */ - - async validatorUnbondingDelegations(params: QueryValidatorUnbondingDelegationsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/unbonding_delegations`; return await this.req.get(endpoint, options); } /* Delegation queries delegate info for given validator delegator pair. */ - - async delegation(params: QueryDelegationRequest): Promise { - const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}delegations/${params.delegatorAddr}`; + const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations/${params.delegatorAddr}`; return await this.req.get(endpoint); } /* UnbondingDelegation queries unbonding info for given validator delegator pair. */ - - async unbondingDelegation(params: QueryUnbondingDelegationRequest): Promise { const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations/${params.delegatorAddr}/unbonding_delegation`; return await this.req.get(endpoint); } /* DelegatorDelegations queries all delegations of a given delegator address. */ - - async delegatorDelegations(params: QueryDelegatorDelegationsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/staking/v1beta1/delegations/${params.delegatorAddr}`; return await this.req.get(endpoint, options); } /* DelegatorUnbondingDelegations queries all unbonding delegations of a given delegator address. */ - - async delegatorUnbondingDelegations(params: QueryDelegatorUnbondingDelegationsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/unbonding_delegations`; return await this.req.get(endpoint, options); } /* Redelegations queries redelegations of given address. */ - - async redelegations(params: QueryRedelegationsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.srcValidatorAddr !== "undefined") { options.params.src_validator_addr = params.srcValidatorAddr; } - if (typeof params?.dstValidatorAddr !== "undefined") { options.params.dst_validator_addr = params.dstValidatorAddr; } - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/redelegations`; return await this.req.get(endpoint, options); } /* DelegatorValidators queries all validators info for given delegator address. */ - - async delegatorValidators(params: QueryDelegatorValidatorsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/validators`; return await this.req.get(endpoint, options); } /* DelegatorValidator queries validator info for given delegator validator pair. */ - - async delegatorValidator(params: QueryDelegatorValidatorRequest): Promise { - const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}validators/${params.validatorAddr}`; + const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/validators/${params.validatorAddr}`; return await this.req.get(endpoint); } /* HistoricalInfo queries the historical info for given height. */ - - async historicalInfo(params: QueryHistoricalInfoRequest): Promise { const endpoint = `cosmos/staking/v1beta1/historical_info/${params.height}`; return await this.req.get(endpoint); } /* Pool queries the pool info. */ - - async pool(_params: QueryPoolRequest = {}): Promise { const endpoint = `cosmos/staking/v1beta1/pool`; return await this.req.get(endpoint); } /* Parameters queries the staking parameters. */ - - async params(_params: QueryParamsRequest = {}): Promise { const endpoint = `cosmos/staking/v1beta1/params`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/staking/v1beta1/query.rpc.Query.ts index 550f592..1a204ce 100644 --- a/src/codegen/cosmos/staking/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/staking/v1beta1/query.rpc.Query.ts @@ -1,67 +1,52 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryValidatorsRequest, QueryValidatorsResponse, QueryValidatorRequest, QueryValidatorResponse, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponse, QueryDelegationRequest, QueryDelegationResponse, QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponse, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponse, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse, QueryRedelegationsRequest, QueryRedelegationsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponse, QueryHistoricalInfoRequest, QueryHistoricalInfoResponse, QueryPoolRequest, QueryPoolResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** Validators queries all validators that match the given status. */ validators(request: QueryValidatorsRequest): Promise; /** Validator queries validator info for given validator address. */ - validator(request: QueryValidatorRequest): Promise; /** ValidatorDelegations queries delegate info for given validator. */ - validatorDelegations(request: QueryValidatorDelegationsRequest): Promise; /** ValidatorUnbondingDelegations queries unbonding delegations of a validator. */ - validatorUnbondingDelegations(request: QueryValidatorUnbondingDelegationsRequest): Promise; /** Delegation queries delegate info for given validator delegator pair. */ - delegation(request: QueryDelegationRequest): Promise; /** * UnbondingDelegation queries unbonding info for given validator delegator * pair. */ - unbondingDelegation(request: QueryUnbondingDelegationRequest): Promise; /** DelegatorDelegations queries all delegations of a given delegator address. */ - delegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; /** * DelegatorUnbondingDelegations queries all unbonding delegations of a given * delegator address. */ - delegatorUnbondingDelegations(request: QueryDelegatorUnbondingDelegationsRequest): Promise; /** Redelegations queries redelegations of given address. */ - redelegations(request: QueryRedelegationsRequest): Promise; /** * DelegatorValidators queries all validators info for given delegator * address. */ - delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; /** * DelegatorValidator queries validator info for given delegator validator * pair. */ - delegatorValidator(request: QueryDelegatorValidatorRequest): Promise; /** HistoricalInfo queries the historical info for given height. */ - historicalInfo(request: QueryHistoricalInfoRequest): Promise; /** Pool queries the pool info. */ - pool(request?: QueryPoolRequest): Promise; /** Parameters queries the staking parameters. */ - params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.validators = this.validators.bind(this); @@ -79,91 +64,76 @@ export class QueryClientImpl implements Query { 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("cosmos.staking.v1beta1.Query", "Validators", data); - return promise.then(data => QueryValidatorsResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "Validator", data); - return promise.then(data => QueryValidatorResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "ValidatorDelegations", data); - return promise.then(data => QueryValidatorDelegationsResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "ValidatorUnbondingDelegations", data); - return promise.then(data => QueryValidatorUnbondingDelegationsResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "Delegation", data); - return promise.then(data => QueryDelegationResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "UnbondingDelegation", data); - return promise.then(data => QueryUnbondingDelegationResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "DelegatorDelegations", data); - return promise.then(data => QueryDelegatorDelegationsResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "DelegatorUnbondingDelegations", data); - return promise.then(data => QueryDelegatorUnbondingDelegationsResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "Redelegations", data); - return promise.then(data => QueryRedelegationsResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "DelegatorValidators", data); - return promise.then(data => QueryDelegatorValidatorsResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "DelegatorValidator", data); - return promise.then(data => QueryDelegatorValidatorResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "HistoricalInfo", data); - return promise.then(data => QueryHistoricalInfoResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "Pool", data); - return promise.then(data => QueryPoolResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -172,58 +142,44 @@ export const createRpcQueryExtension = (base: QueryClient) => { validators(request: QueryValidatorsRequest): Promise { return queryService.validators(request); }, - validator(request: QueryValidatorRequest): Promise { return queryService.validator(request); }, - validatorDelegations(request: QueryValidatorDelegationsRequest): Promise { return queryService.validatorDelegations(request); }, - validatorUnbondingDelegations(request: QueryValidatorUnbondingDelegationsRequest): Promise { return queryService.validatorUnbondingDelegations(request); }, - delegation(request: QueryDelegationRequest): Promise { return queryService.delegation(request); }, - unbondingDelegation(request: QueryUnbondingDelegationRequest): Promise { return queryService.unbondingDelegation(request); }, - delegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise { return queryService.delegatorDelegations(request); }, - delegatorUnbondingDelegations(request: QueryDelegatorUnbondingDelegationsRequest): Promise { return queryService.delegatorUnbondingDelegations(request); }, - redelegations(request: QueryRedelegationsRequest): Promise { return queryService.redelegations(request); }, - delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise { return queryService.delegatorValidators(request); }, - delegatorValidator(request: QueryDelegatorValidatorRequest): Promise { return queryService.delegatorValidator(request); }, - historicalInfo(request: QueryHistoricalInfoRequest): Promise { return queryService.historicalInfo(request); }, - pool(request?: QueryPoolRequest): Promise { return queryService.pool(request); }, - params(request?: QueryParamsRequest): Promise { return queryService.params(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/query.ts b/src/codegen/cosmos/staking/v1beta1/query.ts index da6ed4d..3df897c 100644 --- a/src/codegen/cosmos/staking/v1beta1/query.ts +++ b/src/codegen/cosmos/staking/v1beta1/query.ts @@ -1,1386 +1,2113 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Validator, ValidatorAmino, ValidatorSDKType, DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseAmino, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoAmino, HistoricalInfoSDKType, Pool, PoolAmino, PoolSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ - export interface QueryValidatorsRequest { /** status enables to query for validators matching a given status. */ status: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryValidatorsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest"; + value: Uint8Array; +} /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ - -export interface QueryValidatorsRequestSDKType { +export interface QueryValidatorsRequestAmino { /** status enables to query for validators matching a given status. */ - status: string; + status?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryValidatorsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorsRequest"; + value: QueryValidatorsRequestAmino; +} +/** QueryValidatorsRequest is request type for Query/Validators RPC method. */ +export interface QueryValidatorsRequestSDKType { + status: string; pagination?: PageRequestSDKType; } /** QueryValidatorsResponse is response type for the Query/Validators RPC method */ - export interface QueryValidatorsResponse { /** validators contains all the queried validators. */ validators: Validator[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryValidatorsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse"; + value: Uint8Array; +} /** QueryValidatorsResponse is response type for the Query/Validators RPC method */ - -export interface QueryValidatorsResponseSDKType { +export interface QueryValidatorsResponseAmino { /** validators contains all the queried validators. */ - validators: ValidatorSDKType[]; + validators?: ValidatorAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryValidatorsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorsResponse"; + value: QueryValidatorsResponseAmino; +} +/** QueryValidatorsResponse is response type for the Query/Validators RPC method */ +export interface QueryValidatorsResponseSDKType { + validators: ValidatorSDKType[]; pagination?: PageResponseSDKType; } /** QueryValidatorRequest is response type for the Query/Validator RPC method */ - export interface QueryValidatorRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } +export interface QueryValidatorRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest"; + value: Uint8Array; +} /** QueryValidatorRequest is response type for the Query/Validator RPC method */ - -export interface QueryValidatorRequestSDKType { +export interface QueryValidatorRequestAmino { /** validator_addr defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryValidatorRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorRequest"; + value: QueryValidatorRequestAmino; +} +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequestSDKType { validator_addr: string; } /** QueryValidatorResponse is response type for the Query/Validator RPC method */ - export interface QueryValidatorResponse { /** validator defines the the validator info. */ - validator?: Validator; + validator: Validator; +} +export interface QueryValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse"; + value: Uint8Array; } /** QueryValidatorResponse is response type for the Query/Validator RPC method */ - -export interface QueryValidatorResponseSDKType { +export interface QueryValidatorResponseAmino { /** validator defines the the validator info. */ - validator?: ValidatorSDKType; + validator?: ValidatorAmino; +} +export interface QueryValidatorResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorResponse"; + value: QueryValidatorResponseAmino; +} +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponseSDKType { + validator: ValidatorSDKType; } /** * QueryValidatorDelegationsRequest is request type for the * Query/ValidatorDelegations RPC method */ - export interface QueryValidatorDelegationsRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryValidatorDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest"; + value: Uint8Array; +} /** * QueryValidatorDelegationsRequest is request type for the * Query/ValidatorDelegations RPC method */ - -export interface QueryValidatorDelegationsRequestSDKType { +export interface QueryValidatorDelegationsRequestAmino { /** validator_addr defines the validator address to query for. */ - validator_addr: string; + validator_addr?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryValidatorDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorDelegationsRequest"; + value: QueryValidatorDelegationsRequestAmino; +} +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequestSDKType { + validator_addr: string; pagination?: PageRequestSDKType; } /** * QueryValidatorDelegationsResponse is response type for the * Query/ValidatorDelegations RPC method */ - export interface QueryValidatorDelegationsResponse { delegationResponses: DelegationResponse[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryValidatorDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponseAmino { + delegation_responses?: DelegationResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorDelegationsResponse"; + value: QueryValidatorDelegationsResponseAmino; +} /** * QueryValidatorDelegationsResponse is response type for the * Query/ValidatorDelegations RPC method */ - export interface QueryValidatorDelegationsResponseSDKType { delegation_responses: DelegationResponseSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } /** * QueryValidatorUnbondingDelegationsRequest is required type for the * Query/ValidatorUnbondingDelegations RPC method */ - export interface QueryValidatorUnbondingDelegationsRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryValidatorUnbondingDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest"; + value: Uint8Array; +} /** * QueryValidatorUnbondingDelegationsRequest is required type for the * Query/ValidatorUnbondingDelegations RPC method */ - -export interface QueryValidatorUnbondingDelegationsRequestSDKType { +export interface QueryValidatorUnbondingDelegationsRequestAmino { /** validator_addr defines the validator address to query for. */ - validator_addr: string; + validator_addr?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryValidatorUnbondingDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest"; + value: QueryValidatorUnbondingDelegationsRequestAmino; +} +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequestSDKType { + validator_addr: string; pagination?: PageRequestSDKType; } /** * QueryValidatorUnbondingDelegationsResponse is response type for the * Query/ValidatorUnbondingDelegations RPC method. */ - export interface QueryValidatorUnbondingDelegationsResponse { unbondingResponses: UnbondingDelegation[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryValidatorUnbondingDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponseAmino { + unbonding_responses?: UnbondingDelegationAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorUnbondingDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse"; + value: QueryValidatorUnbondingDelegationsResponseAmino; +} /** * QueryValidatorUnbondingDelegationsResponse is response type for the * Query/ValidatorUnbondingDelegations RPC method. */ - export interface QueryValidatorUnbondingDelegationsResponseSDKType { unbonding_responses: UnbondingDelegationSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } /** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ - export interface QueryDelegationRequest { /** delegator_addr defines the delegator address to query for. */ delegatorAddr: string; /** validator_addr defines the validator address to query for. */ - validatorAddr: string; } +export interface QueryDelegationRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest"; + value: Uint8Array; +} /** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ - -export interface QueryDelegationRequestSDKType { +export interface QueryDelegationRequestAmino { /** delegator_addr defines the delegator address to query for. */ - delegator_addr: string; + delegator_addr?: string; /** validator_addr defines the validator address to query for. */ - + validator_addr?: string; +} +export interface QueryDelegationRequestAminoMsg { + type: "cosmos-sdk/QueryDelegationRequest"; + value: QueryDelegationRequestAmino; +} +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequestSDKType { + delegator_addr: string; validator_addr: string; } /** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ - export interface QueryDelegationResponse { /** delegation_responses defines the delegation info of a delegation. */ delegationResponse?: DelegationResponse; } +export interface QueryDelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse"; + value: Uint8Array; +} /** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ - -export interface QueryDelegationResponseSDKType { +export interface QueryDelegationResponseAmino { /** delegation_responses defines the delegation info of a delegation. */ + delegation_response?: DelegationResponseAmino; +} +export interface QueryDelegationResponseAminoMsg { + type: "cosmos-sdk/QueryDelegationResponse"; + value: QueryDelegationResponseAmino; +} +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponseSDKType { delegation_response?: DelegationResponseSDKType; } /** * QueryUnbondingDelegationRequest is request type for the * Query/UnbondingDelegation RPC method. */ - export interface QueryUnbondingDelegationRequest { /** delegator_addr defines the delegator address to query for. */ delegatorAddr: string; /** validator_addr defines the validator address to query for. */ - validatorAddr: string; } +export interface QueryUnbondingDelegationRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest"; + value: Uint8Array; +} /** * QueryUnbondingDelegationRequest is request type for the * Query/UnbondingDelegation RPC method. */ - -export interface QueryUnbondingDelegationRequestSDKType { +export interface QueryUnbondingDelegationRequestAmino { /** delegator_addr defines the delegator address to query for. */ - delegator_addr: string; + delegator_addr?: string; /** validator_addr defines the validator address to query for. */ - + validator_addr?: string; +} +export interface QueryUnbondingDelegationRequestAminoMsg { + type: "cosmos-sdk/QueryUnbondingDelegationRequest"; + value: QueryUnbondingDelegationRequestAmino; +} +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequestSDKType { + delegator_addr: string; validator_addr: string; } /** * QueryDelegationResponse is response type for the Query/UnbondingDelegation * RPC method. */ - export interface QueryUnbondingDelegationResponse { /** unbond defines the unbonding information of a delegation. */ - unbond?: UnbondingDelegation; + unbond: UnbondingDelegation; +} +export interface QueryUnbondingDelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse"; + value: Uint8Array; } /** * QueryDelegationResponse is response type for the Query/UnbondingDelegation * RPC method. */ - -export interface QueryUnbondingDelegationResponseSDKType { +export interface QueryUnbondingDelegationResponseAmino { /** unbond defines the unbonding information of a delegation. */ - unbond?: UnbondingDelegationSDKType; + unbond?: UnbondingDelegationAmino; +} +export interface QueryUnbondingDelegationResponseAminoMsg { + type: "cosmos-sdk/QueryUnbondingDelegationResponse"; + value: QueryUnbondingDelegationResponseAmino; +} +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponseSDKType { + unbond: UnbondingDelegationSDKType; } /** * QueryDelegatorDelegationsRequest is request type for the * Query/DelegatorDelegations RPC method. */ - export interface QueryDelegatorDelegationsRequest { /** delegator_addr defines the delegator address to query for. */ delegatorAddr: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryDelegatorDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest"; + value: Uint8Array; +} /** * QueryDelegatorDelegationsRequest is request type for the * Query/DelegatorDelegations RPC method. */ - -export interface QueryDelegatorDelegationsRequestSDKType { +export interface QueryDelegatorDelegationsRequestAmino { /** delegator_addr defines the delegator address to query for. */ - delegator_addr: string; + delegator_addr?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryDelegatorDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorDelegationsRequest"; + value: QueryDelegatorDelegationsRequestAmino; +} +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequestSDKType { + delegator_addr: string; pagination?: PageRequestSDKType; } /** * QueryDelegatorDelegationsResponse is response type for the * Query/DelegatorDelegations RPC method. */ - export interface QueryDelegatorDelegationsResponse { /** delegation_responses defines all the delegations' info of a delegator. */ delegationResponses: DelegationResponse[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryDelegatorDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse"; + value: Uint8Array; +} /** * QueryDelegatorDelegationsResponse is response type for the * Query/DelegatorDelegations RPC method. */ - -export interface QueryDelegatorDelegationsResponseSDKType { +export interface QueryDelegatorDelegationsResponseAmino { /** delegation_responses defines all the delegations' info of a delegator. */ - delegation_responses: DelegationResponseSDKType[]; + delegation_responses?: DelegationResponseAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryDelegatorDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorDelegationsResponse"; + value: QueryDelegatorDelegationsResponseAmino; +} +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponseSDKType { + delegation_responses: DelegationResponseSDKType[]; pagination?: PageResponseSDKType; } /** * QueryDelegatorUnbondingDelegationsRequest is request type for the * Query/DelegatorUnbondingDelegations RPC method. */ - export interface QueryDelegatorUnbondingDelegationsRequest { /** delegator_addr defines the delegator address to query for. */ delegatorAddr: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryDelegatorUnbondingDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest"; + value: Uint8Array; +} /** * QueryDelegatorUnbondingDelegationsRequest is request type for the * Query/DelegatorUnbondingDelegations RPC method. */ - -export interface QueryDelegatorUnbondingDelegationsRequestSDKType { +export interface QueryDelegatorUnbondingDelegationsRequestAmino { /** delegator_addr defines the delegator address to query for. */ - delegator_addr: string; + delegator_addr?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryDelegatorUnbondingDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest"; + value: QueryDelegatorUnbondingDelegationsRequestAmino; +} +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequestSDKType { + delegator_addr: string; pagination?: PageRequestSDKType; } /** * QueryUnbondingDelegatorDelegationsResponse is response type for the * Query/UnbondingDelegatorDelegations RPC method. */ - export interface QueryDelegatorUnbondingDelegationsResponse { unbondingResponses: UnbondingDelegation[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryDelegatorUnbondingDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponseAmino { + unbonding_responses?: UnbondingDelegationAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDelegatorUnbondingDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse"; + value: QueryDelegatorUnbondingDelegationsResponseAmino; +} /** * QueryUnbondingDelegatorDelegationsResponse is response type for the * Query/UnbondingDelegatorDelegations RPC method. */ - export interface QueryDelegatorUnbondingDelegationsResponseSDKType { unbonding_responses: UnbondingDelegationSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } /** * QueryRedelegationsRequest is request type for the Query/Redelegations RPC * method. */ - export interface QueryRedelegationsRequest { /** delegator_addr defines the delegator address to query for. */ delegatorAddr: string; /** src_validator_addr defines the validator address to redelegate from. */ - srcValidatorAddr: string; /** dst_validator_addr defines the validator address to redelegate to. */ - dstValidatorAddr: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryRedelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest"; + value: Uint8Array; +} /** * QueryRedelegationsRequest is request type for the Query/Redelegations RPC * method. */ - -export interface QueryRedelegationsRequestSDKType { +export interface QueryRedelegationsRequestAmino { /** delegator_addr defines the delegator address to query for. */ - delegator_addr: string; + delegator_addr?: string; /** src_validator_addr defines the validator address to redelegate from. */ - - src_validator_addr: string; + src_validator_addr?: string; /** dst_validator_addr defines the validator address to redelegate to. */ - - dst_validator_addr: string; + dst_validator_addr?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryRedelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryRedelegationsRequest"; + value: QueryRedelegationsRequestAmino; +} +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequestSDKType { + delegator_addr: string; + src_validator_addr: string; + dst_validator_addr: string; pagination?: PageRequestSDKType; } /** * QueryRedelegationsResponse is response type for the Query/Redelegations RPC * method. */ - export interface QueryRedelegationsResponse { redelegationResponses: RedelegationResponse[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryRedelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse"; + value: Uint8Array; +} +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponseAmino { + redelegation_responses?: RedelegationResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryRedelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryRedelegationsResponse"; + value: QueryRedelegationsResponseAmino; +} /** * QueryRedelegationsResponse is response type for the Query/Redelegations RPC * method. */ - export interface QueryRedelegationsResponseSDKType { redelegation_responses: RedelegationResponseSDKType[]; - /** pagination defines the pagination in the response. */ - pagination?: PageResponseSDKType; } /** * QueryDelegatorValidatorsRequest is request type for the * Query/DelegatorValidators RPC method. */ - export interface QueryDelegatorValidatorsRequest { /** delegator_addr defines the delegator address to query for. */ delegatorAddr: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; } +export interface QueryDelegatorValidatorsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest"; + value: Uint8Array; +} /** * QueryDelegatorValidatorsRequest is request type for the * Query/DelegatorValidators RPC method. */ - -export interface QueryDelegatorValidatorsRequestSDKType { +export interface QueryDelegatorValidatorsRequestAmino { /** delegator_addr defines the delegator address to query for. */ - delegator_addr: string; + delegator_addr?: string; /** pagination defines an optional pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface QueryDelegatorValidatorsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest"; + value: QueryDelegatorValidatorsRequestAmino; +} +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequestSDKType { + delegator_addr: string; pagination?: PageRequestSDKType; } /** * QueryDelegatorValidatorsResponse is response type for the * Query/DelegatorValidators RPC method. */ - export interface QueryDelegatorValidatorsResponse { /** validators defines the the validators' info of a delegator. */ validators: Validator[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryDelegatorValidatorsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse"; + value: Uint8Array; +} /** * QueryDelegatorValidatorsResponse is response type for the * Query/DelegatorValidators RPC method. */ - -export interface QueryDelegatorValidatorsResponseSDKType { +export interface QueryDelegatorValidatorsResponseAmino { /** validators defines the the validators' info of a delegator. */ - validators: ValidatorSDKType[]; + validators?: ValidatorAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryDelegatorValidatorsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse"; + value: QueryDelegatorValidatorsResponseAmino; +} +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponseSDKType { + validators: ValidatorSDKType[]; pagination?: PageResponseSDKType; } /** * QueryDelegatorValidatorRequest is request type for the * Query/DelegatorValidator RPC method. */ - export interface QueryDelegatorValidatorRequest { /** delegator_addr defines the delegator address to query for. */ delegatorAddr: string; /** validator_addr defines the validator address to query for. */ - validatorAddr: string; } +export interface QueryDelegatorValidatorRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest"; + value: Uint8Array; +} /** * QueryDelegatorValidatorRequest is request type for the * Query/DelegatorValidator RPC method. */ - -export interface QueryDelegatorValidatorRequestSDKType { +export interface QueryDelegatorValidatorRequestAmino { /** delegator_addr defines the delegator address to query for. */ - delegator_addr: string; + delegator_addr?: string; /** validator_addr defines the validator address to query for. */ - + validator_addr?: string; +} +export interface QueryDelegatorValidatorRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorRequest"; + value: QueryDelegatorValidatorRequestAmino; +} +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequestSDKType { + delegator_addr: string; validator_addr: string; } /** * QueryDelegatorValidatorResponse response type for the * Query/DelegatorValidator RPC method. */ - export interface QueryDelegatorValidatorResponse { /** validator defines the the validator info. */ - validator?: Validator; + validator: Validator; +} +export interface QueryDelegatorValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse"; + value: Uint8Array; } /** * QueryDelegatorValidatorResponse response type for the * Query/DelegatorValidator RPC method. */ - -export interface QueryDelegatorValidatorResponseSDKType { +export interface QueryDelegatorValidatorResponseAmino { /** validator defines the the validator info. */ - validator?: ValidatorSDKType; + validator?: ValidatorAmino; +} +export interface QueryDelegatorValidatorResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorResponse"; + value: QueryDelegatorValidatorResponseAmino; +} +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponseSDKType { + validator: ValidatorSDKType; } /** * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC * method. */ - export interface QueryHistoricalInfoRequest { /** height defines at which height to query the historical info. */ - height: Long; + height: bigint; +} +export interface QueryHistoricalInfoRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest"; + value: Uint8Array; } /** * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC * method. */ - -export interface QueryHistoricalInfoRequestSDKType { +export interface QueryHistoricalInfoRequestAmino { /** height defines at which height to query the historical info. */ - height: Long; + height?: string; +} +export interface QueryHistoricalInfoRequestAminoMsg { + type: "cosmos-sdk/QueryHistoricalInfoRequest"; + value: QueryHistoricalInfoRequestAmino; +} +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequestSDKType { + height: bigint; } /** * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC * method. */ - export interface QueryHistoricalInfoResponse { /** hist defines the historical info at the given height. */ hist?: HistoricalInfo; } +export interface QueryHistoricalInfoResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse"; + value: Uint8Array; +} /** * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC * method. */ - -export interface QueryHistoricalInfoResponseSDKType { +export interface QueryHistoricalInfoResponseAmino { /** hist defines the historical info at the given height. */ + hist?: HistoricalInfoAmino; +} +export interface QueryHistoricalInfoResponseAminoMsg { + type: "cosmos-sdk/QueryHistoricalInfoResponse"; + value: QueryHistoricalInfoResponseAmino; +} +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponseSDKType { hist?: HistoricalInfoSDKType; } /** QueryPoolRequest is request type for the Query/Pool RPC method. */ - export interface QueryPoolRequest {} +export interface QueryPoolRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest"; + value: Uint8Array; +} +/** QueryPoolRequest is request type for the Query/Pool RPC method. */ +export interface QueryPoolRequestAmino {} +export interface QueryPoolRequestAminoMsg { + type: "cosmos-sdk/QueryPoolRequest"; + value: QueryPoolRequestAmino; +} /** QueryPoolRequest is request type for the Query/Pool RPC method. */ - export interface QueryPoolRequestSDKType {} /** QueryPoolResponse is response type for the Query/Pool RPC method. */ - export interface QueryPoolResponse { /** pool defines the pool info. */ - pool?: Pool; + pool: Pool; +} +export interface QueryPoolResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse"; + value: Uint8Array; } /** QueryPoolResponse is response type for the Query/Pool RPC method. */ - -export interface QueryPoolResponseSDKType { +export interface QueryPoolResponseAmino { /** pool defines the pool info. */ - pool?: PoolSDKType; + pool?: PoolAmino; +} +export interface QueryPoolResponseAminoMsg { + type: "cosmos-sdk/QueryPoolResponse"; + value: QueryPoolResponseAmino; +} +/** QueryPoolResponse is response type for the Query/Pool RPC method. */ +export interface QueryPoolResponseSDKType { + pool: PoolSDKType; } /** QueryParamsRequest is request type for the Query/Params RPC method. */ - export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsRequest is request type for the Query/Params RPC method. */ - export interface QueryParamsRequestSDKType {} /** QueryParamsResponse is response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** params holds all the parameters of this module. */ - params?: Params; + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse"; + value: Uint8Array; } /** QueryParamsResponse is response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** params holds all the parameters of this module. */ - params?: ParamsSDKType; + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; } - function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { return { status: "", pagination: undefined }; } - export const QueryValidatorsRequest = { - encode(message: QueryValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", + encode(message: QueryValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.status !== "") { writer.uint32(10).string(message.status); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryValidatorsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.status = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorsRequest { + fromPartial(object: Partial): QueryValidatorsRequest { const message = createBaseQueryValidatorsRequest(); message.status = object.status ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryValidatorsRequestAmino): QueryValidatorsRequest { + const message = createBaseQueryValidatorsRequest(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { + const obj: any = {}; + obj.status = message.status; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorsRequestAminoMsg): QueryValidatorsRequest { + return QueryValidatorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorsRequest): QueryValidatorsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorsRequest", + value: QueryValidatorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorsRequestProtoMsg): QueryValidatorsRequest { + return QueryValidatorsRequest.decode(message.value); + }, + toProto(message: QueryValidatorsRequest): Uint8Array { + return QueryValidatorsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorsRequest): QueryValidatorsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", + value: QueryValidatorsRequest.encode(message).finish() + }; } - }; - function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { return { validators: [], pagination: undefined }; } - export const QueryValidatorsResponse = { - encode(message: QueryValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", + encode(message: QueryValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryValidatorsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validators.push(Validator.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorsResponse { + fromPartial(object: Partial): QueryValidatorsResponse { const message = createBaseQueryValidatorsResponse(); message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryValidatorsResponseAmino): QueryValidatorsResponse { + const message = createBaseQueryValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorsResponse): QueryValidatorsResponseAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorsResponseAminoMsg): QueryValidatorsResponse { + return QueryValidatorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorsResponse): QueryValidatorsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorsResponse", + value: QueryValidatorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorsResponseProtoMsg): QueryValidatorsResponse { + return QueryValidatorsResponse.decode(message.value); + }, + toProto(message: QueryValidatorsResponse): Uint8Array { + return QueryValidatorsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorsResponse): QueryValidatorsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", + value: QueryValidatorsResponse.encode(message).finish() + }; } - }; - function createBaseQueryValidatorRequest(): QueryValidatorRequest { return { validatorAddr: "" }; } - export const QueryValidatorRequest = { - encode(message: QueryValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", + encode(message: QueryValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryValidatorRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorRequest { + fromPartial(object: Partial): QueryValidatorRequest { const message = createBaseQueryValidatorRequest(); message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: QueryValidatorRequestAmino): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { + return QueryValidatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorRequest): QueryValidatorRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorRequest", + value: QueryValidatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorRequestProtoMsg): QueryValidatorRequest { + return QueryValidatorRequest.decode(message.value); + }, + toProto(message: QueryValidatorRequest): Uint8Array { + return QueryValidatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorRequest): QueryValidatorRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", + value: QueryValidatorRequest.encode(message).finish() + }; } - }; - function createBaseQueryValidatorResponse(): QueryValidatorResponse { return { - validator: undefined + validator: Validator.fromPartial({}) }; } - export const QueryValidatorResponse = { - encode(message: QueryValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", + encode(message: QueryValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryValidatorResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validator = Validator.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorResponse { + fromPartial(object: Partial): QueryValidatorResponse { const message = createBaseQueryValidatorResponse(); message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; return message; + }, + fromAmino(object: QueryValidatorResponseAmino): QueryValidatorResponse { + const message = createBaseQueryValidatorResponse(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + return message; + }, + toAmino(message: QueryValidatorResponse): QueryValidatorResponseAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorResponseAminoMsg): QueryValidatorResponse { + return QueryValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorResponse): QueryValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorResponse", + value: QueryValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorResponseProtoMsg): QueryValidatorResponse { + return QueryValidatorResponse.decode(message.value); + }, + toProto(message: QueryValidatorResponse): Uint8Array { + return QueryValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorResponse): QueryValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", + value: QueryValidatorResponse.encode(message).finish() + }; } - }; - function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest { return { validatorAddr: "", pagination: undefined }; } - export const QueryValidatorDelegationsRequest = { - encode(message: QueryValidatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryValidatorDelegationsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddr = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorDelegationsRequest { + fromPartial(object: Partial): QueryValidatorDelegationsRequest { const message = createBaseQueryValidatorDelegationsRequest(); message.validatorAddr = object.validatorAddr ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryValidatorDelegationsRequestAmino): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorDelegationsRequestAminoMsg): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDelegationsRequest", + value: QueryValidatorDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDelegationsRequestProtoMsg): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.decode(message.value); + }, + toProto(message: QueryValidatorDelegationsRequest): Uint8Array { + return QueryValidatorDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", + value: QueryValidatorDelegationsRequest.encode(message).finish() + }; } - }; - function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { return { delegationResponses: [], pagination: undefined }; } - export const QueryValidatorDelegationsResponse = { - encode(message: QueryValidatorDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.delegationResponses) { DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryValidatorDelegationsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorDelegationsResponse { + fromPartial(object: Partial): QueryValidatorDelegationsResponse { const message = createBaseQueryValidatorDelegationsResponse(); message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryValidatorDelegationsResponseAmino): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegation_responses?.map(e => DelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseAmino { + const obj: any = {}; + if (message.delegationResponses) { + obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); + } else { + obj.delegation_responses = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorDelegationsResponseAminoMsg): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDelegationsResponse", + value: QueryValidatorDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDelegationsResponseProtoMsg): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.decode(message.value); + }, + toProto(message: QueryValidatorDelegationsResponse): Uint8Array { + return QueryValidatorDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", + value: QueryValidatorDelegationsResponse.encode(message).finish() + }; } - }; - function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { return { validatorAddr: "", pagination: undefined }; } - export const QueryValidatorUnbondingDelegationsRequest = { - encode(message: QueryValidatorUnbondingDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryValidatorUnbondingDelegationsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddr = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorUnbondingDelegationsRequest { + fromPartial(object: Partial): QueryValidatorUnbondingDelegationsRequest { const message = createBaseQueryValidatorUnbondingDelegationsRequest(); message.validatorAddr = object.validatorAddr ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryValidatorUnbondingDelegationsRequestAmino): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorUnbondingDelegationsRequestAminoMsg): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest", + value: QueryValidatorUnbondingDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorUnbondingDelegationsRequestProtoMsg): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.decode(message.value); + }, + toProto(message: QueryValidatorUnbondingDelegationsRequest): Uint8Array { + return QueryValidatorUnbondingDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + value: QueryValidatorUnbondingDelegationsRequest.encode(message).finish() + }; } - }; - function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { return { unbondingResponses: [], pagination: undefined }; } - export const QueryValidatorUnbondingDelegationsResponse = { - encode(message: QueryValidatorUnbondingDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unbondingResponses) { UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryValidatorUnbondingDelegationsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryValidatorUnbondingDelegationsResponse { + fromPartial(object: Partial): QueryValidatorUnbondingDelegationsResponse { const message = createBaseQueryValidatorUnbondingDelegationsResponse(); message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryValidatorUnbondingDelegationsResponseAmino): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbonding_responses?.map(e => UnbondingDelegation.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseAmino { + const obj: any = {}; + if (message.unbondingResponses) { + obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); + } else { + obj.unbonding_responses = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorUnbondingDelegationsResponseAminoMsg): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse", + value: QueryValidatorUnbondingDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorUnbondingDelegationsResponseProtoMsg): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.decode(message.value); + }, + toProto(message: QueryValidatorUnbondingDelegationsResponse): Uint8Array { + return QueryValidatorUnbondingDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + value: QueryValidatorUnbondingDelegationsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegationRequest(): QueryDelegationRequest { return { delegatorAddr: "", validatorAddr: "" }; } - export const QueryDelegationRequest = { - encode(message: QueryDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", + encode(message: QueryDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== "") { writer.uint32(18).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegationRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddr = reader.string(); break; - case 2: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegationRequest { + fromPartial(object: Partial): QueryDelegationRequest { const message = createBaseQueryDelegationRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: QueryDelegationRequestAmino): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { + return QueryDelegationRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationRequest): QueryDelegationRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationRequest", + value: QueryDelegationRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationRequestProtoMsg): QueryDelegationRequest { + return QueryDelegationRequest.decode(message.value); + }, + toProto(message: QueryDelegationRequest): Uint8Array { + return QueryDelegationRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationRequest): QueryDelegationRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", + value: QueryDelegationRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegationResponse(): QueryDelegationResponse { return { delegationResponse: undefined }; } - export const QueryDelegationResponse = { - encode(message: QueryDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", + encode(message: QueryDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegationResponse !== undefined) { DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegationResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegationResponse = DelegationResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegationResponse { + fromPartial(object: Partial): QueryDelegationResponse { const message = createBaseQueryDelegationResponse(); message.delegationResponse = object.delegationResponse !== undefined && object.delegationResponse !== null ? DelegationResponse.fromPartial(object.delegationResponse) : undefined; return message; + }, + fromAmino(object: QueryDelegationResponseAmino): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + if (object.delegation_response !== undefined && object.delegation_response !== null) { + message.delegationResponse = DelegationResponse.fromAmino(object.delegation_response); + } + return message; + }, + toAmino(message: QueryDelegationResponse): QueryDelegationResponseAmino { + const obj: any = {}; + obj.delegation_response = message.delegationResponse ? DelegationResponse.toAmino(message.delegationResponse) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegationResponseAminoMsg): QueryDelegationResponse { + return QueryDelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationResponse): QueryDelegationResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationResponse", + value: QueryDelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationResponseProtoMsg): QueryDelegationResponse { + return QueryDelegationResponse.decode(message.value); + }, + toProto(message: QueryDelegationResponse): Uint8Array { + return QueryDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationResponse): QueryDelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", + value: QueryDelegationResponse.encode(message).finish() + }; } - }; - function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { return { delegatorAddr: "", validatorAddr: "" }; } - export const QueryUnbondingDelegationRequest = { - encode(message: QueryUnbondingDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== "") { writer.uint32(18).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUnbondingDelegationRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddr = reader.string(); break; - case 2: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUnbondingDelegationRequest { + fromPartial(object: Partial): QueryUnbondingDelegationRequest { const message = createBaseQueryUnbondingDelegationRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: QueryUnbondingDelegationRequestAmino): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUnbondingDelegationRequest", + value: QueryUnbondingDelegationRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnbondingDelegationRequestProtoMsg): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.decode(message.value); + }, + toProto(message: QueryUnbondingDelegationRequest): Uint8Array { + return QueryUnbondingDelegationRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", + value: QueryUnbondingDelegationRequest.encode(message).finish() + }; } - }; - function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { return { - unbond: undefined + unbond: UnbondingDelegation.fromPartial({}) }; } - export const QueryUnbondingDelegationResponse = { - encode(message: QueryUnbondingDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.unbond !== undefined) { UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUnbondingDelegationResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUnbondingDelegationResponse { + fromPartial(object: Partial): QueryUnbondingDelegationResponse { const message = createBaseQueryUnbondingDelegationResponse(); message.unbond = object.unbond !== undefined && object.unbond !== null ? UnbondingDelegation.fromPartial(object.unbond) : undefined; return message; + }, + fromAmino(object: QueryUnbondingDelegationResponseAmino): QueryUnbondingDelegationResponse { + const message = createBaseQueryUnbondingDelegationResponse(); + if (object.unbond !== undefined && object.unbond !== null) { + message.unbond = UnbondingDelegation.fromAmino(object.unbond); + } + return message; + }, + toAmino(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseAmino { + const obj: any = {}; + obj.unbond = message.unbond ? UnbondingDelegation.toAmino(message.unbond) : undefined; + return obj; + }, + fromAminoMsg(object: QueryUnbondingDelegationResponseAminoMsg): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUnbondingDelegationResponse", + value: QueryUnbondingDelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnbondingDelegationResponseProtoMsg): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.decode(message.value); + }, + toProto(message: QueryUnbondingDelegationResponse): Uint8Array { + return QueryUnbondingDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", + value: QueryUnbondingDelegationResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest { return { delegatorAddr: "", pagination: undefined }; } - export const QueryDelegatorDelegationsRequest = { - encode(message: QueryDelegatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorDelegationsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddr = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorDelegationsRequest { + fromPartial(object: Partial): QueryDelegatorDelegationsRequest { const message = createBaseQueryDelegatorDelegationsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDelegatorDelegationsRequestAmino): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorDelegationsRequestAminoMsg): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorDelegationsRequest", + value: QueryDelegatorDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorDelegationsRequestProtoMsg): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorDelegationsRequest): Uint8Array { + return QueryDelegatorDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", + value: QueryDelegatorDelegationsRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { return { delegationResponses: [], pagination: undefined }; } - export const QueryDelegatorDelegationsResponse = { - encode(message: QueryDelegatorDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.delegationResponses) { DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorDelegationsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorDelegationsResponse { + fromPartial(object: Partial): QueryDelegatorDelegationsResponse { const message = createBaseQueryDelegatorDelegationsResponse(); message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDelegatorDelegationsResponseAmino): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegation_responses?.map(e => DelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseAmino { + const obj: any = {}; + if (message.delegationResponses) { + obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); + } else { + obj.delegation_responses = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorDelegationsResponseAminoMsg): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorDelegationsResponse", + value: QueryDelegatorDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorDelegationsResponseProtoMsg): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorDelegationsResponse): Uint8Array { + return QueryDelegatorDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", + value: QueryDelegatorDelegationsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { return { delegatorAddr: "", pagination: undefined }; } - export const QueryDelegatorUnbondingDelegationsRequest = { - encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddr = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorUnbondingDelegationsRequest { + fromPartial(object: Partial): QueryDelegatorUnbondingDelegationsRequest { const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDelegatorUnbondingDelegationsRequestAmino): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorUnbondingDelegationsRequestAminoMsg): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest", + value: QueryDelegatorUnbondingDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorUnbondingDelegationsRequestProtoMsg): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorUnbondingDelegationsRequest): Uint8Array { + return QueryDelegatorUnbondingDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + value: QueryDelegatorUnbondingDelegationsRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { return { unbondingResponses: [], pagination: undefined }; } - export const QueryDelegatorUnbondingDelegationsResponse = { - encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unbondingResponses) { UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorUnbondingDelegationsResponse { + fromPartial(object: Partial): QueryDelegatorUnbondingDelegationsResponse { const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDelegatorUnbondingDelegationsResponseAmino): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbonding_responses?.map(e => UnbondingDelegation.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseAmino { + const obj: any = {}; + if (message.unbondingResponses) { + obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); + } else { + obj.unbonding_responses = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorUnbondingDelegationsResponseAminoMsg): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse", + value: QueryDelegatorUnbondingDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorUnbondingDelegationsResponseProtoMsg): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorUnbondingDelegationsResponse): Uint8Array { + return QueryDelegatorUnbondingDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + value: QueryDelegatorUnbondingDelegationsResponse.encode(message).finish() + }; } - }; - function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { return { delegatorAddr: "", @@ -1389,582 +2116,885 @@ function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { pagination: undefined }; } - export const QueryRedelegationsRequest = { - encode(message: QueryRedelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.srcValidatorAddr !== "") { writer.uint32(18).string(message.srcValidatorAddr); } - if (message.dstValidatorAddr !== "") { writer.uint32(26).string(message.dstValidatorAddr); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryRedelegationsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddr = reader.string(); break; - case 2: message.srcValidatorAddr = reader.string(); break; - case 3: message.dstValidatorAddr = reader.string(); break; - case 4: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryRedelegationsRequest { + fromPartial(object: Partial): QueryRedelegationsRequest { const message = createBaseQueryRedelegationsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; message.srcValidatorAddr = object.srcValidatorAddr ?? ""; message.dstValidatorAddr = object.dstValidatorAddr ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryRedelegationsRequestAmino): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.src_validator_addr !== undefined && object.src_validator_addr !== null) { + message.srcValidatorAddr = object.src_validator_addr; + } + if (object.dst_validator_addr !== undefined && object.dst_validator_addr !== null) { + message.dstValidatorAddr = object.dst_validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRedelegationsRequestAminoMsg): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryRedelegationsRequest): QueryRedelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryRedelegationsRequest", + value: QueryRedelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRedelegationsRequestProtoMsg): QueryRedelegationsRequest { + return QueryRedelegationsRequest.decode(message.value); + }, + toProto(message: QueryRedelegationsRequest): Uint8Array { + return QueryRedelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryRedelegationsRequest): QueryRedelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", + value: QueryRedelegationsRequest.encode(message).finish() + }; } - }; - function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { return { redelegationResponses: [], pagination: undefined }; } - export const QueryRedelegationsResponse = { - encode(message: QueryRedelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.redelegationResponses) { RedelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryRedelegationsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.redelegationResponses.push(RedelegationResponse.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryRedelegationsResponse { + fromPartial(object: Partial): QueryRedelegationsResponse { const message = createBaseQueryRedelegationsResponse(); message.redelegationResponses = object.redelegationResponses?.map(e => RedelegationResponse.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryRedelegationsResponseAmino): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegation_responses?.map(e => RedelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryRedelegationsResponse): QueryRedelegationsResponseAmino { + const obj: any = {}; + if (message.redelegationResponses) { + obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e) : undefined); + } else { + obj.redelegation_responses = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRedelegationsResponseAminoMsg): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryRedelegationsResponse): QueryRedelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryRedelegationsResponse", + value: QueryRedelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRedelegationsResponseProtoMsg): QueryRedelegationsResponse { + return QueryRedelegationsResponse.decode(message.value); + }, + toProto(message: QueryRedelegationsResponse): Uint8Array { + return QueryRedelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryRedelegationsResponse): QueryRedelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", + value: QueryRedelegationsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { return { delegatorAddr: "", pagination: undefined }; } - export const QueryDelegatorValidatorsRequest = { - encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorValidatorsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddr = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { + fromPartial(object: Partial): QueryDelegatorValidatorsRequest { const message = createBaseQueryDelegatorValidatorsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDelegatorValidatorsRequestAmino): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsRequestProtoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsRequest): Uint8Array { + return QueryDelegatorValidatorsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { return { validators: [], pagination: undefined }; } - export const QueryDelegatorValidatorsResponse = { - encode(message: QueryDelegatorValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorValidatorsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validators.push(Validator.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorValidatorsResponse { + fromPartial(object: Partial): QueryDelegatorValidatorsResponse { const message = createBaseQueryDelegatorValidatorsResponse(); message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDelegatorValidatorsResponseAmino): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsResponseAminoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsResponseProtoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsResponse): Uint8Array { + return QueryDelegatorValidatorsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest { return { delegatorAddr: "", validatorAddr: "" }; } - export const QueryDelegatorValidatorRequest = { - encode(message: QueryDelegatorValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== "") { writer.uint32(18).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorValidatorRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddr = reader.string(); break; - case 2: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorValidatorRequest { + fromPartial(object: Partial): QueryDelegatorValidatorRequest { const message = createBaseQueryDelegatorValidatorRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: QueryDelegatorValidatorRequestAmino): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorRequest", + value: QueryDelegatorValidatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorRequestProtoMsg): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorRequest): Uint8Array { + return QueryDelegatorValidatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", + value: QueryDelegatorValidatorRequest.encode(message).finish() + }; } - }; - function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { return { - validator: undefined + validator: Validator.fromPartial({}) }; } - export const QueryDelegatorValidatorResponse = { - encode(message: QueryDelegatorValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDelegatorValidatorResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validator = Validator.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDelegatorValidatorResponse { + fromPartial(object: Partial): QueryDelegatorValidatorResponse { const message = createBaseQueryDelegatorValidatorResponse(); message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; return message; + }, + fromAmino(object: QueryDelegatorValidatorResponseAmino): QueryDelegatorValidatorResponse { + const message = createBaseQueryDelegatorValidatorResponse(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorResponseAminoMsg): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorResponse", + value: QueryDelegatorValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorResponseProtoMsg): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorResponse): Uint8Array { + return QueryDelegatorValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", + value: QueryDelegatorValidatorResponse.encode(message).finish() + }; } - }; - function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { return { - height: Long.ZERO + height: BigInt(0) }; } - export const QueryHistoricalInfoRequest = { - encode(message: QueryHistoricalInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryHistoricalInfoRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryHistoricalInfoRequest { + fromPartial(object: Partial): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryHistoricalInfoRequestAmino): QueryHistoricalInfoRequest { const message = createBaseQueryHistoricalInfoRequest(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } return message; + }, + toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryHistoricalInfoRequest", + value: QueryHistoricalInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryHistoricalInfoRequestProtoMsg): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.decode(message.value); + }, + toProto(message: QueryHistoricalInfoRequest): Uint8Array { + return QueryHistoricalInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", + value: QueryHistoricalInfoRequest.encode(message).finish() + }; } - }; - function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { return { hist: undefined }; } - export const QueryHistoricalInfoResponse = { - encode(message: QueryHistoricalInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hist !== undefined) { HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryHistoricalInfoResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hist = HistoricalInfo.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryHistoricalInfoResponse { + fromPartial(object: Partial): QueryHistoricalInfoResponse { const message = createBaseQueryHistoricalInfoResponse(); message.hist = object.hist !== undefined && object.hist !== null ? HistoricalInfo.fromPartial(object.hist) : undefined; return message; + }, + fromAmino(object: QueryHistoricalInfoResponseAmino): QueryHistoricalInfoResponse { + const message = createBaseQueryHistoricalInfoResponse(); + if (object.hist !== undefined && object.hist !== null) { + message.hist = HistoricalInfo.fromAmino(object.hist); + } + return message; + }, + toAmino(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseAmino { + const obj: any = {}; + obj.hist = message.hist ? HistoricalInfo.toAmino(message.hist) : undefined; + return obj; + }, + fromAminoMsg(object: QueryHistoricalInfoResponseAminoMsg): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryHistoricalInfoResponse", + value: QueryHistoricalInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryHistoricalInfoResponseProtoMsg): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.decode(message.value); + }, + toProto(message: QueryHistoricalInfoResponse): Uint8Array { + return QueryHistoricalInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", + value: QueryHistoricalInfoResponse.encode(message).finish() + }; } - }; - function createBaseQueryPoolRequest(): QueryPoolRequest { return {}; } - export const QueryPoolRequest = { - encode(_: QueryPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", + encode(_: QueryPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPoolRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryPoolRequest { + fromPartial(_: Partial): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, + fromAmino(_: QueryPoolRequestAmino): QueryPoolRequest { const message = createBaseQueryPoolRequest(); return message; + }, + toAmino(_: QueryPoolRequest): QueryPoolRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { + return QueryPoolRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPoolRequest): QueryPoolRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPoolRequest", + value: QueryPoolRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPoolRequestProtoMsg): QueryPoolRequest { + return QueryPoolRequest.decode(message.value); + }, + toProto(message: QueryPoolRequest): Uint8Array { + return QueryPoolRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPoolRequest): QueryPoolRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", + value: QueryPoolRequest.encode(message).finish() + }; } - }; - function createBaseQueryPoolResponse(): QueryPoolResponse { return { - pool: undefined + pool: Pool.fromPartial({}) }; } - export const QueryPoolResponse = { - encode(message: QueryPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", + encode(message: QueryPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pool !== undefined) { Pool.encode(message.pool, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPoolResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pool = Pool.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPoolResponse { + fromPartial(object: Partial): QueryPoolResponse { const message = createBaseQueryPoolResponse(); message.pool = object.pool !== undefined && object.pool !== null ? Pool.fromPartial(object.pool) : undefined; return message; + }, + fromAmino(object: QueryPoolResponseAmino): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + if (object.pool !== undefined && object.pool !== null) { + message.pool = Pool.fromAmino(object.pool); + } + return message; + }, + toAmino(message: QueryPoolResponse): QueryPoolResponseAmino { + const obj: any = {}; + obj.pool = message.pool ? Pool.toAmino(message.pool) : undefined; + return obj; + }, + fromAminoMsg(object: QueryPoolResponseAminoMsg): QueryPoolResponse { + return QueryPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPoolResponse): QueryPoolResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPoolResponse", + value: QueryPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPoolResponseProtoMsg): QueryPoolResponse { + return QueryPoolResponse.decode(message.value); + }, + toProto(message: QueryPoolResponse): Uint8Array { + return QueryPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPoolResponse): QueryPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", + value: QueryPoolResponse.encode(message).finish() + }; } - }; - function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } - export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParamsRequest { + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + params: Params.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/staking.ts b/src/codegen/cosmos/staking/v1beta1/staking.ts index 8e94ccb..db2f222 100644 --- a/src/codegen/cosmos/staking/v1beta1/staking.ts +++ b/src/codegen/cosmos/staking/v1beta1/staking.ts @@ -1,60 +1,40 @@ -import { Header, HeaderSDKType } from "../../../tendermint/types/types"; +import { Header, HeaderAmino, HeaderSDKType } from "../../../tendermint/types/types"; import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, toTimestamp, fromTimestamp, Long } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; /** BondStatus is the status of a validator. */ - export enum BondStatus { /** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */ BOND_STATUS_UNSPECIFIED = 0, - /** BOND_STATUS_UNBONDED - UNBONDED defines a validator that is not bonded. */ BOND_STATUS_UNBONDED = 1, - /** BOND_STATUS_UNBONDING - UNBONDING defines a validator that is unbonding. */ BOND_STATUS_UNBONDING = 2, - - /** BOND_STATUS_BONDED - BONDED defines a validator that is bonded. */ - BOND_STATUS_BONDED = 3, - UNRECOGNIZED = -1, -} -/** BondStatus is the status of a validator. */ - -export enum BondStatusSDKType { - /** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */ - BOND_STATUS_UNSPECIFIED = 0, - - /** BOND_STATUS_UNBONDED - UNBONDED defines a validator that is not bonded. */ - BOND_STATUS_UNBONDED = 1, - - /** BOND_STATUS_UNBONDING - UNBONDING defines a validator that is unbonding. */ - BOND_STATUS_UNBONDING = 2, - /** BOND_STATUS_BONDED - BONDED defines a validator that is bonded. */ BOND_STATUS_BONDED = 3, UNRECOGNIZED = -1, } +export const BondStatusSDKType = BondStatus; +export const BondStatusAmino = BondStatus; export function bondStatusFromJSON(object: any): BondStatus { switch (object) { case 0: case "BOND_STATUS_UNSPECIFIED": return BondStatus.BOND_STATUS_UNSPECIFIED; - case 1: case "BOND_STATUS_UNBONDED": return BondStatus.BOND_STATUS_UNBONDED; - case 2: case "BOND_STATUS_UNBONDING": return BondStatus.BOND_STATUS_UNBONDING; - case 3: case "BOND_STATUS_BONDED": return BondStatus.BOND_STATUS_BONDED; - case -1: case "UNRECOGNIZED": default: @@ -65,16 +45,12 @@ 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"; @@ -86,104 +62,146 @@ export function bondStatusToJSON(object: BondStatus): string { * recent HistoricalInfo * (`n` is set by the staking module's `historical_entries` parameter). */ - export interface HistoricalInfo { - header?: Header; + header: Header; valset: Validator[]; } +export interface HistoricalInfoProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo"; + value: Uint8Array; +} +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfoAmino { + header?: HeaderAmino; + valset?: ValidatorAmino[]; +} +export interface HistoricalInfoAminoMsg { + type: "cosmos-sdk/HistoricalInfo"; + value: HistoricalInfoAmino; +} /** * 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 HistoricalInfoSDKType { - header?: HeaderSDKType; + header: HeaderSDKType; valset: ValidatorSDKType[]; } /** * CommissionRates defines the initial commission rates to be used for creating * a validator. */ - export interface CommissionRates { /** rate is the commission rate charged to delegators, as a fraction. */ rate: string; /** max_rate defines the maximum commission rate which validator can ever charge, as a fraction. */ - maxRate: string; /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ - maxChangeRate: string; } +export interface CommissionRatesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates"; + value: Uint8Array; +} /** * CommissionRates defines the initial commission rates to be used for creating * a validator. */ - -export interface CommissionRatesSDKType { +export interface CommissionRatesAmino { /** rate is the commission rate charged to delegators, as a fraction. */ - rate: string; + rate?: string; /** max_rate defines the maximum commission rate which validator can ever charge, as a fraction. */ - - max_rate: string; + max_rate?: string; /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ - + max_change_rate?: string; +} +export interface CommissionRatesAminoMsg { + type: "cosmos-sdk/CommissionRates"; + value: CommissionRatesAmino; +} +/** + * CommissionRates defines the initial commission rates to be used for creating + * a validator. + */ +export interface CommissionRatesSDKType { + rate: string; + max_rate: string; max_change_rate: string; } /** Commission defines commission parameters for a given validator. */ - export interface Commission { /** commission_rates defines the initial commission rates to be used for creating a validator. */ - commissionRates?: CommissionRates; + commissionRates: CommissionRates; /** update_time is the last time the commission rate was changed. */ - - updateTime?: Date; + updateTime: Date; +} +export interface CommissionProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Commission"; + value: Uint8Array; } /** Commission defines commission parameters for a given validator. */ - -export interface CommissionSDKType { +export interface CommissionAmino { /** commission_rates defines the initial commission rates to be used for creating a validator. */ - commission_rates?: CommissionRatesSDKType; + commission_rates?: CommissionRatesAmino; /** update_time is the last time the commission rate was changed. */ - - update_time?: Date; + update_time?: string; +} +export interface CommissionAminoMsg { + type: "cosmos-sdk/Commission"; + value: CommissionAmino; +} +/** Commission defines commission parameters for a given validator. */ +export interface CommissionSDKType { + commission_rates: CommissionRatesSDKType; + update_time: Date; } /** Description defines a validator description. */ - export interface Description { /** moniker defines a human-readable name for the validator. */ moniker: string; /** identity defines an optional identity signature (ex. UPort or Keybase). */ - identity: string; /** website defines an optional website link. */ - website: string; /** security_contact defines an optional email for security contact. */ - securityContact: string; /** details define other optional details. */ - details: string; } +export interface DescriptionProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Description"; + value: Uint8Array; +} /** Description defines a validator description. */ - -export interface DescriptionSDKType { +export interface DescriptionAmino { /** moniker defines a human-readable name for the validator. */ - moniker: string; + moniker?: string; /** identity defines an optional identity signature (ex. UPort or Keybase). */ - - identity: string; + identity?: string; /** website defines an optional website link. */ - - website: string; + website?: string; /** security_contact defines an optional email for security contact. */ - - security_contact: string; + security_contact?: string; /** details define other optional details. */ - + details?: string; +} +export interface DescriptionAminoMsg { + type: "cosmos-sdk/Description"; + value: DescriptionAmino; +} +/** Description defines a validator description. */ +export interface DescriptionSDKType { + moniker: string; + identity: string; + website: string; + security_contact: string; details: string; } /** @@ -196,41 +214,34 @@ export interface DescriptionSDKType { * 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; /** 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; + description: Description; /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ - - unbondingHeight: Long; + unbondingHeight: bigint; /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ - - unbondingTime?: Date; + unbondingTime: Date; /** commission defines the commission parameters. */ - - commission?: Commission; + commission: Commission; /** min_self_delegation is the validator's self declared minimum self delegation. */ - minSelfDelegation: string; } +export interface ValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Validator"; + value: Uint8Array; +} /** * Validator defines a validator, together with the total amount of the * Validator's bond shares and their exchange rate to coins. Slashing results in @@ -241,48 +252,74 @@ export interface Validator { * exchange rate. Voting power can be calculated as total bonded shares * multiplied by exchange rate. */ - -export interface ValidatorSDKType { +export interface ValidatorAmino { /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ - operator_address: string; + operator_address?: string; /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ - - consensus_pubkey?: AnySDKType; + consensus_pubkey?: AnyAmino; /** jailed defined whether the validator has been jailed from bonded status or not. */ - - jailed: boolean; + jailed?: boolean; /** status is the validator status (bonded/unbonding/unbonded). */ - - status: BondStatusSDKType; + status?: BondStatus; /** tokens define the delegated tokens (incl. self-delegation). */ - - tokens: string; + tokens?: string; /** delegator_shares defines total shares issued to a validator's delegators. */ - - delegator_shares: string; + delegator_shares?: string; /** description defines the description terms for the validator. */ - - description?: DescriptionSDKType; + description?: DescriptionAmino; /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ - - unbonding_height: Long; + unbonding_height?: string; /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ - - unbonding_time?: Date; + unbonding_time?: string; /** commission defines the commission parameters. */ - - commission?: CommissionSDKType; + commission?: CommissionAmino; /** min_self_delegation is the validator's self declared minimum self delegation. */ - + min_self_delegation?: string; +} +export interface ValidatorAminoMsg { + type: "cosmos-sdk/Validator"; + value: ValidatorAmino; +} +/** + * 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 ValidatorSDKType { + operator_address: string; + consensus_pubkey?: AnySDKType; + jailed: boolean; + status: BondStatus; + tokens: string; + delegator_shares: string; + description: DescriptionSDKType; + unbonding_height: bigint; + unbonding_time: Date; + commission: CommissionSDKType; min_self_delegation: string; } /** ValAddresses defines a repeated set of validator addresses. */ - export interface ValAddresses { addresses: string[]; } +export interface ValAddressesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses"; + value: Uint8Array; +} +/** ValAddresses defines a repeated set of validator addresses. */ +export interface ValAddressesAmino { + addresses?: string[]; +} +export interface ValAddressesAminoMsg { + type: "cosmos-sdk/ValAddresses"; + value: ValAddressesAmino; +} /** ValAddresses defines a repeated set of validator addresses. */ - export interface ValAddressesSDKType { addresses: string[]; } @@ -291,28 +328,53 @@ export interface ValAddressesSDKType { * It is intended to be used as a marshalable pointer. For example, a DVPair can * be used to construct the key to getting an UnbondingDelegation from state. */ - export interface DVPair { delegatorAddress: string; validatorAddress: string; } +export interface DVPairProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVPair"; + value: Uint8Array; +} +/** + * DVPair is struct that just has a delegator-validator pair with no other data. + * It is intended to be used as a marshalable pointer. For example, a DVPair can + * be used to construct the key to getting an UnbondingDelegation from state. + */ +export interface DVPairAmino { + delegator_address?: string; + validator_address?: string; +} +export interface DVPairAminoMsg { + type: "cosmos-sdk/DVPair"; + value: DVPairAmino; +} /** * 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 DVPairSDKType { delegator_address: string; validator_address: string; } /** DVPairs defines an array of DVPair objects. */ - export interface DVPairs { pairs: DVPair[]; } +export interface DVPairsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVPairs"; + value: Uint8Array; +} +/** DVPairs defines an array of DVPair objects. */ +export interface DVPairsAmino { + pairs?: DVPairAmino[]; +} +export interface DVPairsAminoMsg { + type: "cosmos-sdk/DVPairs"; + value: DVPairsAmino; +} /** DVPairs defines an array of DVPair objects. */ - export interface DVPairsSDKType { pairs: DVPairSDKType[]; } @@ -322,31 +384,58 @@ export interface DVPairsSDKType { * example, a DVVTriplet can be used to construct the key to getting a * Redelegation from state. */ - export interface DVVTriplet { delegatorAddress: string; validatorSrcAddress: string; validatorDstAddress: string; } +export interface DVVTripletProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet"; + value: Uint8Array; +} +/** + * DVVTriplet is struct that just has a delegator-validator-validator triplet + * with no other data. It is intended to be used as a marshalable pointer. For + * example, a DVVTriplet can be used to construct the key to getting a + * Redelegation from state. + */ +export interface DVVTripletAmino { + delegator_address?: string; + validator_src_address?: string; + validator_dst_address?: string; +} +export interface DVVTripletAminoMsg { + type: "cosmos-sdk/DVVTriplet"; + value: DVVTripletAmino; +} /** * 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 DVVTripletSDKType { delegator_address: string; validator_src_address: string; validator_dst_address: string; } /** DVVTriplets defines an array of DVVTriplet objects. */ - export interface DVVTriplets { triplets: DVVTriplet[]; } +export interface DVVTripletsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets"; + value: Uint8Array; +} +/** DVVTriplets defines an array of DVVTriplet objects. */ +export interface DVVTripletsAmino { + triplets?: DVVTripletAmino[]; +} +export interface DVVTripletsAminoMsg { + type: "cosmos-sdk/DVVTriplets"; + value: DVVTripletsAmino; +} /** DVVTriplets defines an array of DVVTriplet objects. */ - export interface DVVTripletsSDKType { triplets: DVVTripletSDKType[]; } @@ -355,237 +444,318 @@ export interface DVVTripletsSDKType { * owned by one delegator, and is associated with the voting power of one * validator. */ - export interface Delegation { /** delegator_address is the bech32-encoded address of the delegator. */ delegatorAddress: string; /** validator_address is the bech32-encoded address of the validator. */ - validatorAddress: string; /** shares define the delegation shares received. */ - shares: string; } +export interface DelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Delegation"; + value: Uint8Array; +} /** * Delegation represents the bond with tokens held by an account. It is * owned by one delegator, and is associated with the voting power of one * validator. */ - -export interface DelegationSDKType { +export interface DelegationAmino { /** delegator_address is the bech32-encoded address of the delegator. */ - delegator_address: string; + delegator_address?: string; /** validator_address is the bech32-encoded address of the validator. */ - - validator_address: string; + validator_address?: string; /** shares define the delegation shares received. */ - + shares?: string; +} +export interface DelegationAminoMsg { + type: "cosmos-sdk/Delegation"; + value: DelegationAmino; +} +/** + * 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 DelegationSDKType { + delegator_address: string; + validator_address: string; shares: string; } /** * UnbondingDelegation stores all of a single delegator's unbonding bonds * for a single validator in an time-ordered list. */ - export interface UnbondingDelegation { /** delegator_address is the bech32-encoded address of the delegator. */ delegatorAddress: string; /** validator_address is the bech32-encoded address of the validator. */ - validatorAddress: string; /** entries are the unbonding delegation entries. */ - entries: UnbondingDelegationEntry[]; } +export interface UnbondingDelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation"; + value: Uint8Array; +} /** * UnbondingDelegation stores all of a single delegator's unbonding bonds * for a single validator in an time-ordered list. */ - -export interface UnbondingDelegationSDKType { +export interface UnbondingDelegationAmino { /** delegator_address is the bech32-encoded address of the delegator. */ - delegator_address: string; + delegator_address?: string; /** validator_address is the bech32-encoded address of the validator. */ - - validator_address: string; + validator_address?: string; /** entries are the unbonding delegation entries. */ - + entries?: UnbondingDelegationEntryAmino[]; +} +export interface UnbondingDelegationAminoMsg { + type: "cosmos-sdk/UnbondingDelegation"; + value: UnbondingDelegationAmino; +} +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegationSDKType { + delegator_address: string; + validator_address: string; entries: UnbondingDelegationEntrySDKType[]; } /** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ - export interface UnbondingDelegationEntry { /** creation_height is the height which the unbonding took place. */ - creationHeight: Long; + creationHeight: bigint; /** completion_time is the unix time for unbonding completion. */ - - completionTime?: Date; + completionTime: Date; /** initial_balance defines the tokens initially scheduled to receive at completion. */ - initialBalance: string; /** balance defines the tokens to receive at completion. */ - balance: string; } +export interface UnbondingDelegationEntryProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry"; + value: Uint8Array; +} /** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ - -export interface UnbondingDelegationEntrySDKType { +export interface UnbondingDelegationEntryAmino { /** creation_height is the height which the unbonding took place. */ - creation_height: Long; + creation_height?: string; /** completion_time is the unix time for unbonding completion. */ - - completion_time?: Date; + completion_time?: string; /** initial_balance defines the tokens initially scheduled to receive at completion. */ - - initial_balance: string; + initial_balance?: string; /** balance defines the tokens to receive at completion. */ - + balance?: string; +} +export interface UnbondingDelegationEntryAminoMsg { + type: "cosmos-sdk/UnbondingDelegationEntry"; + value: UnbondingDelegationEntryAmino; +} +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntrySDKType { + creation_height: bigint; + completion_time: Date; + initial_balance: string; balance: string; } /** RedelegationEntry defines a redelegation object with relevant metadata. */ - export interface RedelegationEntry { /** creation_height defines the height which the redelegation took place. */ - creationHeight: Long; + creationHeight: bigint; /** completion_time defines the unix time for redelegation completion. */ - - completionTime?: Date; + completionTime: Date; /** initial_balance defines the initial balance when redelegation started. */ - initialBalance: string; /** shares_dst is the amount of destination-validator shares created by redelegation. */ - sharesDst: string; } +export interface RedelegationEntryProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry"; + value: Uint8Array; +} /** RedelegationEntry defines a redelegation object with relevant metadata. */ - -export interface RedelegationEntrySDKType { +export interface RedelegationEntryAmino { /** creation_height defines the height which the redelegation took place. */ - creation_height: Long; + creation_height?: string; /** completion_time defines the unix time for redelegation completion. */ - - completion_time?: Date; + completion_time?: string; /** initial_balance defines the initial balance when redelegation started. */ - - initial_balance: string; + initial_balance?: string; /** shares_dst is the amount of destination-validator shares created by redelegation. */ - + shares_dst?: string; +} +export interface RedelegationEntryAminoMsg { + type: "cosmos-sdk/RedelegationEntry"; + value: RedelegationEntryAmino; +} +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntrySDKType { + creation_height: bigint; + completion_time: Date; + initial_balance: string; shares_dst: string; } /** * Redelegation contains the list of a particular delegator's redelegating bonds * from a particular source validator to a particular destination validator. */ - export interface Redelegation { /** delegator_address is the bech32-encoded address of the delegator. */ delegatorAddress: string; /** validator_src_address is the validator redelegation source operator address. */ - validatorSrcAddress: string; /** validator_dst_address is the validator redelegation destination operator address. */ - validatorDstAddress: string; /** entries are the redelegation entries. */ - entries: RedelegationEntry[]; } +export interface RedelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Redelegation"; + value: Uint8Array; +} /** * Redelegation contains the list of a particular delegator's redelegating bonds * from a particular source validator to a particular destination validator. */ - -export interface RedelegationSDKType { +export interface RedelegationAmino { /** delegator_address is the bech32-encoded address of the delegator. */ - delegator_address: string; + delegator_address?: string; /** validator_src_address is the validator redelegation source operator address. */ - - validator_src_address: string; + validator_src_address?: string; /** validator_dst_address is the validator redelegation destination operator address. */ - - validator_dst_address: string; + validator_dst_address?: string; /** entries are the redelegation entries. */ - + entries?: RedelegationEntryAmino[]; +} +export interface RedelegationAminoMsg { + type: "cosmos-sdk/Redelegation"; + value: RedelegationAmino; +} +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface RedelegationSDKType { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; entries: RedelegationEntrySDKType[]; } /** Params defines the parameters for the staking module. */ - export interface Params { /** unbonding_time is the time duration of unbonding. */ - unbondingTime?: Duration; + unbondingTime: Duration; /** max_validators is the maximum number of validators. */ - maxValidators: number; /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ - maxEntries: number; /** historical_entries is the number of historical entries to persist. */ - historicalEntries: number; /** bond_denom defines the bondable coin denomination. */ - bondDenom: string; /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ - minCommissionRate: string; } +export interface ParamsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Params"; + value: Uint8Array; +} /** Params defines the parameters for the staking module. */ - -export interface ParamsSDKType { +export interface ParamsAmino { /** unbonding_time is the time duration of unbonding. */ - unbonding_time?: DurationSDKType; + unbonding_time?: DurationAmino; /** max_validators is the maximum number of validators. */ - - max_validators: number; + max_validators?: number; /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ - - max_entries: number; + max_entries?: number; /** historical_entries is the number of historical entries to persist. */ - - historical_entries: number; + historical_entries?: number; /** bond_denom defines the bondable coin denomination. */ - - bond_denom: string; + bond_denom?: string; /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ - + min_commission_rate?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the staking module. */ +export interface ParamsSDKType { + unbonding_time: DurationSDKType; + max_validators: number; + max_entries: number; + historical_entries: number; + bond_denom: string; min_commission_rate: string; } /** * DelegationResponse is equivalent to Delegation except that it contains a * balance in addition to shares which is more suitable for client responses. */ - export interface DelegationResponse { - delegation?: Delegation; - balance?: Coin; + delegation: Delegation; + balance: Coin; +} +export interface DelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse"; + value: Uint8Array; +} +/** + * DelegationResponse is equivalent to Delegation except that it contains a + * balance in addition to shares which is more suitable for client responses. + */ +export interface DelegationResponseAmino { + delegation?: DelegationAmino; + balance?: CoinAmino; +} +export interface DelegationResponseAminoMsg { + type: "cosmos-sdk/DelegationResponse"; + value: DelegationResponseAmino; } /** * DelegationResponse is equivalent to Delegation except that it contains a * balance in addition to shares which is more suitable for client responses. */ - export interface DelegationResponseSDKType { - delegation?: DelegationSDKType; - balance?: CoinSDKType; + delegation: DelegationSDKType; + balance: CoinSDKType; } /** * 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; + redelegationEntry: RedelegationEntry; balance: string; } +export interface RedelegationEntryResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse"; + value: Uint8Array; +} +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponseAmino { + redelegation_entry?: RedelegationEntryAmino; + balance?: string; +} +export interface RedelegationEntryResponseAminoMsg { + type: "cosmos-sdk/RedelegationEntryResponse"; + value: RedelegationEntryResponseAmino; +} /** * 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 RedelegationEntryResponseSDKType { - redelegation_entry?: RedelegationEntrySDKType; + redelegation_entry: RedelegationEntrySDKType; balance: string; } /** @@ -593,95 +763,151 @@ export interface RedelegationEntryResponseSDKType { * contain a balance in addition to shares which is more suitable for client * responses. */ - export interface RedelegationResponse { - redelegation?: Redelegation; + redelegation: Redelegation; entries: RedelegationEntryResponse[]; } +export interface RedelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse"; + value: Uint8Array; +} +/** + * RedelegationResponse is equivalent to a Redelegation except that its entries + * contain a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationResponseAmino { + redelegation?: RedelegationAmino; + entries?: RedelegationEntryResponseAmino[]; +} +export interface RedelegationResponseAminoMsg { + type: "cosmos-sdk/RedelegationResponse"; + value: RedelegationResponseAmino; +} /** * 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 RedelegationResponseSDKType { - redelegation?: RedelegationSDKType; + redelegation: RedelegationSDKType; entries: RedelegationEntryResponseSDKType[]; } /** * Pool is used for tracking bonded and not-bonded token supply of the bond * denomination. */ - export interface Pool { notBondedTokens: string; bondedTokens: string; } +export interface PoolProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Pool"; + value: Uint8Array; +} +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface PoolAmino { + not_bonded_tokens?: string; + bonded_tokens?: string; +} +export interface PoolAminoMsg { + type: "cosmos-sdk/Pool"; + value: PoolAmino; +} /** * Pool is used for tracking bonded and not-bonded token supply of the bond * denomination. */ - export interface PoolSDKType { not_bonded_tokens: string; bonded_tokens: string; } - function createBaseHistoricalInfo(): HistoricalInfo { return { - header: undefined, + header: Header.fromPartial({}), valset: [] }; } - export const HistoricalInfo = { - encode(message: HistoricalInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", + encode(message: HistoricalInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); } - for (const v of message.valset) { Validator.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): HistoricalInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHistoricalInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.header = Header.decode(reader, reader.uint32()); break; - case 2: message.valset.push(Validator.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): HistoricalInfo { + fromPartial(object: Partial): HistoricalInfo { const message = createBaseHistoricalInfo(); message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; message.valset = object.valset?.map(e => Validator.fromPartial(e)) || []; return message; + }, + fromAmino(object: HistoricalInfoAmino): HistoricalInfo { + const message = createBaseHistoricalInfo(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + message.valset = object.valset?.map(e => Validator.fromAmino(e)) || []; + return message; + }, + toAmino(message: HistoricalInfo): HistoricalInfoAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + if (message.valset) { + obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.valset = []; + } + return obj; + }, + fromAminoMsg(object: HistoricalInfoAminoMsg): HistoricalInfo { + return HistoricalInfo.fromAmino(object.value); + }, + toAminoMsg(message: HistoricalInfo): HistoricalInfoAminoMsg { + return { + type: "cosmos-sdk/HistoricalInfo", + value: HistoricalInfo.toAmino(message) + }; + }, + fromProtoMsg(message: HistoricalInfoProtoMsg): HistoricalInfo { + return HistoricalInfo.decode(message.value); + }, + toProto(message: HistoricalInfo): Uint8Array { + return HistoricalInfo.encode(message).finish(); + }, + toProtoMsg(message: HistoricalInfo): HistoricalInfoProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", + value: HistoricalInfo.encode(message).finish() + }; } - }; - function createBaseCommissionRates(): CommissionRates { return { rate: "", @@ -689,119 +915,173 @@ function createBaseCommissionRates(): CommissionRates { maxChangeRate: "" }; } - export const CommissionRates = { - encode(message: CommissionRates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates", + encode(message: CommissionRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rate !== "") { - writer.uint32(10).string(message.rate); + writer.uint32(10).string(Decimal.fromUserInput(message.rate, 18).atomics); } - if (message.maxRate !== "") { - writer.uint32(18).string(message.maxRate); + writer.uint32(18).string(Decimal.fromUserInput(message.maxRate, 18).atomics); } - if (message.maxChangeRate !== "") { - writer.uint32(26).string(message.maxChangeRate); + writer.uint32(26).string(Decimal.fromUserInput(message.maxChangeRate, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CommissionRates { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommissionRates(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.rate = reader.string(); + message.rate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 2: - message.maxRate = reader.string(); + message.maxRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 3: - message.maxChangeRate = reader.string(); + message.maxChangeRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CommissionRates { + fromPartial(object: Partial): CommissionRates { const message = createBaseCommissionRates(); message.rate = object.rate ?? ""; message.maxRate = object.maxRate ?? ""; message.maxChangeRate = object.maxChangeRate ?? ""; return message; + }, + fromAmino(object: CommissionRatesAmino): CommissionRates { + const message = createBaseCommissionRates(); + if (object.rate !== undefined && object.rate !== null) { + message.rate = object.rate; + } + if (object.max_rate !== undefined && object.max_rate !== null) { + message.maxRate = object.max_rate; + } + if (object.max_change_rate !== undefined && object.max_change_rate !== null) { + message.maxChangeRate = object.max_change_rate; + } + return message; + }, + toAmino(message: CommissionRates): CommissionRatesAmino { + const obj: any = {}; + obj.rate = message.rate; + obj.max_rate = message.maxRate; + obj.max_change_rate = message.maxChangeRate; + return obj; + }, + fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { + return CommissionRates.fromAmino(object.value); + }, + toAminoMsg(message: CommissionRates): CommissionRatesAminoMsg { + return { + type: "cosmos-sdk/CommissionRates", + value: CommissionRates.toAmino(message) + }; + }, + fromProtoMsg(message: CommissionRatesProtoMsg): CommissionRates { + return CommissionRates.decode(message.value); + }, + toProto(message: CommissionRates): Uint8Array { + return CommissionRates.encode(message).finish(); + }, + toProtoMsg(message: CommissionRates): CommissionRatesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates", + value: CommissionRates.encode(message).finish() + }; } - }; - function createBaseCommission(): Commission { return { - commissionRates: undefined, - updateTime: undefined + commissionRates: CommissionRates.fromPartial({}), + updateTime: new Date() }; } - export const Commission = { - encode(message: Commission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.Commission", + encode(message: Commission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commissionRates !== undefined) { CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).ldelim(); } - if (message.updateTime !== undefined) { Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Commission { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommission(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.commissionRates = CommissionRates.decode(reader, reader.uint32()); break; - case 2: message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Commission { + fromPartial(object: Partial): Commission { const message = createBaseCommission(); message.commissionRates = object.commissionRates !== undefined && object.commissionRates !== null ? CommissionRates.fromPartial(object.commissionRates) : undefined; message.updateTime = object.updateTime ?? undefined; return message; + }, + fromAmino(object: CommissionAmino): Commission { + const message = createBaseCommission(); + if (object.commission_rates !== undefined && object.commission_rates !== null) { + message.commissionRates = CommissionRates.fromAmino(object.commission_rates); + } + if (object.update_time !== undefined && object.update_time !== null) { + message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); + } + return message; + }, + toAmino(message: Commission): CommissionAmino { + const obj: any = {}; + obj.commission_rates = message.commissionRates ? CommissionRates.toAmino(message.commissionRates) : undefined; + obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; + return obj; + }, + fromAminoMsg(object: CommissionAminoMsg): Commission { + return Commission.fromAmino(object.value); + }, + toAminoMsg(message: Commission): CommissionAminoMsg { + return { + type: "cosmos-sdk/Commission", + value: Commission.toAmino(message) + }; + }, + fromProtoMsg(message: CommissionProtoMsg): Commission { + return Commission.decode(message.value); + }, + toProto(message: Commission): Uint8Array { + return Commission.encode(message).finish(); + }, + toProtoMsg(message: Commission): CommissionProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Commission", + value: Commission.encode(message).finish() + }; } - }; - function createBaseDescription(): Description { return { moniker: "", @@ -811,71 +1091,56 @@ function createBaseDescription(): Description { details: "" }; } - export const Description = { - encode(message: Description, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.Description", + encode(message: Description, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.moniker !== "") { writer.uint32(10).string(message.moniker); } - if (message.identity !== "") { writer.uint32(18).string(message.identity); } - if (message.website !== "") { writer.uint32(26).string(message.website); } - if (message.securityContact !== "") { writer.uint32(34).string(message.securityContact); } - if (message.details !== "") { writer.uint32(42).string(message.details); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Description { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDescription(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.moniker = reader.string(); break; - case 2: message.identity = reader.string(); break; - case 3: message.website = reader.string(); break; - case 4: message.securityContact = reader.string(); break; - case 5: message.details = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Description { + fromPartial(object: Partial): Description { const message = createBaseDescription(); message.moniker = object.moniker ?? ""; message.identity = object.identity ?? ""; @@ -883,10 +1148,57 @@ export const Description = { message.securityContact = object.securityContact ?? ""; message.details = object.details ?? ""; return message; + }, + fromAmino(object: DescriptionAmino): Description { + const message = createBaseDescription(); + if (object.moniker !== undefined && object.moniker !== null) { + message.moniker = object.moniker; + } + if (object.identity !== undefined && object.identity !== null) { + message.identity = object.identity; + } + if (object.website !== undefined && object.website !== null) { + message.website = object.website; + } + if (object.security_contact !== undefined && object.security_contact !== null) { + message.securityContact = object.security_contact; + } + if (object.details !== undefined && object.details !== null) { + message.details = object.details; + } + return message; + }, + toAmino(message: Description): DescriptionAmino { + const obj: any = {}; + obj.moniker = message.moniker; + obj.identity = message.identity; + obj.website = message.website; + obj.security_contact = message.securityContact; + obj.details = message.details; + return obj; + }, + fromAminoMsg(object: DescriptionAminoMsg): Description { + return Description.fromAmino(object.value); + }, + toAminoMsg(message: Description): DescriptionAminoMsg { + return { + type: "cosmos-sdk/Description", + value: Description.toAmino(message) + }; + }, + fromProtoMsg(message: DescriptionProtoMsg): Description { + return Description.decode(message.value); + }, + toProto(message: Description): Uint8Array { + return Description.encode(message).finish(); + }, + toProtoMsg(message: Description): DescriptionProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Description", + value: Description.encode(message).finish() + }; } - }; - function createBaseValidator(): Validator { return { operatorAddress: "", @@ -895,126 +1207,99 @@ function createBaseValidator(): Validator { status: 0, tokens: "", delegatorShares: "", - description: undefined, - unbondingHeight: Long.ZERO, - unbondingTime: undefined, - commission: undefined, + description: Description.fromPartial({}), + unbondingHeight: BigInt(0), + unbondingTime: new Date(), + commission: Commission.fromPartial({}), minSelfDelegation: "" }; } - export const Validator = { - encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.Validator", + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operatorAddress !== "") { writer.uint32(10).string(message.operatorAddress); } - if (message.consensusPubkey !== undefined) { Any.encode(message.consensusPubkey, writer.uint32(18).fork()).ldelim(); } - if (message.jailed === true) { writer.uint32(24).bool(message.jailed); } - if (message.status !== 0) { writer.uint32(32).int32(message.status); } - if (message.tokens !== "") { writer.uint32(42).string(message.tokens); } - if (message.delegatorShares !== "") { - writer.uint32(50).string(message.delegatorShares); + writer.uint32(50).string(Decimal.fromUserInput(message.delegatorShares, 18).atomics); } - if (message.description !== undefined) { Description.encode(message.description, writer.uint32(58).fork()).ldelim(); } - - if (!message.unbondingHeight.isZero()) { + if (message.unbondingHeight !== BigInt(0)) { writer.uint32(64).int64(message.unbondingHeight); } - if (message.unbondingTime !== undefined) { Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).ldelim(); } - if (message.commission !== undefined) { Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); } - if (message.minSelfDelegation !== "") { writer.uint32(90).string(message.minSelfDelegation); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Validator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidator(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.operatorAddress = reader.string(); break; - case 2: message.consensusPubkey = Any.decode(reader, reader.uint32()); break; - case 3: message.jailed = reader.bool(); break; - case 4: message.status = (reader.int32() as any); break; - case 5: message.tokens = reader.string(); break; - case 6: - message.delegatorShares = reader.string(); + message.delegatorShares = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 7: message.description = Description.decode(reader, reader.uint32()); break; - case 8: - message.unbondingHeight = (reader.int64() as Long); + message.unbondingHeight = reader.int64(); break; - case 9: message.unbondingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 10: message.commission = Commission.decode(reader, reader.uint32()); break; - case 11: message.minSelfDelegation = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Validator { + fromPartial(object: Partial): Validator { const message = createBaseValidator(); message.operatorAddress = object.operatorAddress ?? ""; message.consensusPubkey = object.consensusPubkey !== undefined && object.consensusPubkey !== null ? Any.fromPartial(object.consensusPubkey) : undefined; @@ -1023,160 +1308,309 @@ export const Validator = { message.tokens = object.tokens ?? ""; message.delegatorShares = object.delegatorShares ?? ""; message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; - message.unbondingHeight = object.unbondingHeight !== undefined && object.unbondingHeight !== null ? Long.fromValue(object.unbondingHeight) : Long.ZERO; + message.unbondingHeight = object.unbondingHeight !== undefined && object.unbondingHeight !== null ? BigInt(object.unbondingHeight.toString()) : BigInt(0); message.unbondingTime = object.unbondingTime ?? undefined; message.commission = object.commission !== undefined && object.commission !== null ? Commission.fromPartial(object.commission) : undefined; message.minSelfDelegation = object.minSelfDelegation ?? ""; return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.operator_address !== undefined && object.operator_address !== null) { + message.operatorAddress = object.operator_address; + } + if (object.consensus_pubkey !== undefined && object.consensus_pubkey !== null) { + message.consensusPubkey = encodePubkey(object.consensus_pubkey); + } + if (object.jailed !== undefined && object.jailed !== null) { + message.jailed = object.jailed; + } + if (object.status !== undefined && object.status !== null) { + message.status = bondStatusFromJSON(object.status); + } + if (object.tokens !== undefined && object.tokens !== null) { + message.tokens = object.tokens; + } + if (object.delegator_shares !== undefined && object.delegator_shares !== null) { + message.delegatorShares = object.delegator_shares; + } + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.unbonding_height !== undefined && object.unbonding_height !== null) { + message.unbondingHeight = BigInt(object.unbonding_height); + } + if (object.unbonding_time !== undefined && object.unbonding_time !== null) { + message.unbondingTime = fromTimestamp(Timestamp.fromAmino(object.unbonding_time)); + } + if (object.commission !== undefined && object.commission !== null) { + message.commission = Commission.fromAmino(object.commission); + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.operator_address = message.operatorAddress; + obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; + obj.jailed = message.jailed; + obj.status = bondStatusToJSON(message.status); + obj.tokens = message.tokens; + obj.delegator_shares = message.delegatorShares; + obj.description = message.description ? Description.toAmino(message.description) : undefined; + obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; + obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; + obj.min_self_delegation = message.minSelfDelegation; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + toAminoMsg(message: Validator): ValidatorAminoMsg { + return { + type: "cosmos-sdk/Validator", + value: Validator.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Validator", + value: Validator.encode(message).finish() + }; } - }; - function createBaseValAddresses(): ValAddresses { return { addresses: [] }; } - export const ValAddresses = { - encode(message: ValAddresses, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses", + encode(message: ValAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.addresses) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValAddresses { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValAddresses(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.addresses.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValAddresses { + fromPartial(object: Partial): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: ValAddressesAmino): ValAddresses { const message = createBaseValAddresses(); message.addresses = object.addresses?.map(e => e) || []; return message; + }, + toAmino(message: ValAddresses): ValAddressesAmino { + const obj: any = {}; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = []; + } + return obj; + }, + fromAminoMsg(object: ValAddressesAminoMsg): ValAddresses { + return ValAddresses.fromAmino(object.value); + }, + toAminoMsg(message: ValAddresses): ValAddressesAminoMsg { + return { + type: "cosmos-sdk/ValAddresses", + value: ValAddresses.toAmino(message) + }; + }, + fromProtoMsg(message: ValAddressesProtoMsg): ValAddresses { + return ValAddresses.decode(message.value); + }, + toProto(message: ValAddresses): Uint8Array { + return ValAddresses.encode(message).finish(); + }, + toProtoMsg(message: ValAddresses): ValAddressesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses", + value: ValAddresses.encode(message).finish() + }; } - }; - function createBaseDVPair(): DVPair { return { delegatorAddress: "", validatorAddress: "" }; } - export const DVPair = { - encode(message: DVPair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.DVPair", + encode(message: DVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DVPair { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDVPair(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DVPair { + fromPartial(object: Partial): DVPair { const message = createBaseDVPair(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; return message; + }, + fromAmino(object: DVPairAmino): DVPair { + const message = createBaseDVPair(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: DVPair): DVPairAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + return obj; + }, + fromAminoMsg(object: DVPairAminoMsg): DVPair { + return DVPair.fromAmino(object.value); + }, + toAminoMsg(message: DVPair): DVPairAminoMsg { + return { + type: "cosmos-sdk/DVPair", + value: DVPair.toAmino(message) + }; + }, + fromProtoMsg(message: DVPairProtoMsg): DVPair { + return DVPair.decode(message.value); + }, + toProto(message: DVPair): Uint8Array { + return DVPair.encode(message).finish(); + }, + toProtoMsg(message: DVPair): DVPairProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVPair", + value: DVPair.encode(message).finish() + }; } - }; - function createBaseDVPairs(): DVPairs { return { pairs: [] }; } - export const DVPairs = { - encode(message: DVPairs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.DVPairs", + encode(message: DVPairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pairs) { DVPair.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DVPairs { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDVPairs(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pairs.push(DVPair.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DVPairs { + fromPartial(object: Partial): DVPairs { const message = createBaseDVPairs(); message.pairs = object.pairs?.map(e => DVPair.fromPartial(e)) || []; return message; + }, + fromAmino(object: DVPairsAmino): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map(e => DVPair.fromAmino(e)) || []; + return message; + }, + toAmino(message: DVPairs): DVPairsAmino { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e) : undefined); + } else { + obj.pairs = []; + } + return obj; + }, + fromAminoMsg(object: DVPairsAminoMsg): DVPairs { + return DVPairs.fromAmino(object.value); + }, + toAminoMsg(message: DVPairs): DVPairsAminoMsg { + return { + type: "cosmos-sdk/DVPairs", + value: DVPairs.toAmino(message) + }; + }, + fromProtoMsg(message: DVPairsProtoMsg): DVPairs { + return DVPairs.decode(message.value); + }, + toProto(message: DVPairs): Uint8Array { + return DVPairs.encode(message).finish(); + }, + toProtoMsg(message: DVPairs): DVPairsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVPairs", + value: DVPairs.encode(message).finish() + }; } - }; - function createBaseDVVTriplet(): DVVTriplet { return { delegatorAddress: "", @@ -1184,109 +1618,163 @@ function createBaseDVVTriplet(): DVVTriplet { validatorDstAddress: "" }; } - export const DVVTriplet = { - encode(message: DVVTriplet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", + encode(message: DVVTriplet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== "") { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== "") { writer.uint32(26).string(message.validatorDstAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplet { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDVVTriplet(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorSrcAddress = reader.string(); break; - case 3: message.validatorDstAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DVVTriplet { + fromPartial(object: Partial): DVVTriplet { const message = createBaseDVVTriplet(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorSrcAddress = object.validatorSrcAddress ?? ""; message.validatorDstAddress = object.validatorDstAddress ?? ""; return message; + }, + fromAmino(object: DVVTripletAmino): DVVTriplet { + const message = createBaseDVVTriplet(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + return message; + }, + toAmino(message: DVVTriplet): DVVTripletAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress; + return obj; + }, + fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { + return DVVTriplet.fromAmino(object.value); + }, + toAminoMsg(message: DVVTriplet): DVVTripletAminoMsg { + return { + type: "cosmos-sdk/DVVTriplet", + value: DVVTriplet.toAmino(message) + }; + }, + fromProtoMsg(message: DVVTripletProtoMsg): DVVTriplet { + return DVVTriplet.decode(message.value); + }, + toProto(message: DVVTriplet): Uint8Array { + return DVVTriplet.encode(message).finish(); + }, + toProtoMsg(message: DVVTriplet): DVVTripletProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", + value: DVVTriplet.encode(message).finish() + }; } - }; - function createBaseDVVTriplets(): DVVTriplets { return { triplets: [] }; } - export const DVVTriplets = { - encode(message: DVVTriplets, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", + encode(message: DVVTriplets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.triplets) { DVVTriplet.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplets { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDVVTriplets(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DVVTriplets { + fromPartial(object: Partial): DVVTriplets { const message = createBaseDVVTriplets(); message.triplets = object.triplets?.map(e => DVVTriplet.fromPartial(e)) || []; return message; + }, + fromAmino(object: DVVTripletsAmino): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map(e => DVVTriplet.fromAmino(e)) || []; + return message; + }, + toAmino(message: DVVTriplets): DVVTripletsAmino { + const obj: any = {}; + if (message.triplets) { + obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e) : undefined); + } else { + obj.triplets = []; + } + return obj; + }, + fromAminoMsg(object: DVVTripletsAminoMsg): DVVTriplets { + return DVVTriplets.fromAmino(object.value); + }, + toAminoMsg(message: DVVTriplets): DVVTripletsAminoMsg { + return { + type: "cosmos-sdk/DVVTriplets", + value: DVVTriplets.toAmino(message) + }; + }, + fromProtoMsg(message: DVVTripletsProtoMsg): DVVTriplets { + return DVVTriplets.decode(message.value); + }, + toProto(message: DVVTriplets): Uint8Array { + return DVVTriplets.encode(message).finish(); + }, + toProtoMsg(message: DVVTriplets): DVVTripletsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", + value: DVVTriplets.encode(message).finish() + }; } - }; - function createBaseDelegation(): Delegation { return { delegatorAddress: "", @@ -1294,64 +1782,92 @@ function createBaseDelegation(): Delegation { shares: "" }; } - export const Delegation = { - encode(message: Delegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.Delegation", + encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - if (message.shares !== "") { - writer.uint32(26).string(message.shares); + writer.uint32(26).string(Decimal.fromUserInput(message.shares, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Delegation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDelegation(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - case 3: - message.shares = reader.string(); + message.shares = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Delegation { + fromPartial(object: Partial): Delegation { const message = createBaseDelegation(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; message.shares = object.shares ?? ""; return message; + }, + fromAmino(object: DelegationAmino): Delegation { + const message = createBaseDelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.shares !== undefined && object.shares !== null) { + message.shares = object.shares; + } + return message; + }, + toAmino(message: Delegation): DelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + obj.shares = message.shares; + return obj; + }, + fromAminoMsg(object: DelegationAminoMsg): Delegation { + return Delegation.fromAmino(object.value); + }, + toAminoMsg(message: Delegation): DelegationAminoMsg { + return { + type: "cosmos-sdk/Delegation", + value: Delegation.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationProtoMsg): Delegation { + return Delegation.decode(message.value); + }, + toProto(message: Delegation): Uint8Array { + return Delegation.encode(message).finish(); + }, + toProtoMsg(message: Delegation): DelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Delegation", + value: Delegation.encode(message).finish() + }; } - }; - function createBaseUnbondingDelegation(): UnbondingDelegation { return { delegatorAddress: "", @@ -1359,214 +1875,304 @@ function createBaseUnbondingDelegation(): UnbondingDelegation { entries: [] }; } - export const UnbondingDelegation = { - encode(message: UnbondingDelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", + encode(message: UnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - for (const v of message.entries) { UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUnbondingDelegation(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - case 3: message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): UnbondingDelegation { + fromPartial(object: Partial): UnbondingDelegation { const message = createBaseUnbondingDelegation(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; message.entries = object.entries?.map(e => UnbondingDelegationEntry.fromPartial(e)) || []; return message; + }, + fromAmino(object: UnbondingDelegationAmino): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.entries = object.entries?.map(e => UnbondingDelegationEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + if (message.entries) { + obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + fromAminoMsg(object: UnbondingDelegationAminoMsg): UnbondingDelegation { + return UnbondingDelegation.fromAmino(object.value); + }, + toAminoMsg(message: UnbondingDelegation): UnbondingDelegationAminoMsg { + return { + type: "cosmos-sdk/UnbondingDelegation", + value: UnbondingDelegation.toAmino(message) + }; + }, + fromProtoMsg(message: UnbondingDelegationProtoMsg): UnbondingDelegation { + return UnbondingDelegation.decode(message.value); + }, + toProto(message: UnbondingDelegation): Uint8Array { + return UnbondingDelegation.encode(message).finish(); + }, + toProtoMsg(message: UnbondingDelegation): UnbondingDelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", + value: UnbondingDelegation.encode(message).finish() + }; } - }; - function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { return { - creationHeight: Long.ZERO, - completionTime: undefined, + creationHeight: BigInt(0), + completionTime: new Date(), initialBalance: "", balance: "" }; } - export const UnbondingDelegationEntry = { - encode(message: UnbondingDelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.creationHeight.isZero()) { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creationHeight !== BigInt(0)) { writer.uint32(8).int64(message.creationHeight); } - if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); } - if (message.initialBalance !== "") { writer.uint32(26).string(message.initialBalance); } - if (message.balance !== "") { writer.uint32(34).string(message.balance); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUnbondingDelegationEntry(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.creationHeight = (reader.int64() as Long); + message.creationHeight = reader.int64(); break; - case 2: message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 3: message.initialBalance = reader.string(); break; - case 4: message.balance = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): UnbondingDelegationEntry { + fromPartial(object: Partial): UnbondingDelegationEntry { const message = createBaseUnbondingDelegationEntry(); - message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? Long.fromValue(object.creationHeight) : Long.ZERO; + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); message.completionTime = object.completionTime ?? undefined; message.initialBalance = object.initialBalance ?? ""; message.balance = object.balance ?? ""; return message; + }, + fromAmino(object: UnbondingDelegationEntryAmino): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + if (object.creation_height !== undefined && object.creation_height !== null) { + message.creationHeight = BigInt(object.creation_height); + } + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + if (object.initial_balance !== undefined && object.initial_balance !== null) { + message.initialBalance = object.initial_balance; + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = object.balance; + } + return message; + }, + toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { + const obj: any = {}; + obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; + obj.initial_balance = message.initialBalance; + obj.balance = message.balance; + return obj; + }, + fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromAmino(object.value); + }, + toAminoMsg(message: UnbondingDelegationEntry): UnbondingDelegationEntryAminoMsg { + return { + type: "cosmos-sdk/UnbondingDelegationEntry", + value: UnbondingDelegationEntry.toAmino(message) + }; + }, + fromProtoMsg(message: UnbondingDelegationEntryProtoMsg): UnbondingDelegationEntry { + return UnbondingDelegationEntry.decode(message.value); + }, + toProto(message: UnbondingDelegationEntry): Uint8Array { + return UnbondingDelegationEntry.encode(message).finish(); + }, + toProtoMsg(message: UnbondingDelegationEntry): UnbondingDelegationEntryProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", + value: UnbondingDelegationEntry.encode(message).finish() + }; } - }; - function createBaseRedelegationEntry(): RedelegationEntry { return { - creationHeight: Long.ZERO, - completionTime: undefined, + creationHeight: BigInt(0), + completionTime: new Date(), initialBalance: "", sharesDst: "" }; } - export const RedelegationEntry = { - encode(message: RedelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.creationHeight.isZero()) { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", + encode(message: RedelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creationHeight !== BigInt(0)) { writer.uint32(8).int64(message.creationHeight); } - if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); } - if (message.initialBalance !== "") { writer.uint32(26).string(message.initialBalance); } - if (message.sharesDst !== "") { - writer.uint32(34).string(message.sharesDst); + writer.uint32(34).string(Decimal.fromUserInput(message.sharesDst, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRedelegationEntry(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.creationHeight = (reader.int64() as Long); + message.creationHeight = reader.int64(); break; - case 2: message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 3: message.initialBalance = reader.string(); break; - case 4: - message.sharesDst = reader.string(); + message.sharesDst = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RedelegationEntry { + fromPartial(object: Partial): RedelegationEntry { const message = createBaseRedelegationEntry(); - message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? Long.fromValue(object.creationHeight) : Long.ZERO; + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); message.completionTime = object.completionTime ?? undefined; message.initialBalance = object.initialBalance ?? ""; message.sharesDst = object.sharesDst ?? ""; return message; + }, + fromAmino(object: RedelegationEntryAmino): RedelegationEntry { + const message = createBaseRedelegationEntry(); + if (object.creation_height !== undefined && object.creation_height !== null) { + message.creationHeight = BigInt(object.creation_height); + } + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + if (object.initial_balance !== undefined && object.initial_balance !== null) { + message.initialBalance = object.initial_balance; + } + if (object.shares_dst !== undefined && object.shares_dst !== null) { + message.sharesDst = object.shares_dst; + } + return message; + }, + toAmino(message: RedelegationEntry): RedelegationEntryAmino { + const obj: any = {}; + obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; + obj.initial_balance = message.initialBalance; + obj.shares_dst = message.sharesDst; + return obj; + }, + fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { + return RedelegationEntry.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationEntry): RedelegationEntryAminoMsg { + return { + type: "cosmos-sdk/RedelegationEntry", + value: RedelegationEntry.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationEntryProtoMsg): RedelegationEntry { + return RedelegationEntry.decode(message.value); + }, + toProto(message: RedelegationEntry): Uint8Array { + return RedelegationEntry.encode(message).finish(); + }, + toProtoMsg(message: RedelegationEntry): RedelegationEntryProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", + value: RedelegationEntry.encode(message).finish() + }; } - }; - function createBaseRedelegation(): Redelegation { return { delegatorAddress: "", @@ -1575,76 +2181,108 @@ function createBaseRedelegation(): Redelegation { entries: [] }; } - export const Redelegation = { - encode(message: Redelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.Redelegation", + encode(message: Redelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== "") { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== "") { writer.uint32(26).string(message.validatorDstAddress); } - for (const v of message.entries) { RedelegationEntry.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Redelegation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRedelegation(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorSrcAddress = reader.string(); break; - case 3: message.validatorDstAddress = reader.string(); break; - case 4: message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Redelegation { + fromPartial(object: Partial): Redelegation { const message = createBaseRedelegation(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorSrcAddress = object.validatorSrcAddress ?? ""; message.validatorDstAddress = object.validatorDstAddress ?? ""; message.entries = object.entries?.map(e => RedelegationEntry.fromPartial(e)) || []; return message; + }, + fromAmino(object: RedelegationAmino): Redelegation { + const message = createBaseRedelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + message.entries = object.entries?.map(e => RedelegationEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: Redelegation): RedelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress; + if (message.entries) { + obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + fromAminoMsg(object: RedelegationAminoMsg): Redelegation { + return Redelegation.fromAmino(object.value); + }, + toAminoMsg(message: Redelegation): RedelegationAminoMsg { + return { + type: "cosmos-sdk/Redelegation", + value: Redelegation.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationProtoMsg): Redelegation { + return Redelegation.decode(message.value); + }, + toProto(message: Redelegation): Uint8Array { + return Redelegation.encode(message).finish(); + }, + toProtoMsg(message: Redelegation): RedelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Redelegation", + value: Redelegation.encode(message).finish() + }; } - }; - function createBaseParams(): Params { return { - unbondingTime: undefined, + unbondingTime: Duration.fromPartial({}), maxValidators: 0, maxEntries: 0, historicalEntries: 0, @@ -1652,79 +2290,62 @@ function createBaseParams(): Params { minCommissionRate: "" }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.unbondingTime !== undefined) { Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); } - if (message.maxValidators !== 0) { writer.uint32(16).uint32(message.maxValidators); } - if (message.maxEntries !== 0) { writer.uint32(24).uint32(message.maxEntries); } - if (message.historicalEntries !== 0) { writer.uint32(32).uint32(message.historicalEntries); } - if (message.bondDenom !== "") { writer.uint32(42).string(message.bondDenom); } - if (message.minCommissionRate !== "") { - writer.uint32(50).string(message.minCommissionRate); + writer.uint32(50).string(Decimal.fromUserInput(message.minCommissionRate, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.unbondingTime = Duration.decode(reader, reader.uint32()); break; - case 2: message.maxValidators = reader.uint32(); break; - case 3: message.maxEntries = reader.uint32(); break; - case 4: message.historicalEntries = reader.uint32(); break; - case 5: message.bondDenom = reader.string(); break; - case 6: - message.minCommissionRate = reader.string(); + message.minCommissionRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); message.unbondingTime = object.unbondingTime !== undefined && object.unbondingTime !== null ? Duration.fromPartial(object.unbondingTime) : undefined; message.maxValidators = object.maxValidators ?? 0; @@ -1733,226 +2354,384 @@ export const Params = { message.bondDenom = object.bondDenom ?? ""; message.minCommissionRate = object.minCommissionRate ?? ""; return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.unbonding_time !== undefined && object.unbonding_time !== null) { + message.unbondingTime = Duration.fromAmino(object.unbonding_time); + } + if (object.max_validators !== undefined && object.max_validators !== null) { + message.maxValidators = object.max_validators; + } + if (object.max_entries !== undefined && object.max_entries !== null) { + message.maxEntries = object.max_entries; + } + if (object.historical_entries !== undefined && object.historical_entries !== null) { + message.historicalEntries = object.historical_entries; + } + if (object.bond_denom !== undefined && object.bond_denom !== null) { + message.bondDenom = object.bond_denom; + } + if (object.min_commission_rate !== undefined && object.min_commission_rate !== null) { + message.minCommissionRate = object.min_commission_rate; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; + obj.max_validators = message.maxValidators; + obj.max_entries = message.maxEntries; + obj.historical_entries = message.historicalEntries; + obj.bond_denom = message.bondDenom; + obj.min_commission_rate = message.minCommissionRate; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Params", + value: Params.encode(message).finish() + }; } - }; - function createBaseDelegationResponse(): DelegationResponse { return { - delegation: undefined, - balance: undefined + delegation: Delegation.fromPartial({}), + balance: Coin.fromPartial({}) }; } - export const DelegationResponse = { - encode(message: DelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", + encode(message: DelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegation !== undefined) { Delegation.encode(message.delegation, writer.uint32(10).fork()).ldelim(); } - if (message.balance !== undefined) { Coin.encode(message.balance, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DelegationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDelegationResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegation = Delegation.decode(reader, reader.uint32()); break; - case 2: message.balance = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DelegationResponse { + fromPartial(object: Partial): DelegationResponse { const message = createBaseDelegationResponse(); message.delegation = object.delegation !== undefined && object.delegation !== null ? Delegation.fromPartial(object.delegation) : undefined; message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; return message; + }, + fromAmino(object: DelegationResponseAmino): DelegationResponse { + const message = createBaseDelegationResponse(); + if (object.delegation !== undefined && object.delegation !== null) { + message.delegation = Delegation.fromAmino(object.delegation); + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: DelegationResponse): DelegationResponseAmino { + const obj: any = {}; + obj.delegation = message.delegation ? Delegation.toAmino(message.delegation) : undefined; + obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + return obj; + }, + fromAminoMsg(object: DelegationResponseAminoMsg): DelegationResponse { + return DelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: DelegationResponse): DelegationResponseAminoMsg { + return { + type: "cosmos-sdk/DelegationResponse", + value: DelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationResponseProtoMsg): DelegationResponse { + return DelegationResponse.decode(message.value); + }, + toProto(message: DelegationResponse): Uint8Array { + return DelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: DelegationResponse): DelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", + value: DelegationResponse.encode(message).finish() + }; } - }; - function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { return { - redelegationEntry: undefined, + redelegationEntry: RedelegationEntry.fromPartial({}), balance: "" }; } - export const RedelegationEntryResponse = { - encode(message: RedelegationEntryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", + encode(message: RedelegationEntryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.redelegationEntry !== undefined) { RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); } - if (message.balance !== "") { writer.uint32(34).string(message.balance); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntryResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRedelegationEntryResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.redelegationEntry = RedelegationEntry.decode(reader, reader.uint32()); break; - case 4: message.balance = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RedelegationEntryResponse { + fromPartial(object: Partial): RedelegationEntryResponse { const message = createBaseRedelegationEntryResponse(); message.redelegationEntry = object.redelegationEntry !== undefined && object.redelegationEntry !== null ? RedelegationEntry.fromPartial(object.redelegationEntry) : undefined; message.balance = object.balance ?? ""; return message; + }, + fromAmino(object: RedelegationEntryResponseAmino): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + if (object.redelegation_entry !== undefined && object.redelegation_entry !== null) { + message.redelegationEntry = RedelegationEntry.fromAmino(object.redelegation_entry); + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = object.balance; + } + return message; + }, + toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { + const obj: any = {}; + obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; + obj.balance = message.balance; + return obj; + }, + fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { + return RedelegationEntryResponse.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationEntryResponse): RedelegationEntryResponseAminoMsg { + return { + type: "cosmos-sdk/RedelegationEntryResponse", + value: RedelegationEntryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationEntryResponseProtoMsg): RedelegationEntryResponse { + return RedelegationEntryResponse.decode(message.value); + }, + toProto(message: RedelegationEntryResponse): Uint8Array { + return RedelegationEntryResponse.encode(message).finish(); + }, + toProtoMsg(message: RedelegationEntryResponse): RedelegationEntryResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", + value: RedelegationEntryResponse.encode(message).finish() + }; } - }; - function createBaseRedelegationResponse(): RedelegationResponse { return { - redelegation: undefined, + redelegation: Redelegation.fromPartial({}), entries: [] }; } - export const RedelegationResponse = { - encode(message: RedelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", + encode(message: RedelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.redelegation !== undefined) { Redelegation.encode(message.redelegation, writer.uint32(10).fork()).ldelim(); } - for (const v of message.entries) { RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRedelegationResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.redelegation = Redelegation.decode(reader, reader.uint32()); break; - case 2: message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RedelegationResponse { + fromPartial(object: Partial): RedelegationResponse { const message = createBaseRedelegationResponse(); message.redelegation = object.redelegation !== undefined && object.redelegation !== null ? Redelegation.fromPartial(object.redelegation) : undefined; message.entries = object.entries?.map(e => RedelegationEntryResponse.fromPartial(e)) || []; return message; + }, + fromAmino(object: RedelegationResponseAmino): RedelegationResponse { + const message = createBaseRedelegationResponse(); + if (object.redelegation !== undefined && object.redelegation !== null) { + message.redelegation = Redelegation.fromAmino(object.redelegation); + } + message.entries = object.entries?.map(e => RedelegationEntryResponse.fromAmino(e)) || []; + return message; + }, + toAmino(message: RedelegationResponse): RedelegationResponseAmino { + const obj: any = {}; + obj.redelegation = message.redelegation ? Redelegation.toAmino(message.redelegation) : undefined; + if (message.entries) { + obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + fromAminoMsg(object: RedelegationResponseAminoMsg): RedelegationResponse { + return RedelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationResponse): RedelegationResponseAminoMsg { + return { + type: "cosmos-sdk/RedelegationResponse", + value: RedelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationResponseProtoMsg): RedelegationResponse { + return RedelegationResponse.decode(message.value); + }, + toProto(message: RedelegationResponse): Uint8Array { + return RedelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: RedelegationResponse): RedelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", + value: RedelegationResponse.encode(message).finish() + }; } - }; - function createBasePool(): Pool { return { notBondedTokens: "", bondedTokens: "" }; } - export const Pool = { - encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.Pool", + encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.notBondedTokens !== "") { writer.uint32(10).string(message.notBondedTokens); } - if (message.bondedTokens !== "") { writer.uint32(18).string(message.bondedTokens); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Pool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePool(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.notBondedTokens = reader.string(); break; - case 2: message.bondedTokens = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Pool { + fromPartial(object: Partial): Pool { const message = createBasePool(); message.notBondedTokens = object.notBondedTokens ?? ""; message.bondedTokens = object.bondedTokens ?? ""; return message; + }, + fromAmino(object: PoolAmino): Pool { + const message = createBasePool(); + if (object.not_bonded_tokens !== undefined && object.not_bonded_tokens !== null) { + message.notBondedTokens = object.not_bonded_tokens; + } + if (object.bonded_tokens !== undefined && object.bonded_tokens !== null) { + message.bondedTokens = object.bonded_tokens; + } + return message; + }, + toAmino(message: Pool): PoolAmino { + const obj: any = {}; + obj.not_bonded_tokens = message.notBondedTokens; + obj.bonded_tokens = message.bondedTokens; + return obj; + }, + fromAminoMsg(object: PoolAminoMsg): Pool { + return Pool.fromAmino(object.value); + }, + toAminoMsg(message: Pool): PoolAminoMsg { + return { + type: "cosmos-sdk/Pool", + value: Pool.toAmino(message) + }; + }, + fromProtoMsg(message: PoolProtoMsg): Pool { + return Pool.decode(message.value); + }, + toProto(message: Pool): Uint8Array { + return Pool.encode(message).finish(); + }, + toProtoMsg(message: Pool): PoolProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Pool", + value: Pool.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/tx.amino.ts b/src/codegen/cosmos/staking/v1beta1/tx.amino.ts index 9ece1b2..0620696 100644 --- a/src/codegen/cosmos/staking/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/staking/v1beta1/tx.amino.ts @@ -1,294 +1,28 @@ -import { AminoMsg, decodeBech32Pubkey, encodeBech32Pubkey } from "@cosmjs/amino"; -import { fromBase64, toBase64 } from "@cosmjs/encoding"; -import { Long } from "../../../helpers"; import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate } from "./tx"; -export interface AminoMsgCreateValidator extends AminoMsg { - type: "cosmos-sdk/MsgCreateValidator"; - value: { - description: { - moniker: string; - identity: string; - website: string; - security_contact: string; - details: string; - }; - commission: { - rate: string; - max_rate: string; - max_change_rate: string; - }; - min_self_delegation: string; - delegator_address: string; - validator_address: string; - pubkey: { - type_url: string; - value: Uint8Array; - }; - value: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgEditValidator extends AminoMsg { - type: "cosmos-sdk/MsgEditValidator"; - value: { - description: { - moniker: string; - identity: string; - website: string; - security_contact: string; - details: string; - }; - validator_address: string; - commission_rate: string; - min_self_delegation: string; - }; -} -export interface AminoMsgDelegate extends AminoMsg { - type: "cosmos-sdk/MsgDelegate"; - value: { - delegator_address: string; - validator_address: string; - amount: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgBeginRedelegate extends AminoMsg { - type: "cosmos-sdk/MsgBeginRedelegate"; - value: { - delegator_address: string; - validator_src_address: string; - validator_dst_address: string; - amount: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgUndelegate extends AminoMsg { - type: "cosmos-sdk/MsgUndelegate"; - value: { - delegator_address: string; - validator_address: string; - amount: { - denom: string; - amount: string; - }; - }; -} export const AminoConverter = { "/cosmos.staking.v1beta1.MsgCreateValidator": { aminoType: "cosmos-sdk/MsgCreateValidator", - toAmino: ({ - description, - commission, - minSelfDelegation, - delegatorAddress, - validatorAddress, - pubkey, - value - }: MsgCreateValidator): AminoMsgCreateValidator["value"] => { - return { - description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details - }, - commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate - }, - min_self_delegation: minSelfDelegation, - delegator_address: delegatorAddress, - validator_address: validatorAddress, - pubkey: { - typeUrl: "/cosmos.crypto.secp256k1.PubKey", - value: fromBase64(decodeBech32Pubkey(pubkey).value) - }, - value: { - denom: value.denom, - amount: Long.fromValue(value.amount).toString() - } - }; - }, - fromAmino: ({ - description, - commission, - min_self_delegation, - delegator_address, - validator_address, - pubkey, - value - }: AminoMsgCreateValidator["value"]): MsgCreateValidator => { - return { - description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - securityContact: description.security_contact, - details: description.details - }, - commission: { - rate: commission.rate, - maxRate: commission.max_rate, - maxChangeRate: commission.max_change_rate - }, - minSelfDelegation: min_self_delegation, - delegatorAddress: delegator_address, - validatorAddress: validator_address, - pubkey: encodeBech32Pubkey({ - type: "tendermint/PubKeySecp256k1", - value: toBase64(pubkey.value) - }, "cosmos"), - value: { - denom: value.denom, - amount: value.amount - } - }; - } + toAmino: MsgCreateValidator.toAmino, + fromAmino: MsgCreateValidator.fromAmino }, "/cosmos.staking.v1beta1.MsgEditValidator": { aminoType: "cosmos-sdk/MsgEditValidator", - toAmino: ({ - description, - validatorAddress, - commissionRate, - minSelfDelegation - }: MsgEditValidator): AminoMsgEditValidator["value"] => { - return { - description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details - }, - validator_address: validatorAddress, - commission_rate: commissionRate, - min_self_delegation: minSelfDelegation - }; - }, - fromAmino: ({ - description, - validator_address, - commission_rate, - min_self_delegation - }: AminoMsgEditValidator["value"]): MsgEditValidator => { - return { - description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - securityContact: description.security_contact, - details: description.details - }, - validatorAddress: validator_address, - commissionRate: commission_rate, - minSelfDelegation: min_self_delegation - }; - } + toAmino: MsgEditValidator.toAmino, + fromAmino: MsgEditValidator.fromAmino }, "/cosmos.staking.v1beta1.MsgDelegate": { aminoType: "cosmos-sdk/MsgDelegate", - toAmino: ({ - delegatorAddress, - validatorAddress, - amount - }: MsgDelegate): AminoMsgDelegate["value"] => { - return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, - amount: { - denom: amount.denom, - amount: Long.fromValue(amount.amount).toString() - } - }; - }, - fromAmino: ({ - delegator_address, - validator_address, - amount - }: AminoMsgDelegate["value"]): MsgDelegate => { - return { - delegatorAddress: delegator_address, - validatorAddress: validator_address, - amount: { - denom: amount.denom, - amount: amount.amount - } - }; - } + toAmino: MsgDelegate.toAmino, + fromAmino: MsgDelegate.fromAmino }, "/cosmos.staking.v1beta1.MsgBeginRedelegate": { aminoType: "cosmos-sdk/MsgBeginRedelegate", - toAmino: ({ - delegatorAddress, - validatorSrcAddress, - validatorDstAddress, - amount - }: MsgBeginRedelegate): AminoMsgBeginRedelegate["value"] => { - return { - delegator_address: delegatorAddress, - validator_src_address: validatorSrcAddress, - validator_dst_address: validatorDstAddress, - amount: { - denom: amount.denom, - amount: Long.fromValue(amount.amount).toString() - } - }; - }, - fromAmino: ({ - delegator_address, - validator_src_address, - validator_dst_address, - amount - }: AminoMsgBeginRedelegate["value"]): MsgBeginRedelegate => { - return { - delegatorAddress: delegator_address, - validatorSrcAddress: validator_src_address, - validatorDstAddress: validator_dst_address, - amount: { - denom: amount.denom, - amount: amount.amount - } - }; - } + toAmino: MsgBeginRedelegate.toAmino, + fromAmino: MsgBeginRedelegate.fromAmino }, "/cosmos.staking.v1beta1.MsgUndelegate": { aminoType: "cosmos-sdk/MsgUndelegate", - toAmino: ({ - delegatorAddress, - validatorAddress, - amount - }: MsgUndelegate): AminoMsgUndelegate["value"] => { - return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, - amount: { - denom: amount.denom, - amount: Long.fromValue(amount.amount).toString() - } - }; - }, - fromAmino: ({ - delegator_address, - validator_address, - amount - }: AminoMsgUndelegate["value"]): MsgUndelegate => { - return { - delegatorAddress: delegator_address, - validatorAddress: validator_address, - amount: { - denom: amount.denom, - amount: amount.amount - } - }; - } + toAmino: MsgUndelegate.toAmino, + fromAmino: MsgUndelegate.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/tx.registry.ts b/src/codegen/cosmos/staking/v1beta1/tx.registry.ts index 66b2832..ba13911 100644 --- a/src/codegen/cosmos/staking/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/staking/v1beta1/tx.registry.ts @@ -14,35 +14,30 @@ export const MessageComposer = { value: MsgCreateValidator.encode(value).finish() }; }, - editValidator(value: MsgEditValidator) { return { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: MsgEditValidator.encode(value).finish() }; }, - delegate(value: MsgDelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.encode(value).finish() }; }, - beginRedelegate(value: MsgBeginRedelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: MsgBeginRedelegate.encode(value).finish() }; }, - undelegate(value: MsgUndelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: MsgUndelegate.encode(value).finish() }; } - }, withTypeUrl: { createValidator(value: MsgCreateValidator) { @@ -51,35 +46,30 @@ export const MessageComposer = { value }; }, - editValidator(value: MsgEditValidator) { return { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value }; }, - delegate(value: MsgDelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value }; }, - beginRedelegate(value: MsgBeginRedelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value }; }, - undelegate(value: MsgUndelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value }; } - }, fromPartial: { createValidator(value: MsgCreateValidator) { @@ -88,34 +78,29 @@ export const MessageComposer = { value: MsgCreateValidator.fromPartial(value) }; }, - editValidator(value: MsgEditValidator) { return { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: MsgEditValidator.fromPartial(value) }; }, - delegate(value: MsgDelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.fromPartial(value) }; }, - beginRedelegate(value: MsgBeginRedelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: MsgBeginRedelegate.fromPartial(value) }; }, - undelegate(value: MsgUndelegate) { return { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: MsgUndelegate.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/staking/v1beta1/tx.rpc.msg.ts index b530ca1..bc68ae5 100644 --- a/src/codegen/cosmos/staking/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -1,36 +1,30 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgCreateValidator, MsgCreateValidatorResponse, MsgEditValidator, MsgEditValidatorResponse, MsgDelegate, MsgDelegateResponse, MsgBeginRedelegate, MsgBeginRedelegateResponse, MsgUndelegate, MsgUndelegateResponse } from "./tx"; /** Msg defines the staking Msg service. */ - export interface Msg { /** CreateValidator defines a method for creating a new validator. */ createValidator(request: MsgCreateValidator): Promise; /** EditValidator defines a method for editing an existing validator. */ - editValidator(request: MsgEditValidator): Promise; /** * Delegate defines a method for performing a delegation of coins * from a delegator to a validator. */ - delegate(request: MsgDelegate): Promise; /** * BeginRedelegate defines a method for performing a redelegation * of coins from a delegator and source validator to a destination validator. */ - beginRedelegate(request: MsgBeginRedelegate): Promise; /** * Undelegate defines a method for performing an undelegation from a * delegate and a validator. */ - undelegate(request: MsgUndelegate): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.createValidator = this.createValidator.bind(this); @@ -39,35 +33,29 @@ export class MsgClientImpl implements Msg { this.beginRedelegate = this.beginRedelegate.bind(this); this.undelegate = this.undelegate.bind(this); } - createValidator(request: MsgCreateValidator): Promise { const data = MsgCreateValidator.encode(request).finish(); const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "CreateValidator", data); - return promise.then(data => MsgCreateValidatorResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Msg", "EditValidator", data); - return promise.then(data => MsgEditValidatorResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Msg", "Delegate", data); - return promise.then(data => MsgDelegateResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Msg", "BeginRedelegate", data); - return promise.then(data => MsgBeginRedelegateResponse.decode(new _m0.Reader(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("cosmos.staking.v1beta1.Msg", "Undelegate", data); - return promise.then(data => MsgUndelegateResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgUndelegateResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/staking/v1beta1/tx.ts b/src/codegen/cosmos/staking/v1beta1/tx.ts index 7a8cef9..47eb3d4 100644 --- a/src/codegen/cosmos/staking/v1beta1/tx.ts +++ b/src/codegen/cosmos/staking/v1beta1/tx.ts @@ -1,41 +1,66 @@ -import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Description, DescriptionAmino, DescriptionSDKType, CommissionRates, CommissionRatesAmino, CommissionRatesSDKType } from "./staking"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp } from "../../../google/protobuf/timestamp"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@cosmjs/math"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** MsgCreateValidator defines a SDK message for creating a new validator. */ - export interface MsgCreateValidator { - description?: Description; - commission?: CommissionRates; + description: Description; + commission: CommissionRates; minSelfDelegation: string; delegatorAddress: string; validatorAddress: string; pubkey?: Any; - value?: Coin; + value: Coin; +} +export interface MsgCreateValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator"; + value: Uint8Array; +} +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidatorAmino { + description?: DescriptionAmino; + commission?: CommissionRatesAmino; + min_self_delegation?: string; + delegator_address?: string; + validator_address?: string; + pubkey?: AnyAmino; + value?: CoinAmino; +} +export interface MsgCreateValidatorAminoMsg { + type: "cosmos-sdk/MsgCreateValidator"; + value: MsgCreateValidatorAmino; } /** MsgCreateValidator defines a SDK message for creating a new validator. */ - export interface MsgCreateValidatorSDKType { - description?: DescriptionSDKType; - commission?: CommissionRatesSDKType; + description: DescriptionSDKType; + commission: CommissionRatesSDKType; min_self_delegation: string; delegator_address: string; validator_address: string; pubkey?: AnySDKType; - value?: CoinSDKType; + value: CoinSDKType; } /** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ - export interface MsgCreateValidatorResponse {} +export interface MsgCreateValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse"; + value: Uint8Array; +} +/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ +export interface MsgCreateValidatorResponseAmino {} +export interface MsgCreateValidatorResponseAminoMsg { + type: "cosmos-sdk/MsgCreateValidatorResponse"; + value: MsgCreateValidatorResponseAmino; +} /** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ - export interface MsgCreateValidatorResponseSDKType {} /** MsgEditValidator defines a SDK message for editing an existing validator. */ - export interface MsgEditValidator { - description?: Description; + description: Description; validatorAddress: string; /** * We pass a reference to the new commission rate and min self delegation as @@ -43,212 +68,286 @@ export interface MsgEditValidator { * zero with no way to distinguish if an update was intended. * REF: #2373 */ - commissionRate: string; minSelfDelegation: string; } +export interface MsgEditValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator"; + value: Uint8Array; +} /** MsgEditValidator defines a SDK message for editing an existing validator. */ - -export interface MsgEditValidatorSDKType { - description?: DescriptionSDKType; - validator_address: string; +export interface MsgEditValidatorAmino { + description?: DescriptionAmino; + validator_address?: string; /** * We pass a reference to the new commission rate and min self delegation as * it's not mandatory to update. If not updated, the deserialized rate will be * zero with no way to distinguish if an update was intended. * REF: #2373 */ - + commission_rate?: string; + min_self_delegation?: string; +} +export interface MsgEditValidatorAminoMsg { + type: "cosmos-sdk/MsgEditValidator"; + value: MsgEditValidatorAmino; +} +/** MsgEditValidator defines a SDK message for editing an existing validator. */ +export interface MsgEditValidatorSDKType { + description: DescriptionSDKType; + validator_address: string; commission_rate: string; min_self_delegation: string; } /** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ - export interface MsgEditValidatorResponse {} +export interface MsgEditValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse"; + value: Uint8Array; +} +/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ +export interface MsgEditValidatorResponseAmino {} +export interface MsgEditValidatorResponseAminoMsg { + type: "cosmos-sdk/MsgEditValidatorResponse"; + value: MsgEditValidatorResponseAmino; +} /** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ - export interface MsgEditValidatorResponseSDKType {} /** * 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; + amount: Coin; +} +export interface MsgDelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate"; + value: Uint8Array; +} +/** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ +export interface MsgDelegateAmino { + delegator_address?: string; + validator_address?: string; + amount?: CoinAmino; +} +export interface MsgDelegateAminoMsg { + type: "cosmos-sdk/MsgDelegate"; + value: MsgDelegateAmino; } /** * MsgDelegate defines a SDK message for performing a delegation of coins * from a delegator to a validator. */ - export interface MsgDelegateSDKType { delegator_address: string; validator_address: string; - amount?: CoinSDKType; + amount: CoinSDKType; } /** MsgDelegateResponse defines the Msg/Delegate response type. */ - export interface MsgDelegateResponse {} +export interface MsgDelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse"; + value: Uint8Array; +} +/** MsgDelegateResponse defines the Msg/Delegate response type. */ +export interface MsgDelegateResponseAmino {} +export interface MsgDelegateResponseAminoMsg { + type: "cosmos-sdk/MsgDelegateResponse"; + value: MsgDelegateResponseAmino; +} /** MsgDelegateResponse defines the Msg/Delegate response type. */ - export interface MsgDelegateResponseSDKType {} /** * 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; + amount: Coin; +} +export interface MsgBeginRedelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate"; + value: Uint8Array; +} +/** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ +export interface MsgBeginRedelegateAmino { + delegator_address?: string; + validator_src_address?: string; + validator_dst_address?: string; + amount?: CoinAmino; +} +export interface MsgBeginRedelegateAminoMsg { + type: "cosmos-sdk/MsgBeginRedelegate"; + value: MsgBeginRedelegateAmino; } /** * MsgBeginRedelegate defines a SDK message for performing a redelegation * of coins from a delegator and source validator to a destination validator. */ - export interface MsgBeginRedelegateSDKType { delegator_address: string; validator_src_address: string; validator_dst_address: string; - amount?: CoinSDKType; + amount: CoinSDKType; } /** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ - export interface MsgBeginRedelegateResponse { - completionTime?: Date; + completionTime: Date; +} +export interface MsgBeginRedelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse"; + value: Uint8Array; +} +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponseAmino { + completion_time?: string; +} +export interface MsgBeginRedelegateResponseAminoMsg { + type: "cosmos-sdk/MsgBeginRedelegateResponse"; + value: MsgBeginRedelegateResponseAmino; } /** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ - export interface MsgBeginRedelegateResponseSDKType { - completion_time?: Date; + completion_time: Date; } /** * MsgUndelegate defines a SDK message for performing an undelegation from a * delegate and a validator. */ - export interface MsgUndelegate { delegatorAddress: string; validatorAddress: string; - amount?: Coin; + amount: Coin; +} +export interface MsgUndelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate"; + value: Uint8Array; +} +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegateAmino { + delegator_address?: string; + validator_address?: string; + amount?: CoinAmino; +} +export interface MsgUndelegateAminoMsg { + type: "cosmos-sdk/MsgUndelegate"; + value: MsgUndelegateAmino; } /** * MsgUndelegate defines a SDK message for performing an undelegation from a * delegate and a validator. */ - export interface MsgUndelegateSDKType { delegator_address: string; validator_address: string; - amount?: CoinSDKType; + amount: CoinSDKType; } /** MsgUndelegateResponse defines the Msg/Undelegate response type. */ - export interface MsgUndelegateResponse { - completionTime?: Date; + completionTime: Date; +} +export interface MsgUndelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse"; + value: Uint8Array; +} +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponseAmino { + completion_time?: string; +} +export interface MsgUndelegateResponseAminoMsg { + type: "cosmos-sdk/MsgUndelegateResponse"; + value: MsgUndelegateResponseAmino; } /** MsgUndelegateResponse defines the Msg/Undelegate response type. */ - export interface MsgUndelegateResponseSDKType { - completion_time?: Date; + completion_time: Date; } - function createBaseMsgCreateValidator(): MsgCreateValidator { return { - description: undefined, - commission: undefined, + description: Description.fromPartial({}), + commission: CommissionRates.fromPartial({}), minSelfDelegation: "", delegatorAddress: "", validatorAddress: "", pubkey: undefined, - value: undefined + value: Coin.fromPartial({}) }; } - export const MsgCreateValidator = { - encode(message: MsgCreateValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + encode(message: MsgCreateValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); } - if (message.commission !== undefined) { CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim(); } - if (message.minSelfDelegation !== "") { writer.uint32(26).string(message.minSelfDelegation); } - if (message.delegatorAddress !== "") { writer.uint32(34).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(42).string(message.validatorAddress); } - if (message.pubkey !== undefined) { Any.encode(message.pubkey, writer.uint32(50).fork()).ldelim(); } - if (message.value !== undefined) { Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateValidator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateValidator(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.description = Description.decode(reader, reader.uint32()); break; - case 2: message.commission = CommissionRates.decode(reader, reader.uint32()); break; - case 3: message.minSelfDelegation = reader.string(); break; - case 4: message.delegatorAddress = reader.string(); break; - case 5: message.validatorAddress = reader.string(); break; - case 6: message.pubkey = Any.decode(reader, reader.uint32()); break; - case 7: message.value = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateValidator { + fromPartial(object: Partial): 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; @@ -258,478 +357,764 @@ export const MsgCreateValidator = { 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; + }, + fromAmino(object: MsgCreateValidatorAmino): MsgCreateValidator { + const message = createBaseMsgCreateValidator(); + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.commission !== undefined && object.commission !== null) { + message.commission = CommissionRates.fromAmino(object.commission); + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.value !== undefined && object.value !== null) { + message.value = Coin.fromAmino(object.value); + } + return message; + }, + toAmino(message: MsgCreateValidator): MsgCreateValidatorAmino { + const obj: any = {}; + obj.description = message.description ? Description.toAmino(message.description) : undefined; + obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; + obj.min_self_delegation = message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.value = message.value ? Coin.toAmino(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateValidatorAminoMsg): MsgCreateValidator { + return MsgCreateValidator.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateValidator): MsgCreateValidatorAminoMsg { + return { + type: "cosmos-sdk/MsgCreateValidator", + value: MsgCreateValidator.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateValidatorProtoMsg): MsgCreateValidator { + return MsgCreateValidator.decode(message.value); + }, + toProto(message: MsgCreateValidator): Uint8Array { + return MsgCreateValidator.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateValidator): MsgCreateValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + value: MsgCreateValidator.encode(message).finish() + }; } - }; - function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { return {}; } - export const MsgCreateValidatorResponse = { - encode(_: MsgCreateValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateValidatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateValidatorResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgCreateValidatorResponse { + fromPartial(_: Partial): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, + fromAmino(_: MsgCreateValidatorResponseAmino): MsgCreateValidatorResponse { const message = createBaseMsgCreateValidatorResponse(); return message; + }, + toAmino(_: MsgCreateValidatorResponse): MsgCreateValidatorResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateValidatorResponseAminoMsg): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateValidatorResponse): MsgCreateValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateValidatorResponse", + value: MsgCreateValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateValidatorResponseProtoMsg): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.decode(message.value); + }, + toProto(message: MsgCreateValidatorResponse): Uint8Array { + return MsgCreateValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateValidatorResponse): MsgCreateValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", + value: MsgCreateValidatorResponse.encode(message).finish() + }; } - }; - function createBaseMsgEditValidator(): MsgEditValidator { return { - description: undefined, + description: Description.fromPartial({}), validatorAddress: "", commissionRate: "", minSelfDelegation: "" }; } - export const MsgEditValidator = { - encode(message: MsgEditValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + encode(message: MsgEditValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - if (message.commissionRate !== "") { - writer.uint32(26).string(message.commissionRate); + writer.uint32(26).string(Decimal.fromUserInput(message.commissionRate, 18).atomics); } - if (message.minSelfDelegation !== "") { writer.uint32(34).string(message.minSelfDelegation); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditValidator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgEditValidator(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.description = Description.decode(reader, reader.uint32()); break; - case 2: message.validatorAddress = reader.string(); break; - case 3: - message.commissionRate = reader.string(); + message.commissionRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 4: message.minSelfDelegation = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgEditValidator { + fromPartial(object: Partial): MsgEditValidator { const message = createBaseMsgEditValidator(); message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; message.validatorAddress = object.validatorAddress ?? ""; message.commissionRate = object.commissionRate ?? ""; message.minSelfDelegation = object.minSelfDelegation ?? ""; return message; + }, + fromAmino(object: MsgEditValidatorAmino): MsgEditValidator { + const message = createBaseMsgEditValidator(); + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.commission_rate !== undefined && object.commission_rate !== null) { + message.commissionRate = object.commission_rate; + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + return message; + }, + toAmino(message: MsgEditValidator): MsgEditValidatorAmino { + const obj: any = {}; + obj.description = message.description ? Description.toAmino(message.description) : undefined; + obj.validator_address = message.validatorAddress; + obj.commission_rate = message.commissionRate; + obj.min_self_delegation = message.minSelfDelegation; + return obj; + }, + fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { + return MsgEditValidator.fromAmino(object.value); + }, + toAminoMsg(message: MsgEditValidator): MsgEditValidatorAminoMsg { + return { + type: "cosmos-sdk/MsgEditValidator", + value: MsgEditValidator.toAmino(message) + }; + }, + fromProtoMsg(message: MsgEditValidatorProtoMsg): MsgEditValidator { + return MsgEditValidator.decode(message.value); + }, + toProto(message: MsgEditValidator): Uint8Array { + return MsgEditValidator.encode(message).finish(); + }, + toProtoMsg(message: MsgEditValidator): MsgEditValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + value: MsgEditValidator.encode(message).finish() + }; } - }; - function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { return {}; } - export const MsgEditValidatorResponse = { - encode(_: MsgEditValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditValidatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgEditValidatorResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgEditValidatorResponse { + fromPartial(_: Partial): MsgEditValidatorResponse { const message = createBaseMsgEditValidatorResponse(); return message; + }, + fromAmino(_: MsgEditValidatorResponseAmino): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, + toAmino(_: MsgEditValidatorResponse): MsgEditValidatorResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgEditValidatorResponseAminoMsg): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgEditValidatorResponse): MsgEditValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/MsgEditValidatorResponse", + value: MsgEditValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgEditValidatorResponseProtoMsg): MsgEditValidatorResponse { + return MsgEditValidatorResponse.decode(message.value); + }, + toProto(message: MsgEditValidatorResponse): Uint8Array { + return MsgEditValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgEditValidatorResponse): MsgEditValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", + value: MsgEditValidatorResponse.encode(message).finish() + }; } - }; - function createBaseMsgDelegate(): MsgDelegate { return { delegatorAddress: "", validatorAddress: "", - amount: undefined + amount: Coin.fromPartial({}) }; } - export const MsgDelegate = { - encode(message: MsgDelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + encode(message: MsgDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDelegate(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - case 3: message.amount = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgDelegate { + fromPartial(object: Partial): MsgDelegate { const message = createBaseMsgDelegate(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; + }, + fromAmino(object: MsgDelegateAmino): MsgDelegate { + const message = createBaseMsgDelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgDelegate): MsgDelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + return obj; + }, + fromAminoMsg(object: MsgDelegateAminoMsg): MsgDelegate { + return MsgDelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgDelegate): MsgDelegateAminoMsg { + return { + type: "cosmos-sdk/MsgDelegate", + value: MsgDelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDelegateProtoMsg): MsgDelegate { + return MsgDelegate.decode(message.value); + }, + toProto(message: MsgDelegate): Uint8Array { + return MsgDelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgDelegate): MsgDelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + value: MsgDelegate.encode(message).finish() + }; } - }; - function createBaseMsgDelegateResponse(): MsgDelegateResponse { return {}; } - export const MsgDelegateResponse = { - encode(_: MsgDelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", + encode(_: MsgDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDelegateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgDelegateResponse { + fromPartial(_: Partial): MsgDelegateResponse { const message = createBaseMsgDelegateResponse(); return message; + }, + fromAmino(_: MsgDelegateResponseAmino): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, + toAmino(_: MsgDelegateResponse): MsgDelegateResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDelegateResponseAminoMsg): MsgDelegateResponse { + return MsgDelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDelegateResponse): MsgDelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDelegateResponse", + value: MsgDelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDelegateResponseProtoMsg): MsgDelegateResponse { + return MsgDelegateResponse.decode(message.value); + }, + toProto(message: MsgDelegateResponse): Uint8Array { + return MsgDelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDelegateResponse): MsgDelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", + value: MsgDelegateResponse.encode(message).finish() + }; } - }; - function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", - amount: undefined + amount: Coin.fromPartial({}) }; } - export const MsgBeginRedelegate = { - encode(message: MsgBeginRedelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + encode(message: MsgBeginRedelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== "") { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== "") { writer.uint32(26).string(message.validatorDstAddress); } - if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgBeginRedelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgBeginRedelegate(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorSrcAddress = reader.string(); break; - case 3: message.validatorDstAddress = reader.string(); break; - case 4: message.amount = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgBeginRedelegate { + fromPartial(object: Partial): MsgBeginRedelegate { const message = createBaseMsgBeginRedelegate(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorSrcAddress = object.validatorSrcAddress ?? ""; message.validatorDstAddress = object.validatorDstAddress ?? ""; message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; + }, + fromAmino(object: MsgBeginRedelegateAmino): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + return obj; + }, + fromAminoMsg(object: MsgBeginRedelegateAminoMsg): MsgBeginRedelegate { + return MsgBeginRedelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgBeginRedelegate): MsgBeginRedelegateAminoMsg { + return { + type: "cosmos-sdk/MsgBeginRedelegate", + value: MsgBeginRedelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgBeginRedelegateProtoMsg): MsgBeginRedelegate { + return MsgBeginRedelegate.decode(message.value); + }, + toProto(message: MsgBeginRedelegate): Uint8Array { + return MsgBeginRedelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgBeginRedelegate): MsgBeginRedelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + value: MsgBeginRedelegate.encode(message).finish() + }; } - }; - function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { return { - completionTime: undefined + completionTime: new Date() }; } - export const MsgBeginRedelegateResponse = { - encode(message: MsgBeginRedelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgBeginRedelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgBeginRedelegateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgBeginRedelegateResponse { + fromPartial(object: Partial): MsgBeginRedelegateResponse { const message = createBaseMsgBeginRedelegateResponse(); message.completionTime = object.completionTime ?? undefined; return message; + }, + fromAmino(object: MsgBeginRedelegateResponseAmino): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + return message; + }, + toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino { + const obj: any = {}; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgBeginRedelegateResponseAminoMsg): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgBeginRedelegateResponse", + value: MsgBeginRedelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgBeginRedelegateResponseProtoMsg): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.decode(message.value); + }, + toProto(message: MsgBeginRedelegateResponse): Uint8Array { + return MsgBeginRedelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", + value: MsgBeginRedelegateResponse.encode(message).finish() + }; } - }; - function createBaseMsgUndelegate(): MsgUndelegate { return { delegatorAddress: "", validatorAddress: "", - amount: undefined + amount: Coin.fromPartial({}) }; } - export const MsgUndelegate = { - encode(message: MsgUndelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + encode(message: MsgUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUndelegate(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.delegatorAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - case 3: message.amount = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUndelegate { + fromPartial(object: Partial): MsgUndelegate { const message = createBaseMsgUndelegate(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; + }, + fromAmino(object: MsgUndelegateAmino): MsgUndelegate { + const message = createBaseMsgUndelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgUndelegate): MsgUndelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress; + obj.validator_address = message.validatorAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUndelegateAminoMsg): MsgUndelegate { + return MsgUndelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgUndelegate): MsgUndelegateAminoMsg { + return { + type: "cosmos-sdk/MsgUndelegate", + value: MsgUndelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUndelegateProtoMsg): MsgUndelegate { + return MsgUndelegate.decode(message.value); + }, + toProto(message: MsgUndelegate): Uint8Array { + return MsgUndelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgUndelegate): MsgUndelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + value: MsgUndelegate.encode(message).finish() + }; } - }; - function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { return { - completionTime: undefined + completionTime: new Date() }; } - export const MsgUndelegateResponse = { - encode(message: MsgUndelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", + encode(message: MsgUndelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUndelegateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUndelegateResponse { + fromPartial(object: Partial): MsgUndelegateResponse { const message = createBaseMsgUndelegateResponse(); message.completionTime = object.completionTime ?? undefined; return message; + }, + fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + return message; + }, + toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino { + const obj: any = {}; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUndelegateResponseAminoMsg): MsgUndelegateResponse { + return MsgUndelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUndelegateResponse): MsgUndelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUndelegateResponse", + value: MsgUndelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUndelegateResponseProtoMsg): MsgUndelegateResponse { + return MsgUndelegateResponse.decode(message.value); + }, + toProto(message: MsgUndelegateResponse): Uint8Array { + return MsgUndelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUndelegateResponse): MsgUndelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", + value: MsgUndelegateResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/tx/signing/v1beta1/signing.ts b/src/codegen/cosmos/tx/signing/v1beta1/signing.ts index fa746a9..cf0691d 100644 --- a/src/codegen/cosmos/tx/signing/v1beta1/signing.ts +++ b/src/codegen/cosmos/tx/signing/v1beta1/signing.ts @@ -1,7 +1,7 @@ -import { CompactBitArray, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../../helpers"; +import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * SignMode represents a signing mode with its own security guarantees. * @@ -12,27 +12,23 @@ import { DeepPartial, Long } from "../../../../helpers"; * to this SignMode enum describing their sign mode so that different * apps have a consistent version of this enum. */ - export enum SignMode { /** * SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be * rejected. */ SIGN_MODE_UNSPECIFIED = 0, - /** * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is * verified with raw bytes from Tx. */ SIGN_MODE_DIRECT = 1, - /** * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some * human-readable textual representation on top of the binary representation * from SIGN_MODE_DIRECT. It is currently not supported. */ SIGN_MODE_TEXTUAL = 2, - /** * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not @@ -42,55 +38,6 @@ export enum SignMode { * Since: cosmos-sdk 0.46 */ SIGN_MODE_DIRECT_AUX = 3, - - /** - * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - * Amino JSON and will be removed in the future. - */ - SIGN_MODE_LEGACY_AMINO_JSON = 127, - UNRECOGNIZED = -1, -} -/** - * 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 SignModeSDKType { - /** - * SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - * rejected. - */ - SIGN_MODE_UNSPECIFIED = 0, - - /** - * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - * verified with raw bytes from Tx. - */ - SIGN_MODE_DIRECT = 1, - - /** - * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some - * human-readable textual representation on top of the binary representation - * from SIGN_MODE_DIRECT. It is currently not supported. - */ - SIGN_MODE_TEXTUAL = 2, - - /** - * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses - * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - * require signers signing over other signers' `signer_info`. It also allows - * for adding Tips in transactions. - * - * Since: cosmos-sdk 0.46 - */ - SIGN_MODE_DIRECT_AUX = 3, - /** * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses * Amino JSON and will be removed in the future. @@ -98,28 +45,25 @@ export enum SignModeSDKType { SIGN_MODE_LEGACY_AMINO_JSON = 127, UNRECOGNIZED = -1, } +export const SignModeSDKType = SignMode; +export const SignModeAmino = SignMode; export function signModeFromJSON(object: any): SignMode { switch (object) { case 0: case "SIGN_MODE_UNSPECIFIED": return SignMode.SIGN_MODE_UNSPECIFIED; - case 1: case "SIGN_MODE_DIRECT": return SignMode.SIGN_MODE_DIRECT; - case 2: case "SIGN_MODE_TEXTUAL": return SignMode.SIGN_MODE_TEXTUAL; - case 3: case "SIGN_MODE_DIRECT_AUX": return SignMode.SIGN_MODE_DIRECT_AUX; - case 127: case "SIGN_MODE_LEGACY_AMINO_JSON": return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; - case -1: case "UNRECOGNIZED": default: @@ -130,34 +74,39 @@ export function signModeToJSON(object: SignMode): string { switch (object) { case SignMode.SIGN_MODE_UNSPECIFIED: return "SIGN_MODE_UNSPECIFIED"; - case SignMode.SIGN_MODE_DIRECT: return "SIGN_MODE_DIRECT"; - case SignMode.SIGN_MODE_TEXTUAL: return "SIGN_MODE_TEXTUAL"; - case SignMode.SIGN_MODE_DIRECT_AUX: return "SIGN_MODE_DIRECT_AUX"; - case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: return "SIGN_MODE_LEGACY_AMINO_JSON"; - case SignMode.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** SignatureDescriptors wraps multiple SignatureDescriptor's. */ - export interface SignatureDescriptors { /** signatures are the signature descriptors */ signatures: SignatureDescriptor[]; } +export interface SignatureDescriptorsProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors"; + value: Uint8Array; +} /** SignatureDescriptors wraps multiple SignatureDescriptor's. */ - -export interface SignatureDescriptorsSDKType { +export interface SignatureDescriptorsAmino { /** signatures are the signature descriptors */ + signatures?: SignatureDescriptorAmino[]; +} +export interface SignatureDescriptorsAminoMsg { + type: "cosmos-sdk/SignatureDescriptors"; + value: SignatureDescriptorsAmino; +} +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptorsSDKType { signatures: SignatureDescriptorSDKType[]; } /** @@ -166,7 +115,6 @@ export interface SignatureDescriptorsSDKType { * 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; @@ -176,8 +124,11 @@ export interface SignatureDescriptor { * number of committed transactions signed by a given address. It is used to prevent * replay attacks. */ - - sequence: Long; + sequence: bigint; +} +export interface SignatureDescriptorProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor"; + value: Uint8Array; } /** * SignatureDescriptor is a convenience type which represents the full data for @@ -185,345 +136,519 @@ export interface SignatureDescriptor { * signature itself. It is primarily used for coordinating signatures between * clients. */ - -export interface SignatureDescriptorSDKType { +export interface SignatureDescriptorAmino { /** public_key is the public key of the signer */ - public_key?: AnySDKType; - data?: SignatureDescriptor_DataSDKType; + public_key?: AnyAmino; + data?: SignatureDescriptor_DataAmino; /** * sequence is the sequence of the account, which describes the * number of committed transactions signed by a given address. It is used to prevent * replay attacks. */ - - sequence: Long; + sequence?: string; +} +export interface SignatureDescriptorAminoMsg { + type: "cosmos-sdk/SignatureDescriptor"; + value: SignatureDescriptorAmino; +} +/** + * 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 SignatureDescriptorSDKType { + public_key?: AnySDKType; + data?: SignatureDescriptor_DataSDKType; + sequence: bigint; } /** Data represents signature data */ - export interface SignatureDescriptor_Data { /** single represents a single signer */ single?: SignatureDescriptor_Data_Single; /** multi represents a multisig signer */ - multi?: SignatureDescriptor_Data_Multi; } +export interface SignatureDescriptor_DataProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Data"; + value: Uint8Array; +} /** Data represents signature data */ - -export interface SignatureDescriptor_DataSDKType { +export interface SignatureDescriptor_DataAmino { /** single represents a single signer */ - single?: SignatureDescriptor_Data_SingleSDKType; + single?: SignatureDescriptor_Data_SingleAmino; /** multi represents a multisig signer */ - + multi?: SignatureDescriptor_Data_MultiAmino; +} +export interface SignatureDescriptor_DataAminoMsg { + type: "cosmos-sdk/Data"; + value: SignatureDescriptor_DataAmino; +} +/** Data represents signature data */ +export interface SignatureDescriptor_DataSDKType { + single?: SignatureDescriptor_Data_SingleSDKType; multi?: SignatureDescriptor_Data_MultiSDKType; } /** Single is the signature data for a single signer */ - export interface SignatureDescriptor_Data_Single { /** mode is the signing mode of the single signer */ mode: SignMode; /** signature is the raw signature bytes */ - signature: Uint8Array; } +export interface SignatureDescriptor_Data_SingleProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Single"; + value: Uint8Array; +} /** Single is the signature data for a single signer */ - -export interface SignatureDescriptor_Data_SingleSDKType { +export interface SignatureDescriptor_Data_SingleAmino { /** mode is the signing mode of the single signer */ - mode: SignModeSDKType; + mode?: SignMode; /** signature is the raw signature bytes */ - + signature?: string; +} +export interface SignatureDescriptor_Data_SingleAminoMsg { + type: "cosmos-sdk/Single"; + value: SignatureDescriptor_Data_SingleAmino; +} +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_SingleSDKType { + mode: SignMode; signature: Uint8Array; } /** Multi is the signature data for a multisig public key */ - export interface SignatureDescriptor_Data_Multi { /** bitarray specifies which keys within the multisig are signing */ bitarray?: CompactBitArray; /** signatures is the signatures of the multi-signature */ - signatures: SignatureDescriptor_Data[]; } +export interface SignatureDescriptor_Data_MultiProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi"; + value: Uint8Array; +} /** Multi is the signature data for a multisig public key */ - -export interface SignatureDescriptor_Data_MultiSDKType { +export interface SignatureDescriptor_Data_MultiAmino { /** bitarray specifies which keys within the multisig are signing */ - bitarray?: CompactBitArraySDKType; + bitarray?: CompactBitArrayAmino; /** signatures is the signatures of the multi-signature */ - + signatures?: SignatureDescriptor_DataAmino[]; +} +export interface SignatureDescriptor_Data_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: SignatureDescriptor_Data_MultiAmino; +} +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_MultiSDKType { + bitarray?: CompactBitArraySDKType; signatures: SignatureDescriptor_DataSDKType[]; } - function createBaseSignatureDescriptors(): SignatureDescriptors { return { signatures: [] }; } - export const SignatureDescriptors = { - encode(message: SignatureDescriptors, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", + encode(message: SignatureDescriptors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signatures) { SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptors { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignatureDescriptors(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignatureDescriptors { + fromPartial(object: Partial): SignatureDescriptors { const message = createBaseSignatureDescriptors(); message.signatures = object.signatures?.map(e => SignatureDescriptor.fromPartial(e)) || []; return message; + }, + fromAmino(object: SignatureDescriptorsAmino): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map(e => SignatureDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: SignatureDescriptors): SignatureDescriptorsAmino { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: SignatureDescriptorsAminoMsg): SignatureDescriptors { + return SignatureDescriptors.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptors): SignatureDescriptorsAminoMsg { + return { + type: "cosmos-sdk/SignatureDescriptors", + value: SignatureDescriptors.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptorsProtoMsg): SignatureDescriptors { + return SignatureDescriptors.decode(message.value); + }, + toProto(message: SignatureDescriptors): Uint8Array { + return SignatureDescriptors.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptors): SignatureDescriptorsProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", + value: SignatureDescriptors.encode(message).finish() + }; } - }; - function createBaseSignatureDescriptor(): SignatureDescriptor { return { publicKey: undefined, data: undefined, - sequence: Long.UZERO + sequence: BigInt(0) }; } - export const SignatureDescriptor = { - encode(message: SignatureDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", + encode(message: SignatureDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); } - if (message.data !== undefined) { SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignatureDescriptor(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.publicKey = Any.decode(reader, reader.uint32()); break; - case 2: message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); break; - case 3: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignatureDescriptor { + fromPartial(object: Partial): SignatureDescriptor { const message = createBaseSignatureDescriptor(); message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; message.data = object.data !== undefined && object.data !== null ? SignatureDescriptor_Data.fromPartial(object.data) : undefined; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; + }, + fromAmino(object: SignatureDescriptorAmino): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.data !== undefined && object.data !== null) { + message.data = SignatureDescriptor_Data.fromAmino(object.data); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: SignatureDescriptor): SignatureDescriptorAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { + return SignatureDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor): SignatureDescriptorAminoMsg { + return { + type: "cosmos-sdk/SignatureDescriptor", + value: SignatureDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptorProtoMsg): SignatureDescriptor { + return SignatureDescriptor.decode(message.value); + }, + toProto(message: SignatureDescriptor): Uint8Array { + return SignatureDescriptor.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor): SignatureDescriptorProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", + value: SignatureDescriptor.encode(message).finish() + }; } - }; - function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { return { single: undefined, multi: undefined }; } - export const SignatureDescriptor_Data = { - encode(message: SignatureDescriptor_Data, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.signing.v1beta1.Data", + encode(message: SignatureDescriptor_Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.single !== undefined) { SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); } - if (message.multi !== undefined) { SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignatureDescriptor_Data(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); break; - case 2: message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignatureDescriptor_Data { + fromPartial(object: Partial): SignatureDescriptor_Data { const message = createBaseSignatureDescriptor_Data(); message.single = object.single !== undefined && object.single !== null ? SignatureDescriptor_Data_Single.fromPartial(object.single) : undefined; message.multi = object.multi !== undefined && object.multi !== null ? SignatureDescriptor_Data_Multi.fromPartial(object.multi) : undefined; return message; + }, + fromAmino(object: SignatureDescriptor_DataAmino): SignatureDescriptor_Data { + const message = createBaseSignatureDescriptor_Data(); + if (object.single !== undefined && object.single !== null) { + message.single = SignatureDescriptor_Data_Single.fromAmino(object.single); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = SignatureDescriptor_Data_Multi.fromAmino(object.multi); + } + return message; + }, + toAmino(message: SignatureDescriptor_Data): SignatureDescriptor_DataAmino { + const obj: any = {}; + obj.single = message.single ? SignatureDescriptor_Data_Single.toAmino(message.single) : undefined; + obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toAmino(message.multi) : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_DataAminoMsg): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data): SignatureDescriptor_DataAminoMsg { + return { + type: "cosmos-sdk/Data", + value: SignatureDescriptor_Data.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_DataProtoMsg): SignatureDescriptor_Data { + return SignatureDescriptor_Data.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data): Uint8Array { + return SignatureDescriptor_Data.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data): SignatureDescriptor_DataProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Data", + value: SignatureDescriptor_Data.encode(message).finish() + }; } - }; - function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_Single { return { mode: 0, signature: new Uint8Array() }; } - export const SignatureDescriptor_Data_Single = { - encode(message: SignatureDescriptor_Data_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.signing.v1beta1.Single", + encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mode !== 0) { writer.uint32(8).int32(message.mode); } - if (message.signature.length !== 0) { writer.uint32(18).bytes(message.signature); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignatureDescriptor_Data_Single(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.mode = (reader.int32() as any); break; - case 2: message.signature = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignatureDescriptor_Data_Single { + fromPartial(object: Partial): SignatureDescriptor_Data_Single { const message = createBaseSignatureDescriptor_Data_Single(); message.mode = object.mode ?? 0; message.signature = object.signature ?? new Uint8Array(); return message; + }, + fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + if (object.mode !== undefined && object.mode !== null) { + message.mode = signModeFromJSON(object.mode); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { + const obj: any = {}; + obj.mode = signModeToJSON(message.mode); + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_Data_SingleAminoMsg): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAminoMsg { + return { + type: "cosmos-sdk/Single", + value: SignatureDescriptor_Data_Single.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_Data_SingleProtoMsg): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data_Single): Uint8Array { + return SignatureDescriptor_Data_Single.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Single", + value: SignatureDescriptor_Data_Single.encode(message).finish() + }; } - }; - function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { return { bitarray: undefined, signatures: [] }; } - export const SignatureDescriptor_Data_Multi = { - encode(message: SignatureDescriptor_Data_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi", + encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bitarray !== undefined) { CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); } - for (const v of message.signatures) { SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignatureDescriptor_Data_Multi(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.bitarray = CompactBitArray.decode(reader, reader.uint32()); break; - case 2: message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignatureDescriptor_Data_Multi { + fromPartial(object: Partial): SignatureDescriptor_Data_Multi { const message = createBaseSignatureDescriptor_Data_Multi(); message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; message.signatures = object.signatures?.map(e => SignatureDescriptor_Data.fromPartial(e)) || []; return message; + }, + fromAmino(object: SignatureDescriptor_Data_MultiAmino): SignatureDescriptor_Data_Multi { + const message = createBaseSignatureDescriptor_Data_Multi(); + if (object.bitarray !== undefined && object.bitarray !== null) { + message.bitarray = CompactBitArray.fromAmino(object.bitarray); + } + message.signatures = object.signatures?.map(e => SignatureDescriptor_Data.fromAmino(e)) || []; + return message; + }, + toAmino(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiAmino { + const obj: any = {}; + obj.bitarray = message.bitarray ? CompactBitArray.toAmino(message.bitarray) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_Data_MultiAminoMsg): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: SignatureDescriptor_Data_Multi.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_Data_MultiProtoMsg): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data_Multi): Uint8Array { + return SignatureDescriptor_Data_Multi.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi", + value: SignatureDescriptor_Data_Multi.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/tx/v1beta1/service.lcd.ts b/src/codegen/cosmos/tx/v1beta1/service.lcd.ts index ee31b21..c4ed28e 100644 --- a/src/codegen/cosmos/tx/v1beta1/service.lcd.ts +++ b/src/codegen/cosmos/tx/v1beta1/service.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { GetTxRequest, GetTxResponseSDKType, GetTxsEventRequest, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsResponseSDKType } from "./service"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -15,51 +14,38 @@ export class LCDQueryClient { this.getBlockWithTxs = this.getBlockWithTxs.bind(this); } /* GetTx fetches a tx by hash. */ - - async getTx(params: GetTxRequest): Promise { const endpoint = `cosmos/tx/v1beta1/txs/${params.hash}`; return await this.req.get(endpoint); } /* GetTxsEvent fetches txs by event. */ - - async getTxsEvent(params: GetTxsEventRequest): Promise { const options: any = { params: {} }; - if (typeof params?.events !== "undefined") { options.params.events = params.events; } - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - if (typeof params?.orderBy !== "undefined") { options.params.order_by = params.orderBy; } - const endpoint = `cosmos/tx/v1beta1/txs`; return await this.req.get(endpoint, options); } /* GetBlockWithTxs fetches a block with decoded txs. Since: cosmos-sdk 0.45.2 */ - - async getBlockWithTxs(params: GetBlockWithTxsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `cosmos/tx/v1beta1/txs/block/${params.height}`; return await this.req.get(endpoint, options); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/tx/v1beta1/service.rpc.Service.ts b/src/codegen/cosmos/tx/v1beta1/service.rpc.Service.ts index 385b42d..5a96317 100644 --- a/src/codegen/cosmos/tx/v1beta1/service.rpc.Service.ts +++ b/src/codegen/cosmos/tx/v1beta1/service.rpc.Service.ts @@ -1,32 +1,26 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { SimulateRequest, SimulateResponse, GetTxRequest, GetTxResponse, BroadcastTxRequest, BroadcastTxResponse, GetTxsEventRequest, GetTxsEventResponse, GetBlockWithTxsRequest, GetBlockWithTxsResponse } from "./service"; /** Service defines a gRPC service for interacting with transactions. */ - export interface Service { /** Simulate simulates executing a transaction for estimating gas usage. */ simulate(request: SimulateRequest): Promise; /** GetTx fetches a tx by hash. */ - getTx(request: GetTxRequest): Promise; /** BroadcastTx broadcast transaction. */ - broadcastTx(request: BroadcastTxRequest): Promise; /** GetTxsEvent fetches txs by event. */ - getTxsEvent(request: GetTxsEventRequest): Promise; /** * GetBlockWithTxs fetches a block with decoded txs. * * Since: cosmos-sdk 0.45.2 */ - getBlockWithTxs(request: GetBlockWithTxsRequest): Promise; } export class ServiceClientImpl implements Service { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.simulate = this.simulate.bind(this); @@ -35,37 +29,31 @@ export class ServiceClientImpl implements Service { this.getTxsEvent = this.getTxsEvent.bind(this); this.getBlockWithTxs = this.getBlockWithTxs.bind(this); } - simulate(request: SimulateRequest): Promise { const data = SimulateRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "Simulate", data); - return promise.then(data => SimulateResponse.decode(new _m0.Reader(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("cosmos.tx.v1beta1.Service", "GetTx", data); - return promise.then(data => GetTxResponse.decode(new _m0.Reader(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("cosmos.tx.v1beta1.Service", "BroadcastTx", data); - return promise.then(data => BroadcastTxResponse.decode(new _m0.Reader(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("cosmos.tx.v1beta1.Service", "GetTxsEvent", data); - return promise.then(data => GetTxsEventResponse.decode(new _m0.Reader(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("cosmos.tx.v1beta1.Service", "GetBlockWithTxs", data); - return promise.then(data => GetBlockWithTxsResponse.decode(new _m0.Reader(data))); + return promise.then(data => GetBlockWithTxsResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -74,22 +62,17 @@ export const createRpcQueryExtension = (base: QueryClient) => { simulate(request: SimulateRequest): Promise { return queryService.simulate(request); }, - getTx(request: GetTxRequest): Promise { return queryService.getTx(request); }, - broadcastTx(request: BroadcastTxRequest): Promise { return queryService.broadcastTx(request); }, - getTxsEvent(request: GetTxsEventRequest): Promise { return queryService.getTxsEvent(request); }, - getBlockWithTxs(request: GetBlockWithTxsRequest): Promise { return queryService.getBlockWithTxs(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/tx/v1beta1/service.ts b/src/codegen/cosmos/tx/v1beta1/service.ts index fa01e41..c450ad8 100644 --- a/src/codegen/cosmos/tx/v1beta1/service.ts +++ b/src/codegen/cosmos/tx/v1beta1/service.ts @@ -1,50 +1,33 @@ -import { Tx, TxSDKType } from "./tx"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; -import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; -import { Block, BlockSDKType } from "../../../tendermint/types/block"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Tx, TxAmino, TxSDKType } from "./tx"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { TxResponse, TxResponseAmino, TxResponseSDKType, GasInfo, GasInfoAmino, GasInfoSDKType, Result, ResultAmino, ResultSDKType } from "../../base/abci/v1beta1/abci"; +import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../tendermint/types/types"; +import { Block, BlockAmino, BlockSDKType } from "../../../tendermint/types/block"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** 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, -} -/** OrderBy defines the sorting order */ - -export enum OrderBySDKType { - /** ORDER_BY_UNSPECIFIED - ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. */ - ORDER_BY_UNSPECIFIED = 0, - - /** ORDER_BY_ASC - ORDER_BY_ASC defines ascending order */ - ORDER_BY_ASC = 1, - /** ORDER_BY_DESC - ORDER_BY_DESC defines descending order */ ORDER_BY_DESC = 2, UNRECOGNIZED = -1, } +export const OrderBySDKType = OrderBy; +export const OrderByAmino = OrderBy; export function orderByFromJSON(object: any): OrderBy { switch (object) { case 0: case "ORDER_BY_UNSPECIFIED": return OrderBy.ORDER_BY_UNSPECIFIED; - case 1: case "ORDER_BY_ASC": return OrderBy.ORDER_BY_ASC; - case 2: case "ORDER_BY_DESC": return OrderBy.ORDER_BY_DESC; - case -1: case "UNRECOGNIZED": default: @@ -55,61 +38,29 @@ export function orderByToJSON(object: OrderBy): string { switch (object) { case OrderBy.ORDER_BY_UNSPECIFIED: return "ORDER_BY_UNSPECIFIED"; - case OrderBy.ORDER_BY_ASC: return "ORDER_BY_ASC"; - case OrderBy.ORDER_BY_DESC: return "ORDER_BY_DESC"; - case OrderBy.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. */ - export enum BroadcastMode { /** BROADCAST_MODE_UNSPECIFIED - zero-value for mode ordering */ BROADCAST_MODE_UNSPECIFIED = 0, - /** * BROADCAST_MODE_BLOCK - BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for * the tx to be committed in a block. */ BROADCAST_MODE_BLOCK = 1, - /** * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for * a CheckTx execution response only. */ BROADCAST_MODE_SYNC = 2, - - /** - * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - * immediately. - */ - BROADCAST_MODE_ASYNC = 3, - UNRECOGNIZED = -1, -} -/** BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. */ - -export enum BroadcastModeSDKType { - /** BROADCAST_MODE_UNSPECIFIED - zero-value for mode ordering */ - BROADCAST_MODE_UNSPECIFIED = 0, - - /** - * BROADCAST_MODE_BLOCK - BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for - * the tx to be committed in a block. - */ - BROADCAST_MODE_BLOCK = 1, - - /** - * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - * a CheckTx execution response only. - */ - BROADCAST_MODE_SYNC = 2, - /** * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns * immediately. @@ -117,24 +68,22 @@ export enum BroadcastModeSDKType { BROADCAST_MODE_ASYNC = 3, UNRECOGNIZED = -1, } +export const BroadcastModeSDKType = BroadcastMode; +export const BroadcastModeAmino = BroadcastMode; export function broadcastModeFromJSON(object: any): BroadcastMode { switch (object) { case 0: case "BROADCAST_MODE_UNSPECIFIED": return BroadcastMode.BROADCAST_MODE_UNSPECIFIED; - case 1: case "BROADCAST_MODE_BLOCK": return BroadcastMode.BROADCAST_MODE_BLOCK; - case 2: case "BROADCAST_MODE_SYNC": return BroadcastMode.BROADCAST_MODE_SYNC; - case 3: case "BROADCAST_MODE_ASYNC": return BroadcastMode.BROADCAST_MODE_ASYNC; - case -1: case "UNRECOGNIZED": default: @@ -145,16 +94,12 @@ 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"; @@ -164,107 +109,156 @@ export function broadcastModeToJSON(object: BroadcastMode): string { * GetTxsEventRequest is the request type for the Service.TxsByEvents * RPC method. */ - export interface GetTxsEventRequest { /** events is the list of transaction event type. */ events: string[]; /** pagination defines a pagination for the request. */ - pagination?: PageRequest; orderBy: OrderBy; } +export interface GetTxsEventRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest"; + value: Uint8Array; +} /** * GetTxsEventRequest is the request type for the Service.TxsByEvents * RPC method. */ - -export interface GetTxsEventRequestSDKType { +export interface GetTxsEventRequestAmino { /** events is the list of transaction event type. */ - events: string[]; + events?: string[]; /** pagination defines a pagination for the request. */ - + pagination?: PageRequestAmino; + order_by?: OrderBy; +} +export interface GetTxsEventRequestAminoMsg { + type: "cosmos-sdk/GetTxsEventRequest"; + value: GetTxsEventRequestAmino; +} +/** + * GetTxsEventRequest is the request type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventRequestSDKType { + events: string[]; pagination?: PageRequestSDKType; - order_by: OrderBySDKType; + order_by: OrderBy; } /** * GetTxsEventResponse is the response type for the Service.TxsByEvents * RPC method. */ - export interface GetTxsEventResponse { /** txs is the list of queried transactions. */ txs: Tx[]; /** tx_responses is the list of queried TxResponses. */ - txResponses: TxResponse[]; /** pagination defines a pagination for the response. */ - pagination?: PageResponse; } +export interface GetTxsEventResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse"; + value: Uint8Array; +} /** * GetTxsEventResponse is the response type for the Service.TxsByEvents * RPC method. */ - -export interface GetTxsEventResponseSDKType { +export interface GetTxsEventResponseAmino { /** txs is the list of queried transactions. */ - txs: TxSDKType[]; + txs?: TxAmino[]; /** tx_responses is the list of queried TxResponses. */ - - tx_responses: TxResponseSDKType[]; + tx_responses?: TxResponseAmino[]; /** pagination defines a pagination for the response. */ - + pagination?: PageResponseAmino; +} +export interface GetTxsEventResponseAminoMsg { + type: "cosmos-sdk/GetTxsEventResponse"; + value: GetTxsEventResponseAmino; +} +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponseSDKType { + txs: TxSDKType[]; + tx_responses: TxResponseSDKType[]; pagination?: PageResponseSDKType; } /** * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest * RPC method. */ - export interface BroadcastTxRequest { /** tx_bytes is the raw transaction. */ txBytes: Uint8Array; mode: BroadcastMode; } +export interface BroadcastTxRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest"; + value: Uint8Array; +} /** * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest * RPC method. */ - -export interface BroadcastTxRequestSDKType { +export interface BroadcastTxRequestAmino { /** tx_bytes is the raw transaction. */ + tx_bytes?: string; + mode?: BroadcastMode; +} +export interface BroadcastTxRequestAminoMsg { + type: "cosmos-sdk/BroadcastTxRequest"; + value: BroadcastTxRequestAmino; +} +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequestSDKType { tx_bytes: Uint8Array; - mode: BroadcastModeSDKType; + mode: BroadcastMode; } /** * BroadcastTxResponse is the response type for the * Service.BroadcastTx method. */ - export interface BroadcastTxResponse { /** tx_response is the queried TxResponses. */ txResponse?: TxResponse; } +export interface BroadcastTxResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse"; + value: Uint8Array; +} /** * BroadcastTxResponse is the response type for the * Service.BroadcastTx method. */ - -export interface BroadcastTxResponseSDKType { +export interface BroadcastTxResponseAmino { /** tx_response is the queried TxResponses. */ + tx_response?: TxResponseAmino; +} +export interface BroadcastTxResponseAminoMsg { + type: "cosmos-sdk/BroadcastTxResponse"; + value: BroadcastTxResponseAmino; +} +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponseSDKType { tx_response?: TxResponseSDKType; } /** * 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; /** @@ -272,88 +266,135 @@ export interface SimulateRequest { * * Since: cosmos-sdk 0.43 */ - txBytes: Uint8Array; } +export interface SimulateRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest"; + value: Uint8Array; +} /** * SimulateRequest is the request type for the Service.Simulate * RPC method. */ - -export interface SimulateRequestSDKType { +export interface SimulateRequestAmino { /** * tx is the transaction to simulate. * Deprecated. Send raw tx bytes instead. */ - /** @deprecated */ - tx?: TxSDKType; + tx?: TxAmino; /** * tx_bytes is the raw transaction. * * Since: cosmos-sdk 0.43 */ - + tx_bytes?: string; +} +export interface SimulateRequestAminoMsg { + type: "cosmos-sdk/SimulateRequest"; + value: SimulateRequestAmino; +} +/** + * SimulateRequest is the request type for the Service.Simulate + * RPC method. + */ +export interface SimulateRequestSDKType { + /** @deprecated */ + tx?: TxSDKType; tx_bytes: Uint8Array; } /** * SimulateResponse is the response type for the * Service.SimulateRPC method. */ - export interface SimulateResponse { /** gas_info is the information about gas used in the simulation. */ gasInfo?: GasInfo; /** result is the result of the simulation. */ - result?: Result; } +export interface SimulateResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse"; + value: Uint8Array; +} /** * SimulateResponse is the response type for the * Service.SimulateRPC method. */ - -export interface SimulateResponseSDKType { +export interface SimulateResponseAmino { /** gas_info is the information about gas used in the simulation. */ - gas_info?: GasInfoSDKType; + gas_info?: GasInfoAmino; /** result is the result of the simulation. */ - + result?: ResultAmino; +} +export interface SimulateResponseAminoMsg { + type: "cosmos-sdk/SimulateResponse"; + value: SimulateResponseAmino; +} +/** + * SimulateResponse is the response type for the + * Service.SimulateRPC method. + */ +export interface SimulateResponseSDKType { + gas_info?: GasInfoSDKType; result?: ResultSDKType; } /** * GetTxRequest is the request type for the Service.GetTx * RPC method. */ - export interface GetTxRequest { /** hash is the tx hash to query, encoded as a hex string. */ hash: string; } +export interface GetTxRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest"; + value: Uint8Array; +} /** * GetTxRequest is the request type for the Service.GetTx * RPC method. */ - -export interface GetTxRequestSDKType { +export interface GetTxRequestAmino { /** hash is the tx hash to query, encoded as a hex string. */ + hash?: string; +} +export interface GetTxRequestAminoMsg { + type: "cosmos-sdk/GetTxRequest"; + value: GetTxRequestAmino; +} +/** + * GetTxRequest is the request type for the Service.GetTx + * RPC method. + */ +export interface GetTxRequestSDKType { hash: string; } /** GetTxResponse is the response type for the Service.GetTx method. */ - export interface GetTxResponse { /** tx is the queried transaction. */ tx?: Tx; /** tx_response is the queried TxResponses. */ - txResponse?: TxResponse; } +export interface GetTxResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse"; + value: Uint8Array; +} /** GetTxResponse is the response type for the Service.GetTx method. */ - -export interface GetTxResponseSDKType { +export interface GetTxResponseAmino { /** tx is the queried transaction. */ - tx?: TxSDKType; + tx?: TxAmino; /** tx_response is the queried TxResponses. */ - + tx_response?: TxResponseAmino; +} +export interface GetTxResponseAminoMsg { + type: "cosmos-sdk/GetTxResponse"; + value: GetTxResponseAmino; +} +/** GetTxResponse is the response type for the Service.GetTx method. */ +export interface GetTxResponseSDKType { + tx?: TxSDKType; tx_response?: TxResponseSDKType; } /** @@ -362,26 +403,40 @@ export interface GetTxResponseSDKType { * * Since: cosmos-sdk 0.45.2 */ - export interface GetBlockWithTxsRequest { /** height is the height of the block to query. */ - height: Long; + height: bigint; /** pagination defines a pagination for the request. */ - pagination?: PageRequest; } +export interface GetBlockWithTxsRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest"; + value: Uint8Array; +} /** * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs * RPC method. * * Since: cosmos-sdk 0.45.2 */ - -export interface GetBlockWithTxsRequestSDKType { +export interface GetBlockWithTxsRequestAmino { /** height is the height of the block to query. */ - height: Long; + height?: string; /** pagination defines a pagination for the request. */ - + pagination?: PageRequestAmino; +} +export interface GetBlockWithTxsRequestAminoMsg { + type: "cosmos-sdk/GetBlockWithTxsRequest"; + value: GetBlockWithTxsRequestAmino; +} +/** + * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs + * RPC method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsRequestSDKType { + height: bigint; pagination?: PageRequestSDKType; } /** @@ -389,32 +444,46 @@ export interface GetBlockWithTxsRequestSDKType { * * Since: cosmos-sdk 0.45.2 */ - export interface GetBlockWithTxsResponse { /** txs are the transactions in the block. */ txs: Tx[]; blockId?: BlockID; block?: Block; /** pagination defines a pagination for the response. */ - pagination?: PageResponse; } +export interface GetBlockWithTxsResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse"; + value: Uint8Array; +} /** * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. * * Since: cosmos-sdk 0.45.2 */ - -export interface GetBlockWithTxsResponseSDKType { +export interface GetBlockWithTxsResponseAmino { /** txs are the transactions in the block. */ + txs?: TxAmino[]; + block_id?: BlockIDAmino; + block?: BlockAmino; + /** pagination defines a pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface GetBlockWithTxsResponseAminoMsg { + type: "cosmos-sdk/GetBlockWithTxsResponse"; + value: GetBlockWithTxsResponseAmino; +} +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponseSDKType { txs: TxSDKType[]; block_id?: BlockIDSDKType; block?: BlockSDKType; - /** pagination defines a pagination for the response. */ - pagination?: PageResponseSDKType; } - function createBaseGetTxsEventRequest(): GetTxsEventRequest { return { events: [], @@ -422,64 +491,94 @@ function createBaseGetTxsEventRequest(): GetTxsEventRequest { orderBy: 0 }; } - export const GetTxsEventRequest = { - encode(message: GetTxsEventRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", + encode(message: GetTxsEventRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.events) { writer.uint32(10).string(v!); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - if (message.orderBy !== 0) { writer.uint32(24).int32(message.orderBy); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetTxsEventRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetTxsEventRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.events.push(reader.string()); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - case 3: message.orderBy = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetTxsEventRequest { + fromPartial(object: Partial): 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; return message; + }, + fromAmino(object: GetTxsEventRequestAmino): GetTxsEventRequest { + const message = createBaseGetTxsEventRequest(); + message.events = object.events?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + if (object.order_by !== undefined && object.order_by !== null) { + message.orderBy = orderByFromJSON(object.order_by); + } + return message; + }, + toAmino(message: GetTxsEventRequest): GetTxsEventRequestAmino { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map(e => e); + } else { + obj.events = []; + } + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + obj.order_by = orderByToJSON(message.orderBy); + return obj; + }, + fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { + return GetTxsEventRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetTxsEventRequest): GetTxsEventRequestAminoMsg { + return { + type: "cosmos-sdk/GetTxsEventRequest", + value: GetTxsEventRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxsEventRequestProtoMsg): GetTxsEventRequest { + return GetTxsEventRequest.decode(message.value); + }, + toProto(message: GetTxsEventRequest): Uint8Array { + return GetTxsEventRequest.encode(message).finish(); + }, + toProtoMsg(message: GetTxsEventRequest): GetTxsEventRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", + value: GetTxsEventRequest.encode(message).finish() + }; } - }; - function createBaseGetTxsEventResponse(): GetTxsEventResponse { return { txs: [], @@ -487,429 +586,639 @@ function createBaseGetTxsEventResponse(): GetTxsEventResponse { pagination: undefined }; } - export const GetTxsEventResponse = { - encode(message: GetTxsEventResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", + encode(message: GetTxsEventResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { Tx.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.txResponses) { TxResponse.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetTxsEventResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetTxsEventResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.txs.push(Tx.decode(reader, reader.uint32())); break; - case 2: message.txResponses.push(TxResponse.decode(reader, reader.uint32())); break; - case 3: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetTxsEventResponse { + fromPartial(object: Partial): 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; return message; + }, + fromAmino(object: GetTxsEventResponseAmino): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map(e => Tx.fromAmino(e)) || []; + message.txResponses = object.tx_responses?.map(e => TxResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetTxsEventResponse): GetTxsEventResponseAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); + } else { + obj.txs = []; + } + if (message.txResponses) { + obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e) : undefined); + } else { + obj.tx_responses = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetTxsEventResponseAminoMsg): GetTxsEventResponse { + return GetTxsEventResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetTxsEventResponse): GetTxsEventResponseAminoMsg { + return { + type: "cosmos-sdk/GetTxsEventResponse", + value: GetTxsEventResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxsEventResponseProtoMsg): GetTxsEventResponse { + return GetTxsEventResponse.decode(message.value); + }, + toProto(message: GetTxsEventResponse): Uint8Array { + return GetTxsEventResponse.encode(message).finish(); + }, + toProtoMsg(message: GetTxsEventResponse): GetTxsEventResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", + value: GetTxsEventResponse.encode(message).finish() + }; } - }; - function createBaseBroadcastTxRequest(): BroadcastTxRequest { return { txBytes: new Uint8Array(), mode: 0 }; } - export const BroadcastTxRequest = { - encode(message: BroadcastTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", + encode(message: BroadcastTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txBytes.length !== 0) { writer.uint32(10).bytes(message.txBytes); } - if (message.mode !== 0) { writer.uint32(16).int32(message.mode); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BroadcastTxRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBroadcastTxRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.txBytes = reader.bytes(); break; - case 2: message.mode = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BroadcastTxRequest { + fromPartial(object: Partial): BroadcastTxRequest { const message = createBaseBroadcastTxRequest(); message.txBytes = object.txBytes ?? new Uint8Array(); message.mode = object.mode ?? 0; return message; + }, + fromAmino(object: BroadcastTxRequestAmino): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + if (object.mode !== undefined && object.mode !== null) { + message.mode = broadcastModeFromJSON(object.mode); + } + return message; + }, + toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + obj.mode = broadcastModeToJSON(message.mode); + return obj; + }, + fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { + return BroadcastTxRequest.fromAmino(object.value); + }, + toAminoMsg(message: BroadcastTxRequest): BroadcastTxRequestAminoMsg { + return { + type: "cosmos-sdk/BroadcastTxRequest", + value: BroadcastTxRequest.toAmino(message) + }; + }, + fromProtoMsg(message: BroadcastTxRequestProtoMsg): BroadcastTxRequest { + return BroadcastTxRequest.decode(message.value); + }, + toProto(message: BroadcastTxRequest): Uint8Array { + return BroadcastTxRequest.encode(message).finish(); + }, + toProtoMsg(message: BroadcastTxRequest): BroadcastTxRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", + value: BroadcastTxRequest.encode(message).finish() + }; } - }; - function createBaseBroadcastTxResponse(): BroadcastTxResponse { return { txResponse: undefined }; } - export const BroadcastTxResponse = { - encode(message: BroadcastTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", + encode(message: BroadcastTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txResponse !== undefined) { TxResponse.encode(message.txResponse, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BroadcastTxResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBroadcastTxResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.txResponse = TxResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BroadcastTxResponse { + fromPartial(object: Partial): BroadcastTxResponse { const message = createBaseBroadcastTxResponse(); message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; return message; + }, + fromAmino(object: BroadcastTxResponseAmino): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + if (object.tx_response !== undefined && object.tx_response !== null) { + message.txResponse = TxResponse.fromAmino(object.tx_response); + } + return message; + }, + toAmino(message: BroadcastTxResponse): BroadcastTxResponseAmino { + const obj: any = {}; + obj.tx_response = message.txResponse ? TxResponse.toAmino(message.txResponse) : undefined; + return obj; + }, + fromAminoMsg(object: BroadcastTxResponseAminoMsg): BroadcastTxResponse { + return BroadcastTxResponse.fromAmino(object.value); + }, + toAminoMsg(message: BroadcastTxResponse): BroadcastTxResponseAminoMsg { + return { + type: "cosmos-sdk/BroadcastTxResponse", + value: BroadcastTxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: BroadcastTxResponseProtoMsg): BroadcastTxResponse { + return BroadcastTxResponse.decode(message.value); + }, + toProto(message: BroadcastTxResponse): Uint8Array { + return BroadcastTxResponse.encode(message).finish(); + }, + toProtoMsg(message: BroadcastTxResponse): BroadcastTxResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", + value: BroadcastTxResponse.encode(message).finish() + }; } - }; - function createBaseSimulateRequest(): SimulateRequest { return { tx: undefined, txBytes: new Uint8Array() }; } - export const SimulateRequest = { - encode(message: SimulateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", + encode(message: SimulateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); } - if (message.txBytes.length !== 0) { writer.uint32(18).bytes(message.txBytes); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SimulateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSimulateRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.tx = Tx.decode(reader, reader.uint32()); break; - case 2: message.txBytes = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SimulateRequest { + fromPartial(object: Partial): SimulateRequest { const message = createBaseSimulateRequest(); message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; message.txBytes = object.txBytes ?? new Uint8Array(); return message; + }, + fromAmino(object: SimulateRequestAmino): SimulateRequest { + const message = createBaseSimulateRequest(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: SimulateRequest): SimulateRequestAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: SimulateRequestAminoMsg): SimulateRequest { + return SimulateRequest.fromAmino(object.value); + }, + toAminoMsg(message: SimulateRequest): SimulateRequestAminoMsg { + return { + type: "cosmos-sdk/SimulateRequest", + value: SimulateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: SimulateRequestProtoMsg): SimulateRequest { + return SimulateRequest.decode(message.value); + }, + toProto(message: SimulateRequest): Uint8Array { + return SimulateRequest.encode(message).finish(); + }, + toProtoMsg(message: SimulateRequest): SimulateRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", + value: SimulateRequest.encode(message).finish() + }; } - }; - function createBaseSimulateResponse(): SimulateResponse { return { gasInfo: undefined, result: undefined }; } - export const SimulateResponse = { - encode(message: SimulateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", + encode(message: SimulateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasInfo !== undefined) { GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); } - if (message.result !== undefined) { Result.encode(message.result, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SimulateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSimulateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.gasInfo = GasInfo.decode(reader, reader.uint32()); break; - case 2: message.result = Result.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SimulateResponse { + fromPartial(object: Partial): SimulateResponse { const message = createBaseSimulateResponse(); message.gasInfo = object.gasInfo !== undefined && object.gasInfo !== null ? GasInfo.fromPartial(object.gasInfo) : undefined; message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined; return message; + }, + fromAmino(object: SimulateResponseAmino): SimulateResponse { + const message = createBaseSimulateResponse(); + if (object.gas_info !== undefined && object.gas_info !== null) { + message.gasInfo = GasInfo.fromAmino(object.gas_info); + } + if (object.result !== undefined && object.result !== null) { + message.result = Result.fromAmino(object.result); + } + return message; + }, + toAmino(message: SimulateResponse): SimulateResponseAmino { + const obj: any = {}; + obj.gas_info = message.gasInfo ? GasInfo.toAmino(message.gasInfo) : undefined; + obj.result = message.result ? Result.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: SimulateResponseAminoMsg): SimulateResponse { + return SimulateResponse.fromAmino(object.value); + }, + toAminoMsg(message: SimulateResponse): SimulateResponseAminoMsg { + return { + type: "cosmos-sdk/SimulateResponse", + value: SimulateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: SimulateResponseProtoMsg): SimulateResponse { + return SimulateResponse.decode(message.value); + }, + toProto(message: SimulateResponse): Uint8Array { + return SimulateResponse.encode(message).finish(); + }, + toProtoMsg(message: SimulateResponse): SimulateResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", + value: SimulateResponse.encode(message).finish() + }; } - }; - function createBaseGetTxRequest(): GetTxRequest { return { hash: "" }; } - export const GetTxRequest = { - encode(message: GetTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", + encode(message: GetTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== "") { writer.uint32(10).string(message.hash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetTxRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetTxRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetTxRequest { + fromPartial(object: Partial): GetTxRequest { const message = createBaseGetTxRequest(); message.hash = object.hash ?? ""; return message; + }, + fromAmino(object: GetTxRequestAmino): GetTxRequest { + const message = createBaseGetTxRequest(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + return message; + }, + toAmino(message: GetTxRequest): GetTxRequestAmino { + const obj: any = {}; + obj.hash = message.hash; + return obj; + }, + fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { + return GetTxRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetTxRequest): GetTxRequestAminoMsg { + return { + type: "cosmos-sdk/GetTxRequest", + value: GetTxRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxRequestProtoMsg): GetTxRequest { + return GetTxRequest.decode(message.value); + }, + toProto(message: GetTxRequest): Uint8Array { + return GetTxRequest.encode(message).finish(); + }, + toProtoMsg(message: GetTxRequest): GetTxRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", + value: GetTxRequest.encode(message).finish() + }; } - }; - function createBaseGetTxResponse(): GetTxResponse { return { tx: undefined, txResponse: undefined }; } - export const GetTxResponse = { - encode(message: GetTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", + encode(message: GetTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); } - if (message.txResponse !== undefined) { TxResponse.encode(message.txResponse, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetTxResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetTxResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.tx = Tx.decode(reader, reader.uint32()); break; - case 2: message.txResponse = TxResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetTxResponse { + fromPartial(object: Partial): GetTxResponse { const message = createBaseGetTxResponse(); message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; return message; + }, + fromAmino(object: GetTxResponseAmino): GetTxResponse { + const message = createBaseGetTxResponse(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + if (object.tx_response !== undefined && object.tx_response !== null) { + message.txResponse = TxResponse.fromAmino(object.tx_response); + } + return message; + }, + toAmino(message: GetTxResponse): GetTxResponseAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + obj.tx_response = message.txResponse ? TxResponse.toAmino(message.txResponse) : undefined; + return obj; + }, + fromAminoMsg(object: GetTxResponseAminoMsg): GetTxResponse { + return GetTxResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetTxResponse): GetTxResponseAminoMsg { + return { + type: "cosmos-sdk/GetTxResponse", + value: GetTxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxResponseProtoMsg): GetTxResponse { + return GetTxResponse.decode(message.value); + }, + toProto(message: GetTxResponse): Uint8Array { + return GetTxResponse.encode(message).finish(); + }, + toProtoMsg(message: GetTxResponse): GetTxResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", + value: GetTxResponse.encode(message).finish() + }; } - }; - function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { return { - height: Long.ZERO, + height: BigInt(0), pagination: undefined }; } - export const GetBlockWithTxsRequest = { - encode(message: GetBlockWithTxsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockWithTxsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetBlockWithTxsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetBlockWithTxsRequest { + fromPartial(object: Partial): GetBlockWithTxsRequest { const message = createBaseGetBlockWithTxsRequest(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: GetBlockWithTxsRequestAmino): GetBlockWithTxsRequest { + const message = createBaseGetBlockWithTxsRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetBlockWithTxsRequestAminoMsg): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAminoMsg { + return { + type: "cosmos-sdk/GetBlockWithTxsRequest", + value: GetBlockWithTxsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetBlockWithTxsRequestProtoMsg): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.decode(message.value); + }, + toProto(message: GetBlockWithTxsRequest): Uint8Array { + return GetBlockWithTxsRequest.encode(message).finish(); + }, + toProtoMsg(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", + value: GetBlockWithTxsRequest.encode(message).finish() + }; } - }; - function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { return { txs: [], @@ -918,69 +1227,102 @@ function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { pagination: undefined }; } - export const GetBlockWithTxsResponse = { - encode(message: GetBlockWithTxsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { Tx.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(18).fork()).ldelim(); } - if (message.block !== undefined) { Block.encode(message.block, writer.uint32(26).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockWithTxsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetBlockWithTxsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.txs.push(Tx.decode(reader, reader.uint32())); break; - case 2: message.blockId = BlockID.decode(reader, reader.uint32()); break; - case 3: message.block = Block.decode(reader, reader.uint32()); break; - case 4: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GetBlockWithTxsResponse { + fromPartial(object: Partial): GetBlockWithTxsResponse { const message = createBaseGetBlockWithTxsResponse(); message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: GetBlockWithTxsResponseAmino): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map(e => Tx.fromAmino(e)) || []; + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.block !== undefined && object.block !== null) { + message.block = Block.fromAmino(object.block); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); + } else { + obj.txs = []; + } + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.block = message.block ? Block.toAmino(message.block) : undefined; + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetBlockWithTxsResponseAminoMsg): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseAminoMsg { + return { + type: "cosmos-sdk/GetBlockWithTxsResponse", + value: GetBlockWithTxsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetBlockWithTxsResponseProtoMsg): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.decode(message.value); + }, + toProto(message: GetBlockWithTxsResponse): Uint8Array { + return GetBlockWithTxsResponse.encode(message).finish(); + }, + toProtoMsg(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", + value: GetBlockWithTxsResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/tx/v1beta1/tx.ts b/src/codegen/cosmos/tx/v1beta1/tx.ts index 6d51079..6645adc 100644 --- a/src/codegen/cosmos/tx/v1beta1/tx.ts +++ b/src/codegen/cosmos/tx/v1beta1/tx.ts @@ -1,11 +1,10 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { SignMode, SignModeSDKType } from "../signing/v1beta1/signing"; -import { CompactBitArray, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { SignMode, signModeFromJSON, signModeToJSON } from "../signing/v1beta1/signing"; +import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** Tx is the standard type used for broadcasting transactions. */ - export interface Tx { /** body is the processable content of the transaction */ body?: TxBody; @@ -13,33 +12,42 @@ export interface Tx { * auth_info is the authorization related content of the transaction, * specifically signers, signer modes and fee */ - authInfo?: AuthInfo; /** * signatures is a list of signatures that matches the length and order of * AuthInfo's signer_infos to allow connecting signature meta information like * public key and signing mode by position. */ - signatures: Uint8Array[]; } +export interface TxProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Tx"; + value: Uint8Array; +} /** Tx is the standard type used for broadcasting transactions. */ - -export interface TxSDKType { +export interface TxAmino { /** body is the processable content of the transaction */ - body?: TxBodySDKType; + body?: TxBodyAmino; /** * auth_info is the authorization related content of the transaction, * specifically signers, signer modes and fee */ - - auth_info?: AuthInfoSDKType; + auth_info?: AuthInfoAmino; /** * signatures is a list of signatures that matches the length and order of * AuthInfo's signer_infos to allow connecting signature meta information like * public key and signing mode by position. */ - + signatures?: string[]; +} +export interface TxAminoMsg { + type: "cosmos-sdk/Tx"; + value: TxAmino; +} +/** Tx is the standard type used for broadcasting transactions. */ +export interface TxSDKType { + body?: TxBodySDKType; + auth_info?: AuthInfoSDKType; signatures: Uint8Array[]; } /** @@ -49,7 +57,6 @@ export interface TxSDKType { * 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 @@ -60,16 +67,18 @@ export interface TxRaw { * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the * representation in SignDoc. */ - authInfoBytes: Uint8Array; /** * signatures is a list of signatures that matches the length and order of * AuthInfo's signer_infos to allow connecting signature meta information like * public key and signing mode by position. */ - signatures: Uint8Array[]; } +export interface TxRawProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxRaw"; + value: Uint8Array; +} /** * TxRaw is a variant of Tx that pins the signer's exact binary representation * of body and auth_info. This is used for signing, broadcasting and @@ -77,29 +86,41 @@ export interface TxRaw { * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used * as the transaction ID. */ - -export interface TxRawSDKType { +export interface TxRawAmino { /** * body_bytes is a protobuf serialization of a TxBody that matches the * representation in SignDoc. */ - body_bytes: Uint8Array; + body_bytes?: string; /** * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the * representation in SignDoc. */ - - auth_info_bytes: Uint8Array; + auth_info_bytes?: string; /** * signatures is a list of signatures that matches the length and order of * AuthInfo's signer_infos to allow connecting signature meta information like * public key and signing mode by position. */ - + signatures?: string[]; +} +export interface TxRawAminoMsg { + type: "cosmos-sdk/TxRaw"; + value: TxRawAmino; +} +/** + * 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 TxRawSDKType { + body_bytes: Uint8Array; + auth_info_bytes: Uint8Array; 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 @@ -110,43 +131,51 @@ export interface SignDoc { * 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: Long; + accountNumber: bigint; +} +export interface SignDocProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignDoc"; + value: Uint8Array; } /** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ - -export interface SignDocSDKType { +export interface SignDocAmino { /** * body_bytes is protobuf serialization of a TxBody that matches the * representation in TxRaw. */ - body_bytes: Uint8Array; + body_bytes?: string; /** * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the * representation in TxRaw. */ - - auth_info_bytes: Uint8Array; + auth_info_bytes?: string; /** * chain_id is the unique identifier of the chain this transaction targets. * It prevents signed transactions from being used on another chain by an * attacker */ - - chain_id: string; + chain_id?: string; /** account_number is the account number of the account in state */ - - account_number: Long; + account_number?: string; +} +export interface SignDocAminoMsg { + type: "cosmos-sdk/SignDoc"; + value: SignDocAmino; +} +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDocSDKType { + body_bytes: Uint8Array; + auth_info_bytes: Uint8Array; + chain_id: string; + account_number: bigint; } /** * SignDocDirectAux is the type used for generating sign bytes for @@ -154,7 +183,6 @@ export interface SignDocSDKType { * * Since: cosmos-sdk 0.46 */ - export interface SignDocDirectAux { /** * body_bytes is protobuf serialization of a TxBody that matches the @@ -162,66 +190,76 @@ export interface SignDocDirectAux { */ bodyBytes: Uint8Array; /** public_key is the public key of the signing account. */ - publicKey?: Any; /** * chain_id is the identifier of the chain this transaction targets. * It prevents signed transactions from being used on another chain by an * attacker. */ - chainId: string; /** account_number is the account number of the account in state. */ - - accountNumber: Long; + accountNumber: bigint; /** sequence is the sequence number of the signing account. */ - - sequence: Long; + sequence: bigint; /** * Tip is the optional tip used for meta-transactions. It should be left * empty if the signer is not the tipper for this transaction. */ - tip?: Tip; } +export interface SignDocDirectAuxProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux"; + value: Uint8Array; +} /** * SignDocDirectAux is the type used for generating sign bytes for * SIGN_MODE_DIRECT_AUX. * * Since: cosmos-sdk 0.46 */ - -export interface SignDocDirectAuxSDKType { +export interface SignDocDirectAuxAmino { /** * body_bytes is protobuf serialization of a TxBody that matches the * representation in TxRaw. */ - body_bytes: Uint8Array; + body_bytes?: string; /** public_key is the public key of the signing account. */ - - public_key?: AnySDKType; + public_key?: AnyAmino; /** * chain_id is the identifier of the chain this transaction targets. * It prevents signed transactions from being used on another chain by an * attacker. */ - - chain_id: string; + chain_id?: string; /** account_number is the account number of the account in state. */ - - account_number: Long; + account_number?: string; /** sequence is the sequence number of the signing account. */ - - sequence: Long; + sequence?: string; /** * Tip is the optional tip used for meta-transactions. It should be left * empty if the signer is not the tipper for this transaction. */ - + tip?: TipAmino; +} +export interface SignDocDirectAuxAminoMsg { + type: "cosmos-sdk/SignDocDirectAux"; + value: SignDocDirectAuxAmino; +} +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAuxSDKType { + body_bytes: Uint8Array; + public_key?: AnySDKType; + chain_id: string; + account_number: bigint; + sequence: bigint; tip?: TipSDKType; } /** 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 @@ -238,32 +276,31 @@ export interface TxBody { * 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: Long; + timeoutHeight: bigint; /** * extension_options are arbitrary options that can be added by chains * when the default options are not sufficient. If any of these are present * and can't be handled, the transaction will be rejected */ - extensionOptions: Any[]; /** * extension_options are arbitrary options that can be added by chains * when the default options are not sufficient. If any of these are present * and can't be handled, they will be ignored */ - nonCriticalExtensionOptions: Any[]; } +export interface TxBodyProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxBody"; + value: Uint8Array; +} /** TxBody is the body of a transaction that all signers sign over. */ - -export interface TxBodySDKType { +export interface TxBodyAmino { /** * messages is a list of messages to be executed. The required signers of * those messages define the number and order of elements in AuthInfo's @@ -273,40 +310,47 @@ export interface TxBodySDKType { * is referred to as the primary signer and pays the fee for the whole * transaction. */ - messages: AnySDKType[]; + messages?: AnyAmino[]; /** * memo is any arbitrary note/comment to be added to the transaction. * WARNING: in clients, any publicly exposed text should not be called memo, * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). */ - - memo: string; + memo?: string; /** * timeout is the block height after which this transaction will not * be processed by the chain */ - - timeout_height: Long; + timeout_height?: string; /** * extension_options are arbitrary options that can be added by chains * when the default options are not sufficient. If any of these are present * and can't be handled, the transaction will be rejected */ - - extension_options: AnySDKType[]; + extension_options?: AnyAmino[]; /** * extension_options are arbitrary options that can be added by chains * when the default options are not sufficient. If any of these are present * and can't be handled, they will be ignored */ - + non_critical_extension_options?: AnyAmino[]; +} +export interface TxBodyAminoMsg { + type: "cosmos-sdk/TxBody"; + value: TxBodyAmino; +} +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBodySDKType { + messages: AnySDKType[]; + memo: string; + timeout_height: bigint; + extension_options: AnySDKType[]; non_critical_extension_options: AnySDKType[]; } /** * 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 @@ -321,50 +365,61 @@ export interface AuthInfo { * based on the cost of evaluating the body and doing signature verification * of the signers. This can be estimated via simulation. */ - fee?: Fee; /** * Tip is the optional tip used for meta-transactions. * * Since: cosmos-sdk 0.46 */ - tip?: Tip; } +export interface AuthInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo"; + value: Uint8Array; +} /** * AuthInfo describes the fee and signer modes that are used to sign a * transaction. */ - -export interface AuthInfoSDKType { +export interface AuthInfoAmino { /** * signer_infos defines the signing modes for the required signers. The number * and order of elements must match the required signers from TxBody's * messages. The first element is the primary signer and the one which pays * the fee. */ - signer_infos: SignerInfoSDKType[]; + signer_infos?: SignerInfoAmino[]; /** * Fee is the fee and gas limit for the transaction. The first signer is the * primary signer and the one which pays the fee. The fee can be calculated * based on the cost of evaluating the body and doing signature verification * of the signers. This can be estimated via simulation. */ - - fee?: FeeSDKType; + fee?: FeeAmino; /** * Tip is the optional tip used for meta-transactions. * * Since: cosmos-sdk 0.46 */ - + tip?: TipAmino; +} +export interface AuthInfoAminoMsg { + type: "cosmos-sdk/AuthInfo"; + value: AuthInfoAmino; +} +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfoSDKType { + signer_infos: SignerInfoSDKType[]; + fee?: FeeSDKType; tip?: TipSDKType; } /** * 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 @@ -376,58 +431,79 @@ export interface SignerInfo { * mode_info describes the signing mode of the signer and is a nested * structure to support nested multisig pubkey's */ - modeInfo?: ModeInfo; /** * sequence is the sequence of the account, which describes the * number of committed transactions signed by a given address. It is used to * prevent replay attacks. */ - - sequence: Long; + sequence: bigint; +} +export interface SignerInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo"; + value: Uint8Array; } /** * SignerInfo describes the public key and signing mode of a single top-level * signer. */ - -export interface SignerInfoSDKType { +export interface SignerInfoAmino { /** * public_key is the public key of the signer. It is optional for accounts * that already exist in state. If unset, the verifier can use the required \ * signer address for this position and lookup the public key. */ - public_key?: AnySDKType; + public_key?: AnyAmino; /** * mode_info describes the signing mode of the signer and is a nested * structure to support nested multisig pubkey's */ - - mode_info?: ModeInfoSDKType; + mode_info?: ModeInfoAmino; /** * sequence is the sequence of the account, which describes the * number of committed transactions signed by a given address. It is used to * prevent replay attacks. */ - - sequence: Long; + sequence?: string; +} +export interface SignerInfoAminoMsg { + type: "cosmos-sdk/SignerInfo"; + value: SignerInfoAmino; +} +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfoSDKType { + public_key?: AnySDKType; + mode_info?: ModeInfoSDKType; + sequence: bigint; } /** ModeInfo describes the signing mode of a single or nested multisig signer. */ - export interface ModeInfo { /** single represents a single signer */ single?: ModeInfo_Single; /** multi represents a nested multisig signer */ - multi?: ModeInfo_Multi; } +export interface ModeInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo"; + value: Uint8Array; +} /** ModeInfo describes the signing mode of a single or nested multisig signer. */ - -export interface ModeInfoSDKType { +export interface ModeInfoAmino { /** single represents a single signer */ - single?: ModeInfo_SingleSDKType; + single?: ModeInfo_SingleAmino; /** multi represents a nested multisig signer */ - + multi?: ModeInfo_MultiAmino; +} +export interface ModeInfoAminoMsg { + type: "cosmos-sdk/ModeInfo"; + value: ModeInfoAmino; +} +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ +export interface ModeInfoSDKType { + single?: ModeInfo_SingleSDKType; multi?: ModeInfo_MultiSDKType; } /** @@ -435,23 +511,36 @@ export interface ModeInfoSDKType { * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the * future */ - export interface ModeInfo_Single { /** mode is the signing mode of the single signer */ mode: SignMode; } +export interface ModeInfo_SingleProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Single"; + value: Uint8Array; +} /** * Single is the mode info for a single signer. It is structured as a message * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the * future */ - -export interface ModeInfo_SingleSDKType { +export interface ModeInfo_SingleAmino { /** mode is the signing mode of the single signer */ - mode: SignModeSDKType; + mode?: SignMode; +} +export interface ModeInfo_SingleAminoMsg { + type: "cosmos-sdk/Single"; + value: ModeInfo_SingleAmino; +} +/** + * 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_SingleSDKType { + 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; @@ -459,19 +548,29 @@ export interface ModeInfo_Multi { * mode_infos is the corresponding modes of the signers of the multisig * which could include nested multisig public keys */ - modeInfos: ModeInfo[]; } +export interface ModeInfo_MultiProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Multi"; + value: Uint8Array; +} /** Multi is the mode info for a multisig public key */ - -export interface ModeInfo_MultiSDKType { +export interface ModeInfo_MultiAmino { /** bitarray specifies which keys within the multisig are signing */ - bitarray?: CompactBitArraySDKType; + bitarray?: CompactBitArrayAmino; /** * mode_infos is the corresponding modes of the signers of the multisig * which could include nested multisig public keys */ - + mode_infos?: ModeInfoAmino[]; +} +export interface ModeInfo_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: ModeInfo_MultiAmino; +} +/** Multi is the mode info for a multisig public key */ +export interface ModeInfo_MultiSDKType { + bitarray?: CompactBitArraySDKType; mode_infos: ModeInfoSDKType[]; } /** @@ -479,7 +578,6 @@ export interface ModeInfo_MultiSDKType { * 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[]; @@ -487,51 +585,63 @@ export interface Fee { * gas_limit is the maximum gas that can be used in transaction processing * before an out of gas error occurs */ - - gasLimit: Long; + gasLimit: bigint; /** * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. * the payer must be a tx signer (and thus have signed this field in AuthInfo). * setting this field does *not* change the ordering of required signers for the transaction. */ - payer: string; /** * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does * not support fee grants, this will fail */ - granter: string; } +export interface FeeProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Fee"; + value: Uint8Array; +} /** * Fee includes the amount of coins paid in fees and the maximum * gas to be used by the transaction. The ratio yields an effective "gasprice", * which must be above some miminum to be accepted into the mempool. */ - -export interface FeeSDKType { +export interface FeeAmino { /** amount is the amount of coins to be paid as a fee */ - amount: CoinSDKType[]; + amount?: CoinAmino[]; /** * gas_limit is the maximum gas that can be used in transaction processing * before an out of gas error occurs */ - - gas_limit: Long; + gas_limit?: string; /** * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. * the payer must be a tx signer (and thus have signed this field in AuthInfo). * setting this field does *not* change the ordering of required signers for the transaction. */ - - payer: string; + payer?: string; /** * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does * not support fee grants, this will fail */ - + granter?: string; +} +export interface FeeAminoMsg { + type: "cosmos-sdk/Fee"; + value: FeeAmino; +} +/** + * 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 FeeSDKType { + amount: CoinSDKType[]; + gas_limit: bigint; + payer: string; granter: string; } /** @@ -539,25 +649,38 @@ export interface FeeSDKType { * * Since: cosmos-sdk 0.46 */ - export interface Tip { /** amount is the amount of the tip */ amount: Coin[]; /** tipper is the address of the account paying for the tip */ - tipper: string; } +export interface TipProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Tip"; + value: Uint8Array; +} /** * Tip is the tip used for meta-transactions. * * Since: cosmos-sdk 0.46 */ - -export interface TipSDKType { +export interface TipAmino { /** amount is the amount of the tip */ - amount: CoinSDKType[]; + amount?: CoinAmino[]; /** tipper is the address of the account paying for the tip */ - + tipper?: string; +} +export interface TipAminoMsg { + type: "cosmos-sdk/Tip"; + value: TipAmino; +} +/** + * Tip is the tip used for meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ +export interface TipSDKType { + amount: CoinSDKType[]; tipper: string; } /** @@ -568,7 +691,6 @@ export interface TipSDKType { * * Since: cosmos-sdk 0.46 */ - export interface AuxSignerData { /** * address is the bech32-encoded address of the auxiliary signer. If using @@ -581,15 +703,16 @@ export interface AuxSignerData { * signs. Note: we use the same sign doc even if we're signing with * LEGACY_AMINO_JSON. */ - signDoc?: SignDocDirectAux; /** mode is the signing mode of the single signer */ - mode: SignMode; /** sig is the signature of the sign doc. */ - sig: Uint8Array; } +export interface AuxSignerDataProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData"; + value: Uint8Array; +} /** * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a * tipper) builds and sends to the fee payer (who will build and broadcast the @@ -598,29 +721,42 @@ export interface AuxSignerData { * * Since: cosmos-sdk 0.46 */ - -export interface AuxSignerDataSDKType { +export interface AuxSignerDataAmino { /** * address is the bech32-encoded address of the auxiliary signer. If using * AuxSignerData across different chains, the bech32 prefix of the target * chain (where the final transaction is broadcasted) should be used. */ - address: string; + address?: string; /** * sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer * signs. Note: we use the same sign doc even if we're signing with * LEGACY_AMINO_JSON. */ - - sign_doc?: SignDocDirectAuxSDKType; + sign_doc?: SignDocDirectAuxAmino; /** mode is the signing mode of the single signer */ - - mode: SignModeSDKType; + mode?: SignMode; /** sig is the signature of the sign doc. */ - + sig?: string; +} +export interface AuxSignerDataAminoMsg { + type: "cosmos-sdk/AuxSignerData"; + value: AuxSignerDataAmino; +} +/** + * 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 AuxSignerDataSDKType { + address: string; + sign_doc?: SignDocDirectAuxSDKType; + mode: SignMode; sig: Uint8Array; } - function createBaseTx(): Tx { return { body: undefined, @@ -628,64 +764,94 @@ function createBaseTx(): Tx { signatures: [] }; } - export const Tx = { - encode(message: Tx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.Tx", + encode(message: Tx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.body !== undefined) { TxBody.encode(message.body, writer.uint32(10).fork()).ldelim(); } - if (message.authInfo !== undefined) { AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).ldelim(); } - for (const v of message.signatures) { writer.uint32(26).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Tx { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTx(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.body = TxBody.decode(reader, reader.uint32()); break; - case 2: message.authInfo = AuthInfo.decode(reader, reader.uint32()); break; - case 3: message.signatures.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Tx { + fromPartial(object: Partial): Tx { const message = createBaseTx(); message.body = object.body !== undefined && object.body !== null ? TxBody.fromPartial(object.body) : undefined; message.authInfo = object.authInfo !== undefined && object.authInfo !== null ? AuthInfo.fromPartial(object.authInfo) : undefined; message.signatures = object.signatures?.map(e => e) || []; return message; + }, + fromAmino(object: TxAmino): Tx { + const message = createBaseTx(); + if (object.body !== undefined && object.body !== null) { + message.body = TxBody.fromAmino(object.body); + } + if (object.auth_info !== undefined && object.auth_info !== null) { + message.authInfo = AuthInfo.fromAmino(object.auth_info); + } + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Tx): TxAmino { + const obj: any = {}; + obj.body = message.body ? TxBody.toAmino(message.body) : undefined; + obj.auth_info = message.authInfo ? AuthInfo.toAmino(message.authInfo) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: TxAminoMsg): Tx { + return Tx.fromAmino(object.value); + }, + toAminoMsg(message: Tx): TxAminoMsg { + return { + type: "cosmos-sdk/Tx", + value: Tx.toAmino(message) + }; + }, + fromProtoMsg(message: TxProtoMsg): Tx { + return Tx.decode(message.value); + }, + toProto(message: Tx): Uint8Array { + return Tx.encode(message).finish(); + }, + toProtoMsg(message: Tx): TxProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Tx", + value: Tx.encode(message).finish() + }; } - }; - function createBaseTxRaw(): TxRaw { return { bodyBytes: new Uint8Array(), @@ -693,319 +859,451 @@ function createBaseTxRaw(): TxRaw { signatures: [] }; } - export const TxRaw = { - encode(message: TxRaw, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.TxRaw", + encode(message: TxRaw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); } - if (message.authInfoBytes.length !== 0) { writer.uint32(18).bytes(message.authInfoBytes); } - for (const v of message.signatures) { writer.uint32(26).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TxRaw { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTxRaw(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.bodyBytes = reader.bytes(); break; - case 2: message.authInfoBytes = reader.bytes(); break; - case 3: message.signatures.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TxRaw { + fromPartial(object: Partial): TxRaw { const message = createBaseTxRaw(); message.bodyBytes = object.bodyBytes ?? new Uint8Array(); message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); message.signatures = object.signatures?.map(e => e) || []; return message; + }, + fromAmino(object: TxRawAmino): TxRaw { + const message = createBaseTxRaw(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.auth_info_bytes !== undefined && object.auth_info_bytes !== null) { + message.authInfoBytes = bytesFromBase64(object.auth_info_bytes); + } + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: TxRaw): TxRawAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: TxRawAminoMsg): TxRaw { + return TxRaw.fromAmino(object.value); + }, + toAminoMsg(message: TxRaw): TxRawAminoMsg { + return { + type: "cosmos-sdk/TxRaw", + value: TxRaw.toAmino(message) + }; + }, + fromProtoMsg(message: TxRawProtoMsg): TxRaw { + return TxRaw.decode(message.value); + }, + toProto(message: TxRaw): Uint8Array { + return TxRaw.encode(message).finish(); + }, + toProtoMsg(message: TxRaw): TxRawProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxRaw", + value: TxRaw.encode(message).finish() + }; } - }; - function createBaseSignDoc(): SignDoc { return { bodyBytes: new Uint8Array(), authInfoBytes: new Uint8Array(), chainId: "", - accountNumber: Long.UZERO + accountNumber: BigInt(0) }; } - export const SignDoc = { - encode(message: SignDoc, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.SignDoc", + encode(message: SignDoc, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); } - if (message.authInfoBytes.length !== 0) { writer.uint32(18).bytes(message.authInfoBytes); } - if (message.chainId !== "") { writer.uint32(26).string(message.chainId); } - - if (!message.accountNumber.isZero()) { + if (message.accountNumber !== BigInt(0)) { writer.uint32(32).uint64(message.accountNumber); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignDoc { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignDoc(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.bodyBytes = reader.bytes(); break; - case 2: message.authInfoBytes = reader.bytes(); break; - case 3: message.chainId = reader.string(); break; - case 4: - message.accountNumber = (reader.uint64() as Long); + message.accountNumber = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignDoc { + fromPartial(object: Partial): SignDoc { const message = createBaseSignDoc(); message.bodyBytes = object.bodyBytes ?? new Uint8Array(); message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); message.chainId = object.chainId ?? ""; - message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? Long.fromValue(object.accountNumber) : Long.UZERO; + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignDocAmino): SignDoc { + const message = createBaseSignDoc(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.auth_info_bytes !== undefined && object.auth_info_bytes !== null) { + message.authInfoBytes = bytesFromBase64(object.auth_info_bytes); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } return message; + }, + toAmino(message: SignDoc): SignDocAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; + obj.chain_id = message.chainId; + obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignDocAminoMsg): SignDoc { + return SignDoc.fromAmino(object.value); + }, + toAminoMsg(message: SignDoc): SignDocAminoMsg { + return { + type: "cosmos-sdk/SignDoc", + value: SignDoc.toAmino(message) + }; + }, + fromProtoMsg(message: SignDocProtoMsg): SignDoc { + return SignDoc.decode(message.value); + }, + toProto(message: SignDoc): Uint8Array { + return SignDoc.encode(message).finish(); + }, + toProtoMsg(message: SignDoc): SignDocProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignDoc", + value: SignDoc.encode(message).finish() + }; } - }; - function createBaseSignDocDirectAux(): SignDocDirectAux { return { bodyBytes: new Uint8Array(), publicKey: undefined, chainId: "", - accountNumber: Long.UZERO, - sequence: Long.UZERO, + accountNumber: BigInt(0), + sequence: BigInt(0), tip: undefined }; } - export const SignDocDirectAux = { - encode(message: SignDocDirectAux, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", + encode(message: SignDocDirectAux, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); } - if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(18).fork()).ldelim(); } - if (message.chainId !== "") { writer.uint32(26).string(message.chainId); } - - if (!message.accountNumber.isZero()) { + if (message.accountNumber !== BigInt(0)) { writer.uint32(32).uint64(message.accountNumber); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(40).uint64(message.sequence); } - if (message.tip !== undefined) { Tip.encode(message.tip, writer.uint32(50).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignDocDirectAux { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignDocDirectAux(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.bodyBytes = reader.bytes(); break; - case 2: message.publicKey = Any.decode(reader, reader.uint32()); break; - case 3: message.chainId = reader.string(); break; - case 4: - message.accountNumber = (reader.uint64() as Long); + message.accountNumber = reader.uint64(); break; - case 5: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 6: message.tip = Tip.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignDocDirectAux { + fromPartial(object: Partial): SignDocDirectAux { const message = createBaseSignDocDirectAux(); message.bodyBytes = object.bodyBytes ?? new Uint8Array(); message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; message.chainId = object.chainId ?? ""; - message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? Long.fromValue(object.accountNumber) : Long.UZERO; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.tip = object.tip !== undefined && object.tip !== null ? Tip.fromPartial(object.tip) : undefined; return message; + }, + fromAmino(object: SignDocDirectAuxAmino): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.tip !== undefined && object.tip !== null) { + message.tip = Tip.fromAmino(object.tip); + } + return message; + }, + toAmino(message: SignDocDirectAux): SignDocDirectAuxAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.chain_id = message.chainId; + obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; + return obj; + }, + fromAminoMsg(object: SignDocDirectAuxAminoMsg): SignDocDirectAux { + return SignDocDirectAux.fromAmino(object.value); + }, + toAminoMsg(message: SignDocDirectAux): SignDocDirectAuxAminoMsg { + return { + type: "cosmos-sdk/SignDocDirectAux", + value: SignDocDirectAux.toAmino(message) + }; + }, + fromProtoMsg(message: SignDocDirectAuxProtoMsg): SignDocDirectAux { + return SignDocDirectAux.decode(message.value); + }, + toProto(message: SignDocDirectAux): Uint8Array { + return SignDocDirectAux.encode(message).finish(); + }, + toProtoMsg(message: SignDocDirectAux): SignDocDirectAuxProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", + value: SignDocDirectAux.encode(message).finish() + }; } - }; - function createBaseTxBody(): TxBody { return { messages: [], memo: "", - timeoutHeight: Long.UZERO, + timeoutHeight: BigInt(0), extensionOptions: [], nonCriticalExtensionOptions: [] }; } - export const TxBody = { - encode(message: TxBody, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.TxBody", + encode(message: TxBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.messages) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.memo !== "") { writer.uint32(18).string(message.memo); } - - if (!message.timeoutHeight.isZero()) { + if (message.timeoutHeight !== BigInt(0)) { writer.uint32(24).uint64(message.timeoutHeight); } - for (const v of message.extensionOptions) { Any.encode(v!, writer.uint32(8186).fork()).ldelim(); } - for (const v of message.nonCriticalExtensionOptions) { Any.encode(v!, writer.uint32(16378).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TxBody { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTxBody(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.messages.push(Any.decode(reader, reader.uint32())); break; - case 2: message.memo = reader.string(); break; - case 3: - message.timeoutHeight = (reader.uint64() as Long); + message.timeoutHeight = reader.uint64(); break; - case 1023: message.extensionOptions.push(Any.decode(reader, reader.uint32())); break; - case 2047: message.nonCriticalExtensionOptions.push(Any.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TxBody { + fromPartial(object: Partial): TxBody { const message = createBaseTxBody(); message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; message.memo = object.memo ?? ""; - message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Long.fromValue(object.timeoutHeight) : Long.UZERO; + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0); message.extensionOptions = object.extensionOptions?.map(e => Any.fromPartial(e)) || []; message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map(e => Any.fromPartial(e)) || []; return message; + }, + fromAmino(object: TxBodyAmino): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = BigInt(object.timeout_height); + } + message.extensionOptions = object.extension_options?.map(e => Any.fromAmino(e)) || []; + message.nonCriticalExtensionOptions = object.non_critical_extension_options?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxBody): TxBodyAmino { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = []; + } + obj.memo = message.memo; + obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + if (message.extensionOptions) { + obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.extension_options = []; + } + if (message.nonCriticalExtensionOptions) { + obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.non_critical_extension_options = []; + } + return obj; + }, + fromAminoMsg(object: TxBodyAminoMsg): TxBody { + return TxBody.fromAmino(object.value); + }, + toAminoMsg(message: TxBody): TxBodyAminoMsg { + return { + type: "cosmos-sdk/TxBody", + value: TxBody.toAmino(message) + }; + }, + fromProtoMsg(message: TxBodyProtoMsg): TxBody { + return TxBody.decode(message.value); + }, + toProto(message: TxBody): Uint8Array { + return TxBody.encode(message).finish(); + }, + toProtoMsg(message: TxBody): TxBodyProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxBody", + value: TxBody.encode(message).finish() + }; } - }; - function createBaseAuthInfo(): AuthInfo { return { signerInfos: [], @@ -1013,414 +1311,610 @@ function createBaseAuthInfo(): AuthInfo { tip: undefined }; } - export const AuthInfo = { - encode(message: AuthInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo", + encode(message: AuthInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signerInfos) { SignerInfo.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.fee !== undefined) { Fee.encode(message.fee, writer.uint32(18).fork()).ldelim(); } - if (message.tip !== undefined) { Tip.encode(message.tip, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AuthInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAuthInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signerInfos.push(SignerInfo.decode(reader, reader.uint32())); break; - case 2: message.fee = Fee.decode(reader, reader.uint32()); break; - case 3: message.tip = Tip.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AuthInfo { + fromPartial(object: Partial): AuthInfo { const message = createBaseAuthInfo(); message.signerInfos = object.signerInfos?.map(e => SignerInfo.fromPartial(e)) || []; message.fee = object.fee !== undefined && object.fee !== null ? Fee.fromPartial(object.fee) : undefined; message.tip = object.tip !== undefined && object.tip !== null ? Tip.fromPartial(object.tip) : undefined; return message; + }, + fromAmino(object: AuthInfoAmino): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signer_infos?.map(e => SignerInfo.fromAmino(e)) || []; + if (object.fee !== undefined && object.fee !== null) { + message.fee = Fee.fromAmino(object.fee); + } + if (object.tip !== undefined && object.tip !== null) { + message.tip = Tip.fromAmino(object.tip); + } + return message; + }, + toAmino(message: AuthInfo): AuthInfoAmino { + const obj: any = {}; + if (message.signerInfos) { + obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e) : undefined); + } else { + obj.signer_infos = []; + } + obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; + obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; + return obj; + }, + fromAminoMsg(object: AuthInfoAminoMsg): AuthInfo { + return AuthInfo.fromAmino(object.value); + }, + toAminoMsg(message: AuthInfo): AuthInfoAminoMsg { + return { + type: "cosmos-sdk/AuthInfo", + value: AuthInfo.toAmino(message) + }; + }, + fromProtoMsg(message: AuthInfoProtoMsg): AuthInfo { + return AuthInfo.decode(message.value); + }, + toProto(message: AuthInfo): Uint8Array { + return AuthInfo.encode(message).finish(); + }, + toProtoMsg(message: AuthInfo): AuthInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo", + value: AuthInfo.encode(message).finish() + }; } - }; - function createBaseSignerInfo(): SignerInfo { return { publicKey: undefined, modeInfo: undefined, - sequence: Long.UZERO + sequence: BigInt(0) }; } - export const SignerInfo = { - encode(message: SignerInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo", + encode(message: SignerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); } - if (message.modeInfo !== undefined) { ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).ldelim(); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignerInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignerInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.publicKey = Any.decode(reader, reader.uint32()); break; - case 2: message.modeInfo = ModeInfo.decode(reader, reader.uint32()); break; - case 3: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignerInfo { + fromPartial(object: Partial): SignerInfo { const message = createBaseSignerInfo(); message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; message.modeInfo = object.modeInfo !== undefined && object.modeInfo !== null ? ModeInfo.fromPartial(object.modeInfo) : undefined; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; + }, + fromAmino(object: SignerInfoAmino): SignerInfo { + const message = createBaseSignerInfo(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.mode_info !== undefined && object.mode_info !== null) { + message.modeInfo = ModeInfo.fromAmino(object.mode_info); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: SignerInfo): SignerInfoAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { + return SignerInfo.fromAmino(object.value); + }, + toAminoMsg(message: SignerInfo): SignerInfoAminoMsg { + return { + type: "cosmos-sdk/SignerInfo", + value: SignerInfo.toAmino(message) + }; + }, + fromProtoMsg(message: SignerInfoProtoMsg): SignerInfo { + return SignerInfo.decode(message.value); + }, + toProto(message: SignerInfo): Uint8Array { + return SignerInfo.encode(message).finish(); + }, + toProtoMsg(message: SignerInfo): SignerInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo", + value: SignerInfo.encode(message).finish() + }; } - }; - function createBaseModeInfo(): ModeInfo { return { single: undefined, multi: undefined }; } - export const ModeInfo = { - encode(message: ModeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo", + encode(message: ModeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.single !== undefined) { ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); } - if (message.multi !== undefined) { ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModeInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.single = ModeInfo_Single.decode(reader, reader.uint32()); break; - case 2: message.multi = ModeInfo_Multi.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModeInfo { + fromPartial(object: Partial): ModeInfo { const message = createBaseModeInfo(); message.single = object.single !== undefined && object.single !== null ? ModeInfo_Single.fromPartial(object.single) : undefined; message.multi = object.multi !== undefined && object.multi !== null ? ModeInfo_Multi.fromPartial(object.multi) : undefined; return message; + }, + fromAmino(object: ModeInfoAmino): ModeInfo { + const message = createBaseModeInfo(); + if (object.single !== undefined && object.single !== null) { + message.single = ModeInfo_Single.fromAmino(object.single); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = ModeInfo_Multi.fromAmino(object.multi); + } + return message; + }, + toAmino(message: ModeInfo): ModeInfoAmino { + const obj: any = {}; + obj.single = message.single ? ModeInfo_Single.toAmino(message.single) : undefined; + obj.multi = message.multi ? ModeInfo_Multi.toAmino(message.multi) : undefined; + return obj; + }, + fromAminoMsg(object: ModeInfoAminoMsg): ModeInfo { + return ModeInfo.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo): ModeInfoAminoMsg { + return { + type: "cosmos-sdk/ModeInfo", + value: ModeInfo.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfoProtoMsg): ModeInfo { + return ModeInfo.decode(message.value); + }, + toProto(message: ModeInfo): Uint8Array { + return ModeInfo.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo): ModeInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo", + value: ModeInfo.encode(message).finish() + }; } - }; - function createBaseModeInfo_Single(): ModeInfo_Single { return { mode: 0 }; } - export const ModeInfo_Single = { - encode(message: ModeInfo_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.Single", + encode(message: ModeInfo_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mode !== 0) { writer.uint32(8).int32(message.mode); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Single { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModeInfo_Single(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.mode = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModeInfo_Single { + fromPartial(object: Partial): ModeInfo_Single { const message = createBaseModeInfo_Single(); message.mode = object.mode ?? 0; return message; + }, + fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { + const message = createBaseModeInfo_Single(); + if (object.mode !== undefined && object.mode !== null) { + message.mode = signModeFromJSON(object.mode); + } + return message; + }, + toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { + const obj: any = {}; + obj.mode = signModeToJSON(message.mode); + return obj; + }, + fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { + return ModeInfo_Single.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo_Single): ModeInfo_SingleAminoMsg { + return { + type: "cosmos-sdk/Single", + value: ModeInfo_Single.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfo_SingleProtoMsg): ModeInfo_Single { + return ModeInfo_Single.decode(message.value); + }, + toProto(message: ModeInfo_Single): Uint8Array { + return ModeInfo_Single.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo_Single): ModeInfo_SingleProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Single", + value: ModeInfo_Single.encode(message).finish() + }; } - }; - function createBaseModeInfo_Multi(): ModeInfo_Multi { return { bitarray: undefined, modeInfos: [] }; } - export const ModeInfo_Multi = { - encode(message: ModeInfo_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.Multi", + encode(message: ModeInfo_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bitarray !== undefined) { CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); } - for (const v of message.modeInfos) { ModeInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Multi { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModeInfo_Multi(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.bitarray = CompactBitArray.decode(reader, reader.uint32()); break; - case 2: message.modeInfos.push(ModeInfo.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModeInfo_Multi { + fromPartial(object: Partial): ModeInfo_Multi { const message = createBaseModeInfo_Multi(); message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; message.modeInfos = object.modeInfos?.map(e => ModeInfo.fromPartial(e)) || []; return message; + }, + fromAmino(object: ModeInfo_MultiAmino): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + if (object.bitarray !== undefined && object.bitarray !== null) { + message.bitarray = CompactBitArray.fromAmino(object.bitarray); + } + message.modeInfos = object.mode_infos?.map(e => ModeInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: ModeInfo_Multi): ModeInfo_MultiAmino { + const obj: any = {}; + obj.bitarray = message.bitarray ? CompactBitArray.toAmino(message.bitarray) : undefined; + if (message.modeInfos) { + obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e) : undefined); + } else { + obj.mode_infos = []; + } + return obj; + }, + fromAminoMsg(object: ModeInfo_MultiAminoMsg): ModeInfo_Multi { + return ModeInfo_Multi.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo_Multi): ModeInfo_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: ModeInfo_Multi.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfo_MultiProtoMsg): ModeInfo_Multi { + return ModeInfo_Multi.decode(message.value); + }, + toProto(message: ModeInfo_Multi): Uint8Array { + return ModeInfo_Multi.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo_Multi): ModeInfo_MultiProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Multi", + value: ModeInfo_Multi.encode(message).finish() + }; } - }; - function createBaseFee(): Fee { return { amount: [], - gasLimit: Long.UZERO, + gasLimit: BigInt(0), payer: "", granter: "" }; } - export const Fee = { - encode(message: Fee, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.Fee", + encode(message: Fee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - - if (!message.gasLimit.isZero()) { + if (message.gasLimit !== BigInt(0)) { writer.uint32(16).uint64(message.gasLimit); } - if (message.payer !== "") { writer.uint32(26).string(message.payer); } - if (message.granter !== "") { writer.uint32(34).string(message.granter); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Fee { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFee(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.amount.push(Coin.decode(reader, reader.uint32())); break; - case 2: - message.gasLimit = (reader.uint64() as Long); + message.gasLimit = reader.uint64(); break; - case 3: message.payer = reader.string(); break; - case 4: message.granter = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Fee { + fromPartial(object: Partial): Fee { const message = createBaseFee(); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; - message.gasLimit = object.gasLimit !== undefined && object.gasLimit !== null ? Long.fromValue(object.gasLimit) : Long.UZERO; + message.gasLimit = object.gasLimit !== undefined && object.gasLimit !== null ? BigInt(object.gasLimit.toString()) : BigInt(0); message.payer = object.payer ?? ""; message.granter = object.granter ?? ""; return message; + }, + fromAmino(object: FeeAmino): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.gas_limit !== undefined && object.gas_limit !== null) { + message.gasLimit = BigInt(object.gas_limit); + } + if (object.payer !== undefined && object.payer !== null) { + message.payer = object.payer; + } + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + return message; + }, + toAmino(message: Fee): FeeAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; + obj.payer = message.payer; + obj.granter = message.granter; + return obj; + }, + fromAminoMsg(object: FeeAminoMsg): Fee { + return Fee.fromAmino(object.value); + }, + toAminoMsg(message: Fee): FeeAminoMsg { + return { + type: "cosmos-sdk/Fee", + value: Fee.toAmino(message) + }; + }, + fromProtoMsg(message: FeeProtoMsg): Fee { + return Fee.decode(message.value); + }, + toProto(message: Fee): Uint8Array { + return Fee.encode(message).finish(); + }, + toProtoMsg(message: Fee): FeeProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Fee", + value: Fee.encode(message).finish() + }; } - }; - function createBaseTip(): Tip { return { amount: [], tipper: "" }; } - export const Tip = { - encode(message: Tip, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.Tip", + encode(message: Tip, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.tipper !== "") { writer.uint32(18).string(message.tipper); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Tip { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Tip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTip(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.amount.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.tipper = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Tip { + fromPartial(object: Partial): Tip { const message = createBaseTip(); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; message.tipper = object.tipper ?? ""; return message; + }, + fromAmino(object: TipAmino): Tip { + const message = createBaseTip(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.tipper !== undefined && object.tipper !== null) { + message.tipper = object.tipper; + } + return message; + }, + toAmino(message: Tip): TipAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + obj.tipper = message.tipper; + return obj; + }, + fromAminoMsg(object: TipAminoMsg): Tip { + return Tip.fromAmino(object.value); + }, + toAminoMsg(message: Tip): TipAminoMsg { + return { + type: "cosmos-sdk/Tip", + value: Tip.toAmino(message) + }; + }, + fromProtoMsg(message: TipProtoMsg): Tip { + return Tip.decode(message.value); + }, + toProto(message: Tip): Uint8Array { + return Tip.encode(message).finish(); + }, + toProtoMsg(message: Tip): TipProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Tip", + value: Tip.encode(message).finish() + }; } - }; - function createBaseAuxSignerData(): AuxSignerData { return { address: "", @@ -1429,69 +1923,100 @@ function createBaseAuxSignerData(): AuxSignerData { sig: new Uint8Array() }; } - export const AuxSignerData = { - encode(message: AuxSignerData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", + encode(message: AuxSignerData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.signDoc !== undefined) { SignDocDirectAux.encode(message.signDoc, writer.uint32(18).fork()).ldelim(); } - if (message.mode !== 0) { writer.uint32(24).int32(message.mode); } - if (message.sig.length !== 0) { writer.uint32(34).bytes(message.sig); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AuxSignerData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAuxSignerData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.signDoc = SignDocDirectAux.decode(reader, reader.uint32()); break; - case 3: message.mode = (reader.int32() as any); break; - case 4: message.sig = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AuxSignerData { + fromPartial(object: Partial): AuxSignerData { const message = createBaseAuxSignerData(); message.address = object.address ?? ""; message.signDoc = object.signDoc !== undefined && object.signDoc !== null ? SignDocDirectAux.fromPartial(object.signDoc) : undefined; message.mode = object.mode ?? 0; message.sig = object.sig ?? new Uint8Array(); return message; + }, + fromAmino(object: AuxSignerDataAmino): AuxSignerData { + const message = createBaseAuxSignerData(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.sign_doc !== undefined && object.sign_doc !== null) { + message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); + } + if (object.mode !== undefined && object.mode !== null) { + message.mode = signModeFromJSON(object.mode); + } + if (object.sig !== undefined && object.sig !== null) { + message.sig = bytesFromBase64(object.sig); + } + return message; + }, + toAmino(message: AuxSignerData): AuxSignerDataAmino { + const obj: any = {}; + obj.address = message.address; + obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; + obj.mode = signModeToJSON(message.mode); + obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; + return obj; + }, + fromAminoMsg(object: AuxSignerDataAminoMsg): AuxSignerData { + return AuxSignerData.fromAmino(object.value); + }, + toAminoMsg(message: AuxSignerData): AuxSignerDataAminoMsg { + return { + type: "cosmos-sdk/AuxSignerData", + value: AuxSignerData.toAmino(message) + }; + }, + fromProtoMsg(message: AuxSignerDataProtoMsg): AuxSignerData { + return AuxSignerData.decode(message.value); + }, + toProto(message: AuxSignerData): Uint8Array { + return AuxSignerData.encode(message).finish(); + }, + toProtoMsg(message: AuxSignerData): AuxSignerDataProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", + value: AuxSignerData.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/upgrade/v1beta1/query.lcd.ts b/src/codegen/cosmos/upgrade/v1beta1/query.lcd.ts index 36a7cf6..8cc2a4f 100644 --- a/src/codegen/cosmos/upgrade/v1beta1/query.lcd.ts +++ b/src/codegen/cosmos/upgrade/v1beta1/query.lcd.ts @@ -1,8 +1,7 @@ -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryCurrentPlanRequest, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -16,15 +15,11 @@ export class LCDQueryClient { this.authority = this.authority.bind(this); } /* CurrentPlan queries the current upgrade plan. */ - - async currentPlan(_params: QueryCurrentPlanRequest = {}): Promise { const endpoint = `cosmos/upgrade/v1beta1/current_plan`; return await this.req.get(endpoint); } /* AppliedPlan queries a previously applied upgrade plan by its name. */ - - async appliedPlan(params: QueryAppliedPlanRequest): Promise { const endpoint = `cosmos/upgrade/v1beta1/applied_plan/${params.name}`; return await this.req.get(endpoint); @@ -35,8 +30,6 @@ export class LCDQueryClient { 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) */ - - async upgradedConsensusState(params: QueryUpgradedConsensusStateRequest): Promise { const endpoint = `cosmos/upgrade/v1beta1/upgraded_consensus_state/${params.lastHeight}`; return await this.req.get(endpoint); @@ -44,26 +37,19 @@ export class LCDQueryClient { /* ModuleVersions queries the list of module versions from state. Since: cosmos-sdk 0.43 */ - - async moduleVersions(params: QueryModuleVersionsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.moduleName !== "undefined") { options.params.module_name = params.moduleName; } - const endpoint = `cosmos/upgrade/v1beta1/module_versions`; return await this.req.get(endpoint, options); } /* Returns the account with authority to conduct upgrades */ - - async authority(_params: QueryAuthorityRequest = {}): Promise { const endpoint = `cosmos/upgrade/v1beta1/authority`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/upgrade/v1beta1/query.rpc.Query.ts b/src/codegen/cosmos/upgrade/v1beta1/query.rpc.Query.ts index d2cea4e..886c5ea 100644 --- a/src/codegen/cosmos/upgrade/v1beta1/query.rpc.Query.ts +++ b/src/codegen/cosmos/upgrade/v1beta1/query.rpc.Query.ts @@ -1,14 +1,12 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryCurrentPlanRequest, QueryCurrentPlanResponse, QueryAppliedPlanRequest, QueryAppliedPlanResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse, QueryModuleVersionsRequest, QueryModuleVersionsResponse, QueryAuthorityRequest, QueryAuthorityResponse } from "./query"; /** 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 @@ -18,22 +16,18 @@ export interface Query { * 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) */ - upgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise; /** * ModuleVersions queries the list of module versions from state. * * Since: cosmos-sdk 0.43 */ - moduleVersions(request: QueryModuleVersionsRequest): Promise; /** Returns the account with authority to conduct upgrades */ - authority(request?: QueryAuthorityRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.currentPlan = this.currentPlan.bind(this); @@ -42,37 +36,31 @@ export class QueryClientImpl implements Query { 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("cosmos.upgrade.v1beta1.Query", "CurrentPlan", data); - return promise.then(data => QueryCurrentPlanResponse.decode(new _m0.Reader(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("cosmos.upgrade.v1beta1.Query", "AppliedPlan", data); - return promise.then(data => QueryAppliedPlanResponse.decode(new _m0.Reader(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("cosmos.upgrade.v1beta1.Query", "UpgradedConsensusState", data); - return promise.then(data => QueryUpgradedConsensusStateResponse.decode(new _m0.Reader(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("cosmos.upgrade.v1beta1.Query", "ModuleVersions", data); - return promise.then(data => QueryModuleVersionsResponse.decode(new _m0.Reader(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("cosmos.upgrade.v1beta1.Query", "Authority", data); - return promise.then(data => QueryAuthorityResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAuthorityResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -81,22 +69,17 @@ export const createRpcQueryExtension = (base: QueryClient) => { currentPlan(request?: QueryCurrentPlanRequest): Promise { return queryService.currentPlan(request); }, - appliedPlan(request: QueryAppliedPlanRequest): Promise { return queryService.appliedPlan(request); }, - upgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise { return queryService.upgradedConsensusState(request); }, - moduleVersions(request: QueryModuleVersionsRequest): Promise { return queryService.moduleVersions(request); }, - authority(request?: QueryAuthorityRequest): Promise { return queryService.authority(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/cosmos/upgrade/v1beta1/query.ts b/src/codegen/cosmos/upgrade/v1beta1/query.ts index 8e69d47..ee043dc 100644 --- a/src/codegen/cosmos/upgrade/v1beta1/query.ts +++ b/src/codegen/cosmos/upgrade/v1beta1/query.ts @@ -1,120 +1,194 @@ -import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Plan, PlanAmino, PlanSDKType, ModuleVersion, ModuleVersionAmino, ModuleVersionSDKType } from "./upgrade"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC * method. */ - export interface QueryCurrentPlanRequest {} +export interface QueryCurrentPlanRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest"; + value: Uint8Array; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanRequestAmino {} +export interface QueryCurrentPlanRequestAminoMsg { + type: "cosmos-sdk/QueryCurrentPlanRequest"; + value: QueryCurrentPlanRequestAmino; +} /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC * method. */ - export interface QueryCurrentPlanRequestSDKType {} /** * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC * method. */ - export interface QueryCurrentPlanResponse { /** plan is the current upgrade plan. */ plan?: Plan; } +export interface QueryCurrentPlanResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse"; + value: Uint8Array; +} /** * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC * method. */ - -export interface QueryCurrentPlanResponseSDKType { +export interface QueryCurrentPlanResponseAmino { /** plan is the current upgrade plan. */ + plan?: PlanAmino; +} +export interface QueryCurrentPlanResponseAminoMsg { + type: "cosmos-sdk/QueryCurrentPlanResponse"; + value: QueryCurrentPlanResponseAmino; +} +/** + * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanResponseSDKType { plan?: PlanSDKType; } /** * 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; } +export interface QueryAppliedPlanRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest"; + value: Uint8Array; +} /** * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC * method. */ - -export interface QueryAppliedPlanRequestSDKType { +export interface QueryAppliedPlanRequestAmino { /** name is the name of the applied plan to query for. */ + name?: string; +} +export interface QueryAppliedPlanRequestAminoMsg { + type: "cosmos-sdk/QueryAppliedPlanRequest"; + value: QueryAppliedPlanRequestAmino; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanRequestSDKType { 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: Long; + height: bigint; +} +export interface QueryAppliedPlanResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse"; + value: Uint8Array; } /** * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC * method. */ - -export interface QueryAppliedPlanResponseSDKType { +export interface QueryAppliedPlanResponseAmino { /** height is the block height at which the plan was applied. */ - height: Long; + height?: string; +} +export interface QueryAppliedPlanResponseAminoMsg { + type: "cosmos-sdk/QueryAppliedPlanResponse"; + value: QueryAppliedPlanResponseAmino; +} +/** + * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanResponseSDKType { + height: bigint; } /** * 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: Long; + lastHeight: bigint; +} +export interface QueryUpgradedConsensusStateRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest"; + value: Uint8Array; } /** * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState * RPC method. */ - /** @deprecated */ - -export interface QueryUpgradedConsensusStateRequestSDKType { +export interface QueryUpgradedConsensusStateRequestAmino { /** * last height of the current chain must be sent in request * as this is the height under which next consensus state is stored */ - last_height: Long; + last_height?: string; +} +export interface QueryUpgradedConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest"; + value: QueryUpgradedConsensusStateRequestAmino; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateRequestSDKType { + last_height: bigint; } /** * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState * RPC method. */ - /** @deprecated */ - export interface QueryUpgradedConsensusStateResponse { /** Since: cosmos-sdk 0.43 */ upgradedConsensusState: Uint8Array; } +export interface QueryUpgradedConsensusStateResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse"; + value: Uint8Array; +} /** * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState * RPC method. */ - /** @deprecated */ - -export interface QueryUpgradedConsensusStateResponseSDKType { +export interface QueryUpgradedConsensusStateResponseAmino { /** Since: cosmos-sdk 0.43 */ + upgraded_consensus_state?: string; +} +export interface QueryUpgradedConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse"; + value: QueryUpgradedConsensusStateResponseAmino; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateResponseSDKType { upgraded_consensus_state: Uint8Array; } /** @@ -123,7 +197,6 @@ export interface QueryUpgradedConsensusStateResponseSDKType { * * Since: cosmos-sdk 0.43 */ - export interface QueryModuleVersionsRequest { /** * module_name is a field to query a specific module @@ -132,19 +205,35 @@ export interface QueryModuleVersionsRequest { */ moduleName: string; } +export interface QueryModuleVersionsRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest"; + value: Uint8Array; +} /** * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions * RPC method. * * Since: cosmos-sdk 0.43 */ - -export interface QueryModuleVersionsRequestSDKType { +export interface QueryModuleVersionsRequestAmino { /** * module_name is a field to query a specific module * consensus version from state. Leaving this empty will * fetch the full list of module versions from state */ + module_name?: string; +} +export interface QueryModuleVersionsRequestAminoMsg { + type: "cosmos-sdk/QueryModuleVersionsRequest"; + value: QueryModuleVersionsRequestAmino; +} +/** + * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsRequestSDKType { module_name: string; } /** @@ -153,20 +242,35 @@ export interface QueryModuleVersionsRequestSDKType { * * Since: cosmos-sdk 0.43 */ - export interface QueryModuleVersionsResponse { /** module_versions is a list of module names with their consensus versions. */ moduleVersions: ModuleVersion[]; } +export interface QueryModuleVersionsResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse"; + value: Uint8Array; +} /** * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions * RPC method. * * Since: cosmos-sdk 0.43 */ - -export interface QueryModuleVersionsResponseSDKType { +export interface QueryModuleVersionsResponseAmino { /** module_versions is a list of module names with their consensus versions. */ + module_versions?: ModuleVersionAmino[]; +} +export interface QueryModuleVersionsResponseAminoMsg { + type: "cosmos-sdk/QueryModuleVersionsResponse"; + value: QueryModuleVersionsResponseAmino; +} +/** + * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsResponseSDKType { module_versions: ModuleVersionSDKType[]; } /** @@ -174,458 +278,722 @@ export interface QueryModuleVersionsResponseSDKType { * * Since: cosmos-sdk 0.46 */ - export interface QueryAuthorityRequest {} +export interface QueryAuthorityRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest"; + value: Uint8Array; +} +/** + * QueryAuthorityRequest is the request type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityRequestAmino {} +export interface QueryAuthorityRequestAminoMsg { + type: "cosmos-sdk/QueryAuthorityRequest"; + value: QueryAuthorityRequestAmino; +} /** * QueryAuthorityRequest is the request type for Query/Authority * * Since: cosmos-sdk 0.46 */ - export interface QueryAuthorityRequestSDKType {} /** * QueryAuthorityResponse is the response type for Query/Authority * * Since: cosmos-sdk 0.46 */ - export interface QueryAuthorityResponse { address: string; } +export interface QueryAuthorityResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse"; + value: Uint8Array; +} +/** + * QueryAuthorityResponse is the response type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityResponseAmino { + address?: string; +} +export interface QueryAuthorityResponseAminoMsg { + type: "cosmos-sdk/QueryAuthorityResponse"; + value: QueryAuthorityResponseAmino; +} /** * QueryAuthorityResponse is the response type for Query/Authority * * Since: cosmos-sdk 0.46 */ - export interface QueryAuthorityResponseSDKType { address: string; } - function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { return {}; } - export const QueryCurrentPlanRequest = { - encode(_: QueryCurrentPlanRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", + encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentPlanRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryCurrentPlanRequest { + fromPartial(_: Partial): QueryCurrentPlanRequest { const message = createBaseQueryCurrentPlanRequest(); return message; + }, + fromAmino(_: QueryCurrentPlanRequestAmino): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, + toAmino(_: QueryCurrentPlanRequest): QueryCurrentPlanRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryCurrentPlanRequestAminoMsg): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCurrentPlanRequest): QueryCurrentPlanRequestAminoMsg { + return { + type: "cosmos-sdk/QueryCurrentPlanRequest", + value: QueryCurrentPlanRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCurrentPlanRequestProtoMsg): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.decode(message.value); + }, + toProto(message: QueryCurrentPlanRequest): Uint8Array { + return QueryCurrentPlanRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCurrentPlanRequest): QueryCurrentPlanRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", + value: QueryCurrentPlanRequest.encode(message).finish() + }; } - }; - function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { return { plan: undefined }; } - export const QueryCurrentPlanResponse = { - encode(message: QueryCurrentPlanResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", + encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.plan !== undefined) { Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentPlanResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.plan = Plan.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryCurrentPlanResponse { + fromPartial(object: Partial): QueryCurrentPlanResponse { const message = createBaseQueryCurrentPlanResponse(); message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; return message; + }, + fromAmino(object: QueryCurrentPlanResponseAmino): QueryCurrentPlanResponse { + const message = createBaseQueryCurrentPlanResponse(); + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + return message; + }, + toAmino(message: QueryCurrentPlanResponse): QueryCurrentPlanResponseAmino { + const obj: any = {}; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + return obj; + }, + fromAminoMsg(object: QueryCurrentPlanResponseAminoMsg): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCurrentPlanResponse): QueryCurrentPlanResponseAminoMsg { + return { + type: "cosmos-sdk/QueryCurrentPlanResponse", + value: QueryCurrentPlanResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCurrentPlanResponseProtoMsg): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.decode(message.value); + }, + toProto(message: QueryCurrentPlanResponse): Uint8Array { + return QueryCurrentPlanResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCurrentPlanResponse): QueryCurrentPlanResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", + value: QueryCurrentPlanResponse.encode(message).finish() + }; } - }; - function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { return { name: "" }; } - export const QueryAppliedPlanRequest = { - encode(message: QueryAppliedPlanRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", + encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAppliedPlanRequest { + fromPartial(object: Partial): QueryAppliedPlanRequest { const message = createBaseQueryAppliedPlanRequest(); message.name = object.name ?? ""; return message; + }, + fromAmino(object: QueryAppliedPlanRequestAmino): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + return message; + }, + toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { + const obj: any = {}; + obj.name = message.name; + return obj; + }, + fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAppliedPlanRequest", + value: QueryAppliedPlanRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAppliedPlanRequestProtoMsg): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.decode(message.value); + }, + toProto(message: QueryAppliedPlanRequest): Uint8Array { + return QueryAppliedPlanRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", + value: QueryAppliedPlanRequest.encode(message).finish() + }; } - }; - function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { return { - height: Long.ZERO + height: BigInt(0) }; } - export const QueryAppliedPlanResponse = { - encode(message: QueryAppliedPlanResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", + encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAppliedPlanResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAppliedPlanResponse { + fromPartial(object: Partial): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryAppliedPlanResponseAmino): QueryAppliedPlanResponse { const message = createBaseQueryAppliedPlanResponse(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } return message; + }, + toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAppliedPlanResponse", + value: QueryAppliedPlanResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAppliedPlanResponseProtoMsg): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.decode(message.value); + }, + toProto(message: QueryAppliedPlanResponse): Uint8Array { + return QueryAppliedPlanResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", + value: QueryAppliedPlanResponse.encode(message).finish() + }; } - }; - function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { return { - lastHeight: Long.ZERO + lastHeight: BigInt(0) }; } - export const QueryUpgradedConsensusStateRequest = { - encode(message: QueryUpgradedConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.lastHeight.isZero()) { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", + encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.lastHeight !== BigInt(0)) { writer.uint32(8).int64(message.lastHeight); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.lastHeight = (reader.int64() as Long); + message.lastHeight = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUpgradedConsensusStateRequest { + fromPartial(object: Partial): QueryUpgradedConsensusStateRequest { const message = createBaseQueryUpgradedConsensusStateRequest(); - message.lastHeight = object.lastHeight !== undefined && object.lastHeight !== null ? Long.fromValue(object.lastHeight) : Long.ZERO; + message.lastHeight = object.lastHeight !== undefined && object.lastHeight !== null ? BigInt(object.lastHeight.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryUpgradedConsensusStateRequestAmino): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + if (object.last_height !== undefined && object.last_height !== null) { + message.lastHeight = BigInt(object.last_height); + } + return message; + }, + toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { + const obj: any = {}; + obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedConsensusStateRequestProtoMsg): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateRequest): Uint8Array { + return QueryUpgradedConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { return { upgradedConsensusState: new Uint8Array() }; } - export const QueryUpgradedConsensusStateResponse = { - encode(message: QueryUpgradedConsensusStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 2: message.upgradedConsensusState = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUpgradedConsensusStateResponse { + fromPartial(object: Partial): QueryUpgradedConsensusStateResponse { const message = createBaseQueryUpgradedConsensusStateResponse(); message.upgradedConsensusState = object.upgradedConsensusState ?? new Uint8Array(); return message; + }, + fromAmino(object: QueryUpgradedConsensusStateResponseAmino): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + if (object.upgraded_consensus_state !== undefined && object.upgraded_consensus_state !== null) { + message.upgradedConsensusState = bytesFromBase64(object.upgraded_consensus_state); + } + return message; + }, + toAmino(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseAmino { + const obj: any = {}; + obj.upgraded_consensus_state = message.upgradedConsensusState ? base64FromBytes(message.upgradedConsensusState) : undefined; + return obj; + }, + fromAminoMsg(object: QueryUpgradedConsensusStateResponseAminoMsg): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedConsensusStateResponseProtoMsg): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateResponse): Uint8Array { + return QueryUpgradedConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.encode(message).finish() + }; } - }; - function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { return { moduleName: "" }; } - export const QueryModuleVersionsRequest = { - encode(message: QueryModuleVersionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", + encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.moduleName = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryModuleVersionsRequest { + fromPartial(object: Partial): QueryModuleVersionsRequest { const message = createBaseQueryModuleVersionsRequest(); message.moduleName = object.moduleName ?? ""; return message; + }, + fromAmino(object: QueryModuleVersionsRequestAmino): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + if (object.module_name !== undefined && object.module_name !== null) { + message.moduleName = object.module_name; + } + return message; + }, + toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { + const obj: any = {}; + obj.module_name = message.moduleName; + return obj; + }, + fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryModuleVersionsRequest", + value: QueryModuleVersionsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleVersionsRequestProtoMsg): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.decode(message.value); + }, + toProto(message: QueryModuleVersionsRequest): Uint8Array { + return QueryModuleVersionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", + value: QueryModuleVersionsRequest.encode(message).finish() + }; } - }; - function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { return { moduleVersions: [] }; } - export const QueryModuleVersionsResponse = { - encode(message: QueryModuleVersionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", + encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.moduleVersions) { ModuleVersion.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleVersionsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.moduleVersions.push(ModuleVersion.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryModuleVersionsResponse { + fromPartial(object: Partial): QueryModuleVersionsResponse { const message = createBaseQueryModuleVersionsResponse(); message.moduleVersions = object.moduleVersions?.map(e => ModuleVersion.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryModuleVersionsResponseAmino): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.moduleVersions = object.module_versions?.map(e => ModuleVersion.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryModuleVersionsResponse): QueryModuleVersionsResponseAmino { + const obj: any = {}; + if (message.moduleVersions) { + obj.module_versions = message.moduleVersions.map(e => e ? ModuleVersion.toAmino(e) : undefined); + } else { + obj.module_versions = []; + } + return obj; + }, + fromAminoMsg(object: QueryModuleVersionsResponseAminoMsg): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleVersionsResponse): QueryModuleVersionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryModuleVersionsResponse", + value: QueryModuleVersionsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleVersionsResponseProtoMsg): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.decode(message.value); + }, + toProto(message: QueryModuleVersionsResponse): Uint8Array { + return QueryModuleVersionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleVersionsResponse): QueryModuleVersionsResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", + value: QueryModuleVersionsResponse.encode(message).finish() + }; } - }; - function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { return {}; } - export const QueryAuthorityRequest = { - encode(_: QueryAuthorityRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", + encode(_: QueryAuthorityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAuthorityRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryAuthorityRequest { + fromPartial(_: Partial): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, + fromAmino(_: QueryAuthorityRequestAmino): QueryAuthorityRequest { const message = createBaseQueryAuthorityRequest(); return message; + }, + toAmino(_: QueryAuthorityRequest): QueryAuthorityRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryAuthorityRequestAminoMsg): QueryAuthorityRequest { + return QueryAuthorityRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAuthorityRequest): QueryAuthorityRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAuthorityRequest", + value: QueryAuthorityRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAuthorityRequestProtoMsg): QueryAuthorityRequest { + return QueryAuthorityRequest.decode(message.value); + }, + toProto(message: QueryAuthorityRequest): Uint8Array { + return QueryAuthorityRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAuthorityRequest): QueryAuthorityRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", + value: QueryAuthorityRequest.encode(message).finish() + }; } - }; - function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { return { address: "" }; } - export const QueryAuthorityResponse = { - encode(message: QueryAuthorityResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", + encode(message: QueryAuthorityResponse, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAuthorityResponse { + fromPartial(object: Partial): QueryAuthorityResponse { const message = createBaseQueryAuthorityResponse(); message.address = object.address ?? ""; return message; + }, + fromAmino(object: QueryAuthorityResponseAmino): QueryAuthorityResponse { + const message = createBaseQueryAuthorityResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { + return QueryAuthorityResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAuthorityResponse): QueryAuthorityResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAuthorityResponse", + value: QueryAuthorityResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAuthorityResponseProtoMsg): QueryAuthorityResponse { + return QueryAuthorityResponse.decode(message.value); + }, + toProto(message: QueryAuthorityResponse): Uint8Array { + return QueryAuthorityResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAuthorityResponse): QueryAuthorityResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", + value: QueryAuthorityResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/upgrade/v1beta1/tx.amino.ts b/src/codegen/cosmos/upgrade/v1beta1/tx.amino.ts index b5e65f6..1734b0f 100644 --- a/src/codegen/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,86 +1,13 @@ -import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; import { MsgSoftwareUpgrade, MsgCancelUpgrade } from "./tx"; -export interface AminoMsgSoftwareUpgrade extends AminoMsg { - type: "cosmos-sdk/MsgSoftwareUpgrade"; - value: { - authority: string; - plan: { - name: string; - time: { - seconds: string; - nanos: number; - }; - height: string; - info: string; - upgraded_client_state: { - type_url: string; - value: Uint8Array; - }; - }; - }; -} -export interface AminoMsgCancelUpgrade extends AminoMsg { - type: "cosmos-sdk/MsgCancelUpgrade"; - value: { - authority: string; - }; -} export const AminoConverter = { "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade": { aminoType: "cosmos-sdk/MsgSoftwareUpgrade", - toAmino: ({ - authority, - plan - }: MsgSoftwareUpgrade): AminoMsgSoftwareUpgrade["value"] => { - return { - authority, - plan: { - name: plan.name, - time: plan.time, - height: plan.height.toString(), - info: plan.info, - upgraded_client_state: { - type_url: plan.upgradedClientState.typeUrl, - value: plan.upgradedClientState.value - } - } - }; - }, - fromAmino: ({ - authority, - plan - }: AminoMsgSoftwareUpgrade["value"]): MsgSoftwareUpgrade => { - return { - authority, - plan: { - name: plan.name, - time: plan.time, - height: Long.fromString(plan.height), - info: plan.info, - upgradedClientState: { - typeUrl: plan.upgraded_client_state.type_url, - value: plan.upgraded_client_state.value - } - } - }; - } + toAmino: MsgSoftwareUpgrade.toAmino, + fromAmino: MsgSoftwareUpgrade.fromAmino }, "/cosmos.upgrade.v1beta1.MsgCancelUpgrade": { aminoType: "cosmos-sdk/MsgCancelUpgrade", - toAmino: ({ - authority - }: MsgCancelUpgrade): AminoMsgCancelUpgrade["value"] => { - return { - authority - }; - }, - fromAmino: ({ - authority - }: AminoMsgCancelUpgrade["value"]): MsgCancelUpgrade => { - return { - authority - }; - } + toAmino: MsgCancelUpgrade.toAmino, + fromAmino: MsgCancelUpgrade.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/upgrade/v1beta1/tx.registry.ts b/src/codegen/cosmos/upgrade/v1beta1/tx.registry.ts index caa3a0e..d7bcb32 100644 --- a/src/codegen/cosmos/upgrade/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/upgrade/v1beta1/tx.registry.ts @@ -14,14 +14,12 @@ export const MessageComposer = { value: MsgSoftwareUpgrade.encode(value).finish() }; }, - cancelUpgrade(value: MsgCancelUpgrade) { return { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", value: MsgCancelUpgrade.encode(value).finish() }; } - }, withTypeUrl: { softwareUpgrade(value: MsgSoftwareUpgrade) { @@ -30,14 +28,12 @@ export const MessageComposer = { value }; }, - cancelUpgrade(value: MsgCancelUpgrade) { return { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", value }; } - }, fromPartial: { softwareUpgrade(value: MsgSoftwareUpgrade) { @@ -46,13 +42,11 @@ export const MessageComposer = { value: MsgSoftwareUpgrade.fromPartial(value) }; }, - cancelUpgrade(value: MsgCancelUpgrade) { return { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", value: MsgCancelUpgrade.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/upgrade/v1beta1/tx.rpc.msg.ts index 901bdbd..cbef95a 100644 --- a/src/codegen/cosmos/upgrade/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeResponse, MsgCancelUpgrade, MsgCancelUpgradeResponse } from "./tx"; /** Msg defines the upgrade Msg service. */ - export interface Msg { /** * SoftwareUpgrade is a governance operation for initiating a software upgrade. @@ -16,28 +15,23 @@ export interface Msg { * * Since: cosmos-sdk 0.46 */ - cancelUpgrade(request: MsgCancelUpgrade): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.upgrade.v1beta1.Msg", "SoftwareUpgrade", data); - return promise.then(data => MsgSoftwareUpgradeResponse.decode(new _m0.Reader(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("cosmos.upgrade.v1beta1.Msg", "CancelUpgrade", data); - return promise.then(data => MsgCancelUpgradeResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgCancelUpgradeResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/upgrade/v1beta1/tx.ts b/src/codegen/cosmos/upgrade/v1beta1/tx.ts index 96238e3..fe58516 100644 --- a/src/codegen/cosmos/upgrade/v1beta1/tx.ts +++ b/src/codegen/cosmos/upgrade/v1beta1/tx.ts @@ -1,64 +1,102 @@ -import { Plan, PlanSDKType } from "./upgrade"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Plan, PlanAmino, PlanSDKType } from "./upgrade"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. * * Since: cosmos-sdk 0.46 */ - export interface MsgSoftwareUpgrade { /** authority is the address of the governance account. */ authority: string; /** plan is the upgrade plan. */ - - plan?: Plan; + plan: Plan; +} +export interface MsgSoftwareUpgradeProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"; + value: Uint8Array; } /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. * * Since: cosmos-sdk 0.46 */ - -export interface MsgSoftwareUpgradeSDKType { +export interface MsgSoftwareUpgradeAmino { /** authority is the address of the governance account. */ - authority: string; + authority?: string; /** plan is the upgrade plan. */ - - plan?: PlanSDKType; + plan?: PlanAmino; +} +export interface MsgSoftwareUpgradeAminoMsg { + type: "cosmos-sdk/MsgSoftwareUpgrade"; + value: MsgSoftwareUpgradeAmino; +} +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeSDKType { + authority: string; + plan: PlanSDKType; } /** * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. * * Since: cosmos-sdk 0.46 */ - export interface MsgSoftwareUpgradeResponse {} +export interface MsgSoftwareUpgradeResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse"; + value: Uint8Array; +} +/** + * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeResponseAmino {} +export interface MsgSoftwareUpgradeResponseAminoMsg { + type: "cosmos-sdk/MsgSoftwareUpgradeResponse"; + value: MsgSoftwareUpgradeResponseAmino; +} /** * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. * * Since: cosmos-sdk 0.46 */ - export interface MsgSoftwareUpgradeResponseSDKType {} /** * MsgCancelUpgrade is the Msg/CancelUpgrade request type. * * Since: cosmos-sdk 0.46 */ - export interface MsgCancelUpgrade { /** authority is the address of the governance account. */ authority: string; } +export interface MsgCancelUpgradeProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade"; + value: Uint8Array; +} /** * MsgCancelUpgrade is the Msg/CancelUpgrade request type. * * Since: cosmos-sdk 0.46 */ - -export interface MsgCancelUpgradeSDKType { +export interface MsgCancelUpgradeAmino { /** authority is the address of the governance account. */ + authority?: string; +} +export interface MsgCancelUpgradeAminoMsg { + type: "cosmos-sdk/MsgCancelUpgrade"; + value: MsgCancelUpgradeAmino; +} +/** + * MsgCancelUpgrade is the Msg/CancelUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeSDKType { authority: string; } /** @@ -66,180 +104,286 @@ export interface MsgCancelUpgradeSDKType { * * Since: cosmos-sdk 0.46 */ - export interface MsgCancelUpgradeResponse {} +export interface MsgCancelUpgradeResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse"; + value: Uint8Array; +} +/** + * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeResponseAmino {} +export interface MsgCancelUpgradeResponseAminoMsg { + type: "cosmos-sdk/MsgCancelUpgradeResponse"; + value: MsgCancelUpgradeResponseAmino; +} /** * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. * * Since: cosmos-sdk 0.46 */ - export interface MsgCancelUpgradeResponseSDKType {} - function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { return { authority: "", - plan: undefined + plan: Plan.fromPartial({}) }; } - export const MsgSoftwareUpgrade = { - encode(message: MsgSoftwareUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); } - if (message.plan !== undefined) { Plan.encode(message.plan, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgrade { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.authority = reader.string(); break; - case 2: message.plan = Plan.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSoftwareUpgrade { + fromPartial(object: Partial): MsgSoftwareUpgrade { const message = createBaseMsgSoftwareUpgrade(); message.authority = object.authority ?? ""; message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; return message; + }, + fromAmino(object: MsgSoftwareUpgradeAmino): MsgSoftwareUpgrade { + const message = createBaseMsgSoftwareUpgrade(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + return message; + }, + toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSoftwareUpgradeAminoMsg): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.fromAmino(object.value); + }, + toAminoMsg(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoMsg { + return { + type: "cosmos-sdk/MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSoftwareUpgradeProtoMsg): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.decode(message.value); + }, + toProto(message: MsgSoftwareUpgrade): Uint8Array { + return MsgSoftwareUpgrade.encode(message).finish(); + }, + toProtoMsg(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.encode(message).finish() + }; } - }; - function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { return {}; } - export const MsgSoftwareUpgradeResponse = { - encode(_: MsgSoftwareUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", + encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgSoftwareUpgradeResponse { + fromPartial(_: Partial): MsgSoftwareUpgradeResponse { const message = createBaseMsgSoftwareUpgradeResponse(); return message; + }, + fromAmino(_: MsgSoftwareUpgradeResponseAmino): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, + toAmino(_: MsgSoftwareUpgradeResponse): MsgSoftwareUpgradeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSoftwareUpgradeResponseAminoMsg): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSoftwareUpgradeResponse): MsgSoftwareUpgradeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSoftwareUpgradeResponse", + value: MsgSoftwareUpgradeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSoftwareUpgradeResponseProtoMsg): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.decode(message.value); + }, + toProto(message: MsgSoftwareUpgradeResponse): Uint8Array { + return MsgSoftwareUpgradeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSoftwareUpgradeResponse): MsgSoftwareUpgradeResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", + value: MsgSoftwareUpgradeResponse.encode(message).finish() + }; } - }; - function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { return { authority: "" }; } - export const MsgCancelUpgrade = { - encode(message: MsgCancelUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + encode(message: MsgCancelUpgrade, writer: BinaryWriter = BinaryWriter.create()): 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 : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.authority = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCancelUpgrade { + fromPartial(object: Partial): MsgCancelUpgrade { const message = createBaseMsgCancelUpgrade(); message.authority = object.authority ?? ""; return message; + }, + fromAmino(object: MsgCancelUpgradeAmino): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { + const obj: any = {}; + obj.authority = message.authority; + return obj; + }, + fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { + return MsgCancelUpgrade.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUpgrade): MsgCancelUpgradeAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUpgrade", + value: MsgCancelUpgrade.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelUpgradeProtoMsg): MsgCancelUpgrade { + return MsgCancelUpgrade.decode(message.value); + }, + toProto(message: MsgCancelUpgrade): Uint8Array { + return MsgCancelUpgrade.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUpgrade): MsgCancelUpgradeProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.encode(message).finish() + }; } - }; - function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { return {}; } - export const MsgCancelUpgradeResponse = { - encode(_: MsgCancelUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", + encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelUpgradeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgCancelUpgradeResponse { + fromPartial(_: Partial): MsgCancelUpgradeResponse { const message = createBaseMsgCancelUpgradeResponse(); return message; + }, + fromAmino(_: MsgCancelUpgradeResponseAmino): MsgCancelUpgradeResponse { + const message = createBaseMsgCancelUpgradeResponse(); + return message; + }, + toAmino(_: MsgCancelUpgradeResponse): MsgCancelUpgradeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCancelUpgradeResponseAminoMsg): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUpgradeResponse): MsgCancelUpgradeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUpgradeResponse", + value: MsgCancelUpgradeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelUpgradeResponseProtoMsg): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.decode(message.value); + }, + toProto(message: MsgCancelUpgradeResponse): Uint8Array { + return MsgCancelUpgradeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUpgradeResponse): MsgCancelUpgradeResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", + value: MsgCancelUpgradeResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/upgrade/v1beta1/upgrade.ts b/src/codegen/cosmos/upgrade/v1beta1/upgrade.ts index eac80f6..2033c7a 100644 --- a/src/codegen/cosmos/upgrade/v1beta1/upgrade.ts +++ b/src/codegen/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,9 +1,8 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { toTimestamp, fromTimestamp, Long, DeepPartial } from "../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** 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 @@ -20,35 +19,32 @@ export interface Plan { * has been removed from the SDK. * If this field is not empty, an error will be thrown. */ - /** @deprecated */ - - time?: Date; + time: Date; /** * The height at which the upgrade must be performed. * Only used if Time is not set. */ - - height: Long; + height: bigint; /** * Any application specific upgrade info to be included on-chain * such as a git commit that validators could automatically upgrade to */ - info: string; /** * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been * moved to the IBC module in the sub module 02-client. * If this field is not empty, an error will be thrown. */ - /** @deprecated */ - upgradedClientState?: Any; } +export interface PlanProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.Plan"; + value: Uint8Array; +} /** Plan specifies information about a planned upgrade and when it should occur. */ - -export interface PlanSDKType { +export interface PlanAmino { /** * Sets the name for the upgrade. This name will be used by the upgraded * version of the software to apply any special "on-upgrade" commands during @@ -58,36 +54,44 @@ export interface PlanSDKType { * assumed that the software is out-of-date when the upgrade Time or Height is * reached and the software will exit. */ - name: string; + 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; + time?: string; /** * The height at which the upgrade must be performed. * Only used if Time is not set. */ - - height: Long; + height?: string; /** * Any application specific upgrade info to be included on-chain * such as a git commit that validators could automatically upgrade to */ - - info: string; + info?: string; /** * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been * moved to the IBC module in the sub module 02-client. * If this field is not empty, an error will be thrown. */ - /** @deprecated */ - + upgraded_client_state?: AnyAmino; +} +export interface PlanAminoMsg { + type: "cosmos-sdk/Plan"; + value: PlanAmino; +} +/** Plan specifies information about a planned upgrade and when it should occur. */ +export interface PlanSDKType { + name: string; + /** @deprecated */ + time: Date; + height: bigint; + info: string; + /** @deprecated */ upgraded_client_state?: AnySDKType; } /** @@ -96,13 +100,31 @@ export interface PlanSDKType { * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov * proposals, see MsgSoftwareUpgrade. */ - /** @deprecated */ - export interface SoftwareUpgradeProposal { title: string; description: string; - plan?: Plan; + plan: Plan; +} +export interface SoftwareUpgradeProposalProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; + value: Uint8Array; +} +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + */ +/** @deprecated */ +export interface SoftwareUpgradeProposalAmino { + title?: string; + description?: string; + plan?: PlanAmino; +} +export interface SoftwareUpgradeProposalAminoMsg { + type: "cosmos-sdk/SoftwareUpgradeProposal"; + value: SoftwareUpgradeProposalAmino; } /** * SoftwareUpgradeProposal is a gov Content type for initiating a software @@ -110,13 +132,11 @@ export interface SoftwareUpgradeProposal { * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov * proposals, see MsgSoftwareUpgrade. */ - /** @deprecated */ - export interface SoftwareUpgradeProposalSDKType { title: string; description: string; - plan?: PlanSDKType; + plan: PlanSDKType; } /** * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software @@ -124,22 +144,37 @@ export interface SoftwareUpgradeProposalSDKType { * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov * proposals, see MsgCancelUpgrade. */ - /** @deprecated */ - export interface CancelSoftwareUpgradeProposal { title: string; description: string; } +export interface CancelSoftwareUpgradeProposalProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; + value: Uint8Array; +} +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + */ +/** @deprecated */ +export interface CancelSoftwareUpgradeProposalAmino { + title?: string; + description?: string; +} +export interface CancelSoftwareUpgradeProposalAminoMsg { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal"; + value: CancelSoftwareUpgradeProposalAmino; +} /** * 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 CancelSoftwareUpgradeProposalSDKType { title: string; description: string; @@ -149,284 +184,409 @@ export interface CancelSoftwareUpgradeProposalSDKType { * * Since: cosmos-sdk 0.43 */ - export interface ModuleVersion { /** name of the app module */ name: string; /** consensus version of the app module */ - - version: Long; + version: bigint; +} +export interface ModuleVersionProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion"; + value: Uint8Array; } /** * ModuleVersion specifies a module and its consensus version. * * Since: cosmos-sdk 0.43 */ - -export interface ModuleVersionSDKType { +export interface ModuleVersionAmino { /** name of the app module */ - name: string; + name?: string; /** consensus version of the app module */ - - version: Long; + version?: string; +} +export interface ModuleVersionAminoMsg { + type: "cosmos-sdk/ModuleVersion"; + value: ModuleVersionAmino; +} +/** + * ModuleVersion specifies a module and its consensus version. + * + * Since: cosmos-sdk 0.43 + */ +export interface ModuleVersionSDKType { + name: string; + version: bigint; } - function createBasePlan(): Plan { return { name: "", - time: undefined, - height: Long.ZERO, + time: new Date(), + height: BigInt(0), info: "", upgradedClientState: undefined }; } - export const Plan = { - encode(message: Plan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.Plan", + encode(message: Plan, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(24).int64(message.height); } - if (message.info !== "") { writer.uint32(34).string(message.info); } - if (message.upgradedClientState !== undefined) { Any.encode(message.upgradedClientState, writer.uint32(42).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Plan { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 3: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 4: message.info = reader.string(); break; - case 5: message.upgradedClientState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Plan { + fromPartial(object: Partial): Plan { const message = createBasePlan(); message.name = object.name ?? ""; message.time = object.time ?? undefined; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.info = object.info ?? ""; message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; return message; + }, + fromAmino(object: PlanAmino): Plan { + const message = createBasePlan(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + return message; + }, + toAmino(message: Plan): PlanAmino { + const obj: any = {}; + obj.name = message.name; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.height = message.height ? message.height.toString() : undefined; + obj.info = message.info; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + return obj; + }, + fromAminoMsg(object: PlanAminoMsg): Plan { + return Plan.fromAmino(object.value); + }, + toAminoMsg(message: Plan): PlanAminoMsg { + return { + type: "cosmos-sdk/Plan", + value: Plan.toAmino(message) + }; + }, + fromProtoMsg(message: PlanProtoMsg): Plan { + return Plan.decode(message.value); + }, + toProto(message: Plan): Uint8Array { + return Plan.encode(message).finish(); + }, + toProtoMsg(message: Plan): PlanProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.Plan", + value: Plan.encode(message).finish() + }; } - }; - function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { return { title: "", description: "", - plan: undefined + plan: Plan.fromPartial({}) }; } - export const SoftwareUpgradeProposal = { - encode(message: SoftwareUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.plan !== undefined) { Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SoftwareUpgradeProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.title = reader.string(); break; - case 2: message.description = reader.string(); break; - case 3: message.plan = Plan.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SoftwareUpgradeProposal { + fromPartial(object: Partial): SoftwareUpgradeProposal { const message = createBaseSoftwareUpgradeProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; return message; + }, + fromAmino(object: SoftwareUpgradeProposalAmino): SoftwareUpgradeProposal { + const message = createBaseSoftwareUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + return message; + }, + toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + return obj; + }, + fromAminoMsg(object: SoftwareUpgradeProposalAminoMsg): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: SoftwareUpgradeProposalProtoMsg): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.decode(message.value); + }, + toProto(message: SoftwareUpgradeProposal): Uint8Array { + return SoftwareUpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(message).finish() + }; } - }; - function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { return { title: "", description: "" }; } - export const CancelSoftwareUpgradeProposal = { - encode(message: CancelSoftwareUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.title = reader.string(); break; - case 2: message.description = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CancelSoftwareUpgradeProposal { + fromPartial(object: Partial): CancelSoftwareUpgradeProposal { const message = createBaseCancelSoftwareUpgradeProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; return message; + }, + fromAmino(object: CancelSoftwareUpgradeProposalAmino): CancelSoftwareUpgradeProposal { + const message = createBaseCancelSoftwareUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + return obj; + }, + fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: CancelSoftwareUpgradeProposalProtoMsg): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.decode(message.value); + }, + toProto(message: CancelSoftwareUpgradeProposal): Uint8Array { + return CancelSoftwareUpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(message).finish() + }; } - }; - function createBaseModuleVersion(): ModuleVersion { return { name: "", - version: Long.UZERO + version: BigInt(0) }; } - export const ModuleVersion = { - encode(message: ModuleVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", + encode(message: ModuleVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - - if (!message.version.isZero()) { + if (message.version !== BigInt(0)) { writer.uint32(16).uint64(message.version); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ModuleVersion { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseModuleVersion(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: - message.version = (reader.uint64() as Long); + message.version = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ModuleVersion { + fromPartial(object: Partial): ModuleVersion { const message = createBaseModuleVersion(); message.name = object.name ?? ""; - message.version = object.version !== undefined && object.version !== null ? Long.fromValue(object.version) : Long.UZERO; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); return message; + }, + fromAmino(object: ModuleVersionAmino): ModuleVersion { + const message = createBaseModuleVersion(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + return message; + }, + toAmino(message: ModuleVersion): ModuleVersionAmino { + const obj: any = {}; + obj.name = message.name; + obj.version = message.version ? message.version.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { + return ModuleVersion.fromAmino(object.value); + }, + toAminoMsg(message: ModuleVersion): ModuleVersionAminoMsg { + return { + type: "cosmos-sdk/ModuleVersion", + value: ModuleVersion.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleVersionProtoMsg): ModuleVersion { + return ModuleVersion.decode(message.value); + }, + toProto(message: ModuleVersion): Uint8Array { + return ModuleVersion.encode(message).finish(); + }, + toProtoMsg(message: ModuleVersion): ModuleVersionProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", + value: ModuleVersion.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/vesting/v1beta1/tx.amino.ts b/src/codegen/cosmos/vesting/v1beta1/tx.amino.ts index 5f402b9..a197b23 100644 --- a/src/codegen/cosmos/vesting/v1beta1/tx.amino.ts +++ b/src/codegen/cosmos/vesting/v1beta1/tx.amino.ts @@ -1,155 +1,18 @@ -import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; -export interface AminoMsgCreateVestingAccount extends AminoMsg { - type: "cosmos-sdk/MsgCreateVestingAccount"; - value: { - from_address: string; - to_address: string; - amount: { - denom: string; - amount: string; - }[]; - end_time: string; - delayed: boolean; - }; -} -export interface AminoMsgCreatePermanentLockedAccount extends AminoMsg { - type: "cosmos-sdk/MsgCreatePermanentLockedAccount"; - value: { - from_address: string; - to_address: string; - amount: { - denom: string; - amount: string; - }[]; - }; -} -export interface AminoMsgCreatePeriodicVestingAccount extends AminoMsg { - type: "cosmos-sdk/MsgCreatePeriodicVestingAccount"; - value: { - from_address: string; - to_address: string; - start_time: string; - vesting_periods: { - length: string; - amount: { - denom: string; - amount: string; - }[]; - }[]; - }; -} export const AminoConverter = { "/cosmos.vesting.v1beta1.MsgCreateVestingAccount": { aminoType: "cosmos-sdk/MsgCreateVestingAccount", - toAmino: ({ - fromAddress, - toAddress, - amount, - endTime, - delayed - }: MsgCreateVestingAccount): AminoMsgCreateVestingAccount["value"] => { - return { - from_address: fromAddress, - to_address: toAddress, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })), - end_time: endTime.toString(), - delayed - }; - }, - fromAmino: ({ - from_address, - to_address, - amount, - end_time, - delayed - }: AminoMsgCreateVestingAccount["value"]): MsgCreateVestingAccount => { - return { - fromAddress: from_address, - toAddress: to_address, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })), - endTime: Long.fromString(end_time), - delayed - }; - } + toAmino: MsgCreateVestingAccount.toAmino, + fromAmino: MsgCreateVestingAccount.fromAmino }, "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount": { aminoType: "cosmos-sdk/MsgCreatePermanentLockedAccount", - toAmino: ({ - fromAddress, - toAddress, - amount - }: MsgCreatePermanentLockedAccount): AminoMsgCreatePermanentLockedAccount["value"] => { - return { - from_address: fromAddress, - to_address: toAddress, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })) - }; - }, - fromAmino: ({ - from_address, - to_address, - amount - }: AminoMsgCreatePermanentLockedAccount["value"]): MsgCreatePermanentLockedAccount => { - return { - fromAddress: from_address, - toAddress: to_address, - amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount - })) - }; - } + toAmino: MsgCreatePermanentLockedAccount.toAmino, + fromAmino: MsgCreatePermanentLockedAccount.fromAmino }, "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount": { aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccount", - toAmino: ({ - fromAddress, - toAddress, - startTime, - vestingPeriods - }: MsgCreatePeriodicVestingAccount): AminoMsgCreatePeriodicVestingAccount["value"] => { - return { - from_address: fromAddress, - to_address: toAddress, - start_time: startTime.toString(), - vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), - amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount - })) - })) - }; - }, - fromAmino: ({ - from_address, - to_address, - start_time, - vesting_periods - }: AminoMsgCreatePeriodicVestingAccount["value"]): MsgCreatePeriodicVestingAccount => { - return { - fromAddress: from_address, - toAddress: to_address, - startTime: Long.fromString(start_time), - vestingPeriods: vesting_periods.map(el0 => ({ - length: Long.fromString(el0.length), - amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount - })) - })) - }; - } + toAmino: MsgCreatePeriodicVestingAccount.toAmino, + fromAmino: MsgCreatePeriodicVestingAccount.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/cosmos/vesting/v1beta1/tx.registry.ts b/src/codegen/cosmos/vesting/v1beta1/tx.registry.ts index d9679e7..4084be1 100644 --- a/src/codegen/cosmos/vesting/v1beta1/tx.registry.ts +++ b/src/codegen/cosmos/vesting/v1beta1/tx.registry.ts @@ -14,21 +14,18 @@ export const MessageComposer = { value: MsgCreateVestingAccount.encode(value).finish() }; }, - createPermanentLockedAccount(value: MsgCreatePermanentLockedAccount) { return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", value: MsgCreatePermanentLockedAccount.encode(value).finish() }; }, - createPeriodicVestingAccount(value: MsgCreatePeriodicVestingAccount) { return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value: MsgCreatePeriodicVestingAccount.encode(value).finish() }; } - }, withTypeUrl: { createVestingAccount(value: MsgCreateVestingAccount) { @@ -37,21 +34,18 @@ export const MessageComposer = { value }; }, - createPermanentLockedAccount(value: MsgCreatePermanentLockedAccount) { return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", value }; }, - createPeriodicVestingAccount(value: MsgCreatePeriodicVestingAccount) { return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value }; } - }, fromPartial: { createVestingAccount(value: MsgCreateVestingAccount) { @@ -60,20 +54,17 @@ export const MessageComposer = { value: MsgCreateVestingAccount.fromPartial(value) }; }, - createPermanentLockedAccount(value: MsgCreatePermanentLockedAccount) { return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", value: MsgCreatePermanentLockedAccount.fromPartial(value) }; }, - createPeriodicVestingAccount(value: MsgCreatePeriodicVestingAccount) { return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value: MsgCreatePeriodicVestingAccount.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/src/codegen/cosmos/vesting/v1beta1/tx.rpc.msg.ts index f0728ea..b30e2e7 100644 --- a/src/codegen/cosmos/vesting/v1beta1/tx.rpc.msg.ts +++ b/src/codegen/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgCreateVestingAccount, MsgCreateVestingAccountResponse, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountResponse, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountResponse } from "./tx"; /** Msg defines the bank Msg service. */ - export interface Msg { /** * CreateVestingAccount defines a method that enables creating a vesting @@ -13,41 +12,34 @@ export interface Msg { * CreatePermanentLockedAccount defines a method that enables creating a permanent * locked account. */ - createPermanentLockedAccount(request: MsgCreatePermanentLockedAccount): Promise; /** * CreatePeriodicVestingAccount defines a method that enables creating a * periodic vesting account. */ - createPeriodicVestingAccount(request: MsgCreatePeriodicVestingAccount): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { 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("cosmos.vesting.v1beta1.Msg", "CreateVestingAccount", data); - return promise.then(data => MsgCreateVestingAccountResponse.decode(new _m0.Reader(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("cosmos.vesting.v1beta1.Msg", "CreatePermanentLockedAccount", data); - return promise.then(data => MsgCreatePermanentLockedAccountResponse.decode(new _m0.Reader(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("cosmos.vesting.v1beta1.Msg", "CreatePeriodicVestingAccount", data); - return promise.then(data => MsgCreatePeriodicVestingAccountResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgCreatePeriodicVestingAccountResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/cosmos/vesting/v1beta1/tx.ts b/src/codegen/cosmos/vesting/v1beta1/tx.ts index 2ab2df8..ef0baae 100644 --- a/src/codegen/cosmos/vesting/v1beta1/tx.ts +++ b/src/codegen/cosmos/vesting/v1beta1/tx.ts @@ -1,217 +1,346 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Period, PeriodSDKType } from "./vesting"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Period, PeriodAmino, PeriodSDKType } from "./vesting"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting * account. */ - export interface MsgCreateVestingAccount { fromAddress: string; toAddress: string; amount: Coin[]; - endTime: Long; + endTime: bigint; delayed: boolean; } +export interface MsgCreateVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreateVestingAccountAmino { + from_address?: string; + to_address?: string; + amount?: CoinAmino[]; + end_time?: string; + delayed?: boolean; +} +export interface MsgCreateVestingAccountAminoMsg { + type: "cosmos-sdk/MsgCreateVestingAccount"; + value: MsgCreateVestingAccountAmino; +} /** * MsgCreateVestingAccount defines a message that enables creating a vesting * account. */ - export interface MsgCreateVestingAccountSDKType { from_address: string; to_address: string; amount: CoinSDKType[]; - end_time: Long; + end_time: bigint; delayed: boolean; } /** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ - export interface MsgCreateVestingAccountResponse {} +export interface MsgCreateVestingAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse"; + value: Uint8Array; +} +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponseAmino {} +export interface MsgCreateVestingAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreateVestingAccountResponse"; + value: MsgCreateVestingAccountResponseAmino; +} /** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ - export interface MsgCreateVestingAccountResponseSDKType {} /** * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent * locked account. */ - export interface MsgCreatePermanentLockedAccount { fromAddress: string; toAddress: string; amount: Coin[]; } +export interface MsgCreatePermanentLockedAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount"; + value: Uint8Array; +} +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + */ +export interface MsgCreatePermanentLockedAccountAmino { + from_address?: string; + to_address?: string; + amount?: CoinAmino[]; +} +export interface MsgCreatePermanentLockedAccountAminoMsg { + type: "cosmos-sdk/MsgCreatePermanentLockedAccount"; + value: MsgCreatePermanentLockedAccountAmino; +} /** * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent * locked account. */ - export interface MsgCreatePermanentLockedAccountSDKType { from_address: string; to_address: string; amount: CoinSDKType[]; } /** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ - export interface MsgCreatePermanentLockedAccountResponse {} +export interface MsgCreatePermanentLockedAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse"; + value: Uint8Array; +} +/** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ +export interface MsgCreatePermanentLockedAccountResponseAmino {} +export interface MsgCreatePermanentLockedAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse"; + value: MsgCreatePermanentLockedAccountResponseAmino; +} /** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ - export interface MsgCreatePermanentLockedAccountResponseSDKType {} /** * MsgCreateVestingAccount defines a message that enables creating a vesting * account. */ - export interface MsgCreatePeriodicVestingAccount { fromAddress: string; toAddress: string; - startTime: Long; + startTime: bigint; vestingPeriods: Period[]; } +export interface MsgCreatePeriodicVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreatePeriodicVestingAccountAmino { + from_address?: string; + to_address?: string; + start_time?: string; + vesting_periods?: PeriodAmino[]; +} +export interface MsgCreatePeriodicVestingAccountAminoMsg { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccount"; + value: MsgCreatePeriodicVestingAccountAmino; +} /** * MsgCreateVestingAccount defines a message that enables creating a vesting * account. */ - export interface MsgCreatePeriodicVestingAccountSDKType { from_address: string; to_address: string; - start_time: Long; + start_time: bigint; vesting_periods: PeriodSDKType[]; } /** * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount * response type. */ - export interface MsgCreatePeriodicVestingAccountResponse {} +export interface MsgCreatePeriodicVestingAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + */ +export interface MsgCreatePeriodicVestingAccountResponseAmino {} +export interface MsgCreatePeriodicVestingAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse"; + value: MsgCreatePeriodicVestingAccountResponseAmino; +} /** * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount * response type. */ - export interface MsgCreatePeriodicVestingAccountResponseSDKType {} - function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { return { fromAddress: "", toAddress: "", amount: [], - endTime: Long.ZERO, + endTime: BigInt(0), delayed: false }; } - export const MsgCreateVestingAccount = { - encode(message: MsgCreateVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== "") { writer.uint32(18).string(message.toAddress); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - - if (!message.endTime.isZero()) { + if (message.endTime !== BigInt(0)) { writer.uint32(32).int64(message.endTime); } - if (message.delayed === true) { writer.uint32(40).bool(message.delayed); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateVestingAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.fromAddress = reader.string(); break; - case 2: message.toAddress = reader.string(); break; - case 3: message.amount.push(Coin.decode(reader, reader.uint32())); break; - case 4: - message.endTime = (reader.int64() as Long); + message.endTime = reader.int64(); break; - case 5: message.delayed = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateVestingAccount { + fromPartial(object: Partial): MsgCreateVestingAccount { const message = createBaseMsgCreateVestingAccount(); message.fromAddress = object.fromAddress ?? ""; message.toAddress = object.toAddress ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; - message.endTime = object.endTime !== undefined && object.endTime !== null ? Long.fromValue(object.endTime) : Long.ZERO; + message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); message.delayed = object.delayed ?? false; return message; + }, + fromAmino(object: MsgCreateVestingAccountAmino): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.end_time !== undefined && object.end_time !== null) { + message.endTime = BigInt(object.end_time); + } + if (object.delayed !== undefined && object.delayed !== null) { + message.delayed = object.delayed; + } + return message; + }, + toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress; + obj.to_address = message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.delayed = message.delayed; + return obj; + }, + fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateVestingAccount): MsgCreateVestingAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreateVestingAccount", + value: MsgCreateVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateVestingAccountProtoMsg): MsgCreateVestingAccount { + return MsgCreateVestingAccount.decode(message.value); + }, + toProto(message: MsgCreateVestingAccount): Uint8Array { + return MsgCreateVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateVestingAccount): MsgCreateVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + value: MsgCreateVestingAccount.encode(message).finish() + }; } - }; - function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { return {}; } - export const MsgCreateVestingAccountResponse = { - encode(_: MsgCreateVestingAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateVestingAccountResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgCreateVestingAccountResponse { + fromPartial(_: Partial): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, + fromAmino(_: MsgCreateVestingAccountResponseAmino): MsgCreateVestingAccountResponse { const message = createBaseMsgCreateVestingAccountResponse(); return message; + }, + toAmino(_: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateVestingAccountResponseAminoMsg): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateVestingAccountResponse", + value: MsgCreateVestingAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateVestingAccountResponseProtoMsg): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.decode(message.value); + }, + toProto(message: MsgCreateVestingAccountResponse): Uint8Array { + return MsgCreateVestingAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", + value: MsgCreateVestingAccountResponse.encode(message).finish() + }; } - }; - function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { return { fromAddress: "", @@ -219,203 +348,310 @@ function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAc amount: [] }; } - export const MsgCreatePermanentLockedAccount = { - encode(message: MsgCreatePermanentLockedAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== "") { writer.uint32(18).string(message.toAddress); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreatePermanentLockedAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.fromAddress = reader.string(); break; - case 2: message.toAddress = reader.string(); break; - case 3: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreatePermanentLockedAccount { + fromPartial(object: Partial): MsgCreatePermanentLockedAccount { const message = createBaseMsgCreatePermanentLockedAccount(); message.fromAddress = object.fromAddress ?? ""; message.toAddress = object.toAddress ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgCreatePermanentLockedAccountAmino): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress; + obj.to_address = message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgCreatePermanentLockedAccountAminoMsg): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePermanentLockedAccount", + value: MsgCreatePermanentLockedAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePermanentLockedAccountProtoMsg): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.decode(message.value); + }, + toProto(message: MsgCreatePermanentLockedAccount): Uint8Array { + return MsgCreatePermanentLockedAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + value: MsgCreatePermanentLockedAccount.encode(message).finish() + }; } - }; - function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { return {}; } - export const MsgCreatePermanentLockedAccountResponse = { - encode(_: MsgCreatePermanentLockedAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreatePermanentLockedAccountResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgCreatePermanentLockedAccountResponse { + fromPartial(_: Partial): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, + fromAmino(_: MsgCreatePermanentLockedAccountResponseAmino): MsgCreatePermanentLockedAccountResponse { const message = createBaseMsgCreatePermanentLockedAccountResponse(); return message; + }, + toAmino(_: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreatePermanentLockedAccountResponseAminoMsg): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse", + value: MsgCreatePermanentLockedAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePermanentLockedAccountResponseProtoMsg): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.decode(message.value); + }, + toProto(message: MsgCreatePermanentLockedAccountResponse): Uint8Array { + return MsgCreatePermanentLockedAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + value: MsgCreatePermanentLockedAccountResponse.encode(message).finish() + }; } - }; - function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { return { fromAddress: "", toAddress: "", - startTime: Long.ZERO, + startTime: BigInt(0), vestingPeriods: [] }; } - export const MsgCreatePeriodicVestingAccount = { - encode(message: MsgCreatePeriodicVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== "") { writer.uint32(18).string(message.toAddress); } - - if (!message.startTime.isZero()) { + if (message.startTime !== BigInt(0)) { writer.uint32(24).int64(message.startTime); } - for (const v of message.vestingPeriods) { Period.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreatePeriodicVestingAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.fromAddress = reader.string(); break; - case 2: message.toAddress = reader.string(); break; - case 3: - message.startTime = (reader.int64() as Long); + message.startTime = reader.int64(); break; - case 4: message.vestingPeriods.push(Period.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreatePeriodicVestingAccount { + fromPartial(object: Partial): MsgCreatePeriodicVestingAccount { const message = createBaseMsgCreatePeriodicVestingAccount(); message.fromAddress = object.fromAddress ?? ""; message.toAddress = object.toAddress ?? ""; - message.startTime = object.startTime !== undefined && object.startTime !== null ? Long.fromValue(object.startTime) : Long.ZERO; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; return message; + }, + fromAmino(object: MsgCreatePeriodicVestingAccountAmino): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + message.vestingPeriods = object.vesting_periods?.map(e => Period.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress; + obj.to_address = message.toAddress; + obj.start_time = message.startTime ? message.startTime.toString() : undefined; + if (message.vestingPeriods) { + obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); + } else { + obj.vesting_periods = []; + } + return obj; + }, + fromAminoMsg(object: MsgCreatePeriodicVestingAccountAminoMsg): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccount", + value: MsgCreatePeriodicVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePeriodicVestingAccountProtoMsg): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.decode(message.value); + }, + toProto(message: MsgCreatePeriodicVestingAccount): Uint8Array { + return MsgCreatePeriodicVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + value: MsgCreatePeriodicVestingAccount.encode(message).finish() + }; } - }; - function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { return {}; } - export const MsgCreatePeriodicVestingAccountResponse = { - encode(_: MsgCreatePeriodicVestingAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreatePeriodicVestingAccountResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgCreatePeriodicVestingAccountResponse { + fromPartial(_: Partial): MsgCreatePeriodicVestingAccountResponse { + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + return message; + }, + fromAmino(_: MsgCreatePeriodicVestingAccountResponseAmino): MsgCreatePeriodicVestingAccountResponse { const message = createBaseMsgCreatePeriodicVestingAccountResponse(); return message; + }, + toAmino(_: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreatePeriodicVestingAccountResponseAminoMsg): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse", + value: MsgCreatePeriodicVestingAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePeriodicVestingAccountResponseProtoMsg): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.decode(message.value); + }, + toProto(message: MsgCreatePeriodicVestingAccountResponse): Uint8Array { + return MsgCreatePeriodicVestingAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + value: MsgCreatePeriodicVestingAccountResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos/vesting/v1beta1/vesting.ts b/src/codegen/cosmos/vesting/v1beta1/vesting.ts index f1c5e0a..8e6ac28 100644 --- a/src/codegen/cosmos/vesting/v1beta1/vesting.ts +++ b/src/codegen/cosmos/vesting/v1beta1/vesting.ts @@ -1,97 +1,167 @@ -import { BaseAccount, BaseAccountSDKType } from "../../auth/v1beta1/auth"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { BaseAccount, BaseAccountAmino, BaseAccountSDKType } from "../../auth/v1beta1/auth"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all * the necessary fields needed for any vesting account implementation. */ - export interface BaseVestingAccount { baseAccount?: BaseAccount; originalVesting: Coin[]; delegatedFree: Coin[]; delegatedVesting: Coin[]; - endTime: Long; + endTime: bigint; +} +export interface BaseVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount"; + value: Uint8Array; +} +/** + * BaseVestingAccount implements the VestingAccount interface. It contains all + * the necessary fields needed for any vesting account implementation. + */ +export interface BaseVestingAccountAmino { + base_account?: BaseAccountAmino; + original_vesting?: CoinAmino[]; + delegated_free?: CoinAmino[]; + delegated_vesting?: CoinAmino[]; + end_time?: string; +} +export interface BaseVestingAccountAminoMsg { + type: "cosmos-sdk/BaseVestingAccount"; + value: BaseVestingAccountAmino; } /** * BaseVestingAccount implements the VestingAccount interface. It contains all * the necessary fields needed for any vesting account implementation. */ - export interface BaseVestingAccountSDKType { base_account?: BaseAccountSDKType; original_vesting: CoinSDKType[]; delegated_free: CoinSDKType[]; delegated_vesting: CoinSDKType[]; - end_time: Long; + end_time: bigint; } /** * ContinuousVestingAccount implements the VestingAccount interface. It * continuously vests by unlocking coins linearly with respect to time. */ - export interface ContinuousVestingAccount { baseVestingAccount?: BaseVestingAccount; - startTime: Long; + startTime: bigint; +} +export interface ContinuousVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount"; + value: Uint8Array; +} +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; + start_time?: string; +} +export interface ContinuousVestingAccountAminoMsg { + type: "cosmos-sdk/ContinuousVestingAccount"; + value: ContinuousVestingAccountAmino; } /** * ContinuousVestingAccount implements the VestingAccount interface. It * continuously vests by unlocking coins linearly with respect to time. */ - export interface ContinuousVestingAccountSDKType { base_vesting_account?: BaseVestingAccountSDKType; - start_time: Long; + start_time: bigint; } /** * DelayedVestingAccount implements the VestingAccount interface. It vests all * coins after a specific time, but non prior. In other words, it keeps them * locked until a specified time. */ - export interface DelayedVestingAccount { baseVestingAccount?: BaseVestingAccount; } +export interface DelayedVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount"; + value: Uint8Array; +} +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; +} +export interface DelayedVestingAccountAminoMsg { + type: "cosmos-sdk/DelayedVestingAccount"; + value: DelayedVestingAccountAmino; +} /** * 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 DelayedVestingAccountSDKType { base_vesting_account?: BaseVestingAccountSDKType; } /** Period defines a length of time and amount of coins that will vest. */ - export interface Period { - length: Long; + length: bigint; amount: Coin[]; } +export interface PeriodProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.Period"; + value: Uint8Array; +} +/** Period defines a length of time and amount of coins that will vest. */ +export interface PeriodAmino { + length?: string; + amount?: CoinAmino[]; +} +export interface PeriodAminoMsg { + type: "cosmos-sdk/Period"; + value: PeriodAmino; +} /** Period defines a length of time and amount of coins that will vest. */ - export interface PeriodSDKType { - length: Long; + length: bigint; amount: CoinSDKType[]; } /** * PeriodicVestingAccount implements the VestingAccount interface. It * periodically vests by unlocking coins during each specified period. */ - export interface PeriodicVestingAccount { baseVestingAccount?: BaseVestingAccount; - startTime: Long; + startTime: bigint; vestingPeriods: Period[]; } +export interface PeriodicVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount"; + value: Uint8Array; +} +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; + start_time?: string; + vesting_periods?: PeriodAmino[]; +} +export interface PeriodicVestingAccountAminoMsg { + type: "cosmos-sdk/PeriodicVestingAccount"; + value: PeriodicVestingAccountAmino; +} /** * PeriodicVestingAccount implements the VestingAccount interface. It * periodically vests by unlocking coins during each specified period. */ - export interface PeriodicVestingAccountSDKType { base_vesting_account?: BaseVestingAccountSDKType; - start_time: Long; + start_time: bigint; vesting_periods: PeriodSDKType[]; } /** @@ -101,10 +171,27 @@ export interface PeriodicVestingAccountSDKType { * * Since: cosmos-sdk 0.43 */ - export interface PermanentLockedAccount { baseVestingAccount?: BaseVestingAccount; } +export interface PermanentLockedAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount"; + value: Uint8Array; +} +/** + * PermanentLockedAccount implements the VestingAccount interface. It does + * not ever release coins, locking them indefinitely. Coins in this account can + * still be used for delegating and for governance votes even while locked. + * + * Since: cosmos-sdk 0.43 + */ +export interface PermanentLockedAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; +} +export interface PermanentLockedAccountAminoMsg { + type: "cosmos-sdk/PermanentLockedAccount"; + value: PermanentLockedAccountAmino; +} /** * PermanentLockedAccount implements the VestingAccount interface. It does * not ever release coins, locking them indefinitely. Coins in this account can @@ -112,357 +199,526 @@ export interface PermanentLockedAccount { * * Since: cosmos-sdk 0.43 */ - export interface PermanentLockedAccountSDKType { base_vesting_account?: BaseVestingAccountSDKType; } - function createBaseBaseVestingAccount(): BaseVestingAccount { return { baseAccount: undefined, originalVesting: [], delegatedFree: [], delegatedVesting: [], - endTime: Long.ZERO + endTime: BigInt(0) }; } - export const BaseVestingAccount = { - encode(message: BaseVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", + encode(message: BaseVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseAccount !== undefined) { BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); } - for (const v of message.originalVesting) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.delegatedFree) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.delegatedVesting) { Coin.encode(v!, writer.uint32(34).fork()).ldelim(); } - - if (!message.endTime.isZero()) { + if (message.endTime !== BigInt(0)) { writer.uint32(40).int64(message.endTime); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BaseVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBaseVestingAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.baseAccount = BaseAccount.decode(reader, reader.uint32()); break; - case 2: message.originalVesting.push(Coin.decode(reader, reader.uint32())); break; - case 3: message.delegatedFree.push(Coin.decode(reader, reader.uint32())); break; - case 4: message.delegatedVesting.push(Coin.decode(reader, reader.uint32())); break; - case 5: - message.endTime = (reader.int64() as Long); + message.endTime = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BaseVestingAccount { + fromPartial(object: Partial): BaseVestingAccount { const message = createBaseBaseVestingAccount(); message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; message.originalVesting = object.originalVesting?.map(e => Coin.fromPartial(e)) || []; message.delegatedFree = object.delegatedFree?.map(e => Coin.fromPartial(e)) || []; message.delegatedVesting = object.delegatedVesting?.map(e => Coin.fromPartial(e)) || []; - message.endTime = object.endTime !== undefined && object.endTime !== null ? Long.fromValue(object.endTime) : Long.ZERO; + message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); return message; + }, + fromAmino(object: BaseVestingAccountAmino): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + if (object.base_account !== undefined && object.base_account !== null) { + message.baseAccount = BaseAccount.fromAmino(object.base_account); + } + message.originalVesting = object.original_vesting?.map(e => Coin.fromAmino(e)) || []; + message.delegatedFree = object.delegated_free?.map(e => Coin.fromAmino(e)) || []; + message.delegatedVesting = object.delegated_vesting?.map(e => Coin.fromAmino(e)) || []; + if (object.end_time !== undefined && object.end_time !== null) { + message.endTime = BigInt(object.end_time); + } + return message; + }, + toAmino(message: BaseVestingAccount): BaseVestingAccountAmino { + const obj: any = {}; + obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; + if (message.originalVesting) { + obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.original_vesting = []; + } + if (message.delegatedFree) { + obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.delegated_free = []; + } + if (message.delegatedVesting) { + obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.delegated_vesting = []; + } + obj.end_time = message.endTime ? message.endTime.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { + return BaseVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: BaseVestingAccount): BaseVestingAccountAminoMsg { + return { + type: "cosmos-sdk/BaseVestingAccount", + value: BaseVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: BaseVestingAccountProtoMsg): BaseVestingAccount { + return BaseVestingAccount.decode(message.value); + }, + toProto(message: BaseVestingAccount): Uint8Array { + return BaseVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: BaseVestingAccount): BaseVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", + value: BaseVestingAccount.encode(message).finish() + }; } - }; - function createBaseContinuousVestingAccount(): ContinuousVestingAccount { return { baseVestingAccount: undefined, - startTime: Long.ZERO + startTime: BigInt(0) }; } - export const ContinuousVestingAccount = { - encode(message: ContinuousVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", + encode(message: ContinuousVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - - if (!message.startTime.isZero()) { + if (message.startTime !== BigInt(0)) { writer.uint32(16).int64(message.startTime); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ContinuousVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseContinuousVestingAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); break; - case 2: - message.startTime = (reader.int64() as Long); + message.startTime = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ContinuousVestingAccount { + fromPartial(object: Partial): ContinuousVestingAccount { const message = createBaseContinuousVestingAccount(); message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; - message.startTime = object.startTime !== undefined && object.startTime !== null ? Long.fromValue(object.startTime) : Long.ZERO; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); return message; + }, + fromAmino(object: ContinuousVestingAccountAmino): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + return message; + }, + toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + obj.start_time = message.startTime ? message.startTime.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { + return ContinuousVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: ContinuousVestingAccount): ContinuousVestingAccountAminoMsg { + return { + type: "cosmos-sdk/ContinuousVestingAccount", + value: ContinuousVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: ContinuousVestingAccountProtoMsg): ContinuousVestingAccount { + return ContinuousVestingAccount.decode(message.value); + }, + toProto(message: ContinuousVestingAccount): Uint8Array { + return ContinuousVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: ContinuousVestingAccount): ContinuousVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", + value: ContinuousVestingAccount.encode(message).finish() + }; } - }; - function createBaseDelayedVestingAccount(): DelayedVestingAccount { return { baseVestingAccount: undefined }; } - export const DelayedVestingAccount = { - encode(message: DelayedVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", + encode(message: DelayedVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DelayedVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDelayedVestingAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DelayedVestingAccount { + fromPartial(object: Partial): DelayedVestingAccount { const message = createBaseDelayedVestingAccount(); message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; return message; + }, + fromAmino(object: DelayedVestingAccountAmino): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + return message; + }, + toAmino(message: DelayedVestingAccount): DelayedVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + return obj; + }, + fromAminoMsg(object: DelayedVestingAccountAminoMsg): DelayedVestingAccount { + return DelayedVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: DelayedVestingAccount): DelayedVestingAccountAminoMsg { + return { + type: "cosmos-sdk/DelayedVestingAccount", + value: DelayedVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: DelayedVestingAccountProtoMsg): DelayedVestingAccount { + return DelayedVestingAccount.decode(message.value); + }, + toProto(message: DelayedVestingAccount): Uint8Array { + return DelayedVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: DelayedVestingAccount): DelayedVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", + value: DelayedVestingAccount.encode(message).finish() + }; } - }; - function createBasePeriod(): Period { return { - length: Long.ZERO, + length: BigInt(0), amount: [] }; } - export const Period = { - encode(message: Period, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.length.isZero()) { + typeUrl: "/cosmos.vesting.v1beta1.Period", + encode(message: Period, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.length !== BigInt(0)) { writer.uint32(8).int64(message.length); } - for (const v of message.amount) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Period { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePeriod(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.length = (reader.int64() as Long); + message.length = reader.int64(); break; - case 2: message.amount.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Period { + fromPartial(object: Partial): Period { const message = createBasePeriod(); - message.length = object.length !== undefined && object.length !== null ? Long.fromValue(object.length) : Long.ZERO; + message.length = object.length !== undefined && object.length !== null ? BigInt(object.length.toString()) : BigInt(0); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: PeriodAmino): Period { + const message = createBasePeriod(); + if (object.length !== undefined && object.length !== null) { + message.length = BigInt(object.length); + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Period): PeriodAmino { + const obj: any = {}; + obj.length = message.length ? message.length.toString() : undefined; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: PeriodAminoMsg): Period { + return Period.fromAmino(object.value); + }, + toAminoMsg(message: Period): PeriodAminoMsg { + return { + type: "cosmos-sdk/Period", + value: Period.toAmino(message) + }; + }, + fromProtoMsg(message: PeriodProtoMsg): Period { + return Period.decode(message.value); + }, + toProto(message: Period): Uint8Array { + return Period.encode(message).finish(); + }, + toProtoMsg(message: Period): PeriodProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.Period", + value: Period.encode(message).finish() + }; } - }; - function createBasePeriodicVestingAccount(): PeriodicVestingAccount { return { baseVestingAccount: undefined, - startTime: Long.ZERO, + startTime: BigInt(0), vestingPeriods: [] }; } - export const PeriodicVestingAccount = { - encode(message: PeriodicVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", + encode(message: PeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - - if (!message.startTime.isZero()) { + if (message.startTime !== BigInt(0)) { writer.uint32(16).int64(message.startTime); } - for (const v of message.vestingPeriods) { Period.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PeriodicVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePeriodicVestingAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); break; - case 2: - message.startTime = (reader.int64() as Long); + message.startTime = reader.int64(); break; - case 3: message.vestingPeriods.push(Period.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PeriodicVestingAccount { + fromPartial(object: Partial): PeriodicVestingAccount { const message = createBasePeriodicVestingAccount(); message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; - message.startTime = object.startTime !== undefined && object.startTime !== null ? Long.fromValue(object.startTime) : Long.ZERO; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; return message; + }, + fromAmino(object: PeriodicVestingAccountAmino): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + message.vestingPeriods = object.vesting_periods?.map(e => Period.fromAmino(e)) || []; + return message; + }, + toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + obj.start_time = message.startTime ? message.startTime.toString() : undefined; + if (message.vestingPeriods) { + obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); + } else { + obj.vesting_periods = []; + } + return obj; + }, + fromAminoMsg(object: PeriodicVestingAccountAminoMsg): PeriodicVestingAccount { + return PeriodicVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: PeriodicVestingAccount): PeriodicVestingAccountAminoMsg { + return { + type: "cosmos-sdk/PeriodicVestingAccount", + value: PeriodicVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: PeriodicVestingAccountProtoMsg): PeriodicVestingAccount { + return PeriodicVestingAccount.decode(message.value); + }, + toProto(message: PeriodicVestingAccount): Uint8Array { + return PeriodicVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: PeriodicVestingAccount): PeriodicVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", + value: PeriodicVestingAccount.encode(message).finish() + }; } - }; - function createBasePermanentLockedAccount(): PermanentLockedAccount { return { baseVestingAccount: undefined }; } - export const PermanentLockedAccount = { - encode(message: PermanentLockedAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", + encode(message: PermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PermanentLockedAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePermanentLockedAccount(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PermanentLockedAccount { + fromPartial(object: Partial): PermanentLockedAccount { const message = createBasePermanentLockedAccount(); message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; return message; + }, + fromAmino(object: PermanentLockedAccountAmino): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + return message; + }, + toAmino(message: PermanentLockedAccount): PermanentLockedAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + return obj; + }, + fromAminoMsg(object: PermanentLockedAccountAminoMsg): PermanentLockedAccount { + return PermanentLockedAccount.fromAmino(object.value); + }, + toAminoMsg(message: PermanentLockedAccount): PermanentLockedAccountAminoMsg { + return { + type: "cosmos-sdk/PermanentLockedAccount", + value: PermanentLockedAccount.toAmino(message) + }; + }, + fromProtoMsg(message: PermanentLockedAccountProtoMsg): PermanentLockedAccount { + return PermanentLockedAccount.decode(message.value); + }, + toProto(message: PermanentLockedAccount): Uint8Array { + return PermanentLockedAccount.encode(message).finish(); + }, + toProtoMsg(message: PermanentLockedAccount): PermanentLockedAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", + value: PermanentLockedAccount.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/cosmos_proto/bundle.ts b/src/codegen/cosmos_proto/bundle.ts index 58b9e9a..fd49002 100644 --- a/src/codegen/cosmos_proto/bundle.ts +++ b/src/codegen/cosmos_proto/bundle.ts @@ -1,3 +1,4 @@ import * as _1 from "./cosmos"; -export const cosmos_proto = { ..._1 +export const cosmos_proto = { + ..._1 }; \ No newline at end of file diff --git a/src/codegen/cosmos_proto/cosmos.ts b/src/codegen/cosmos_proto/cosmos.ts index 27e2b84..7d20287 100644 --- a/src/codegen/cosmos_proto/cosmos.ts +++ b/src/codegen/cosmos_proto/cosmos.ts @@ -1,31 +1,23 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../helpers"; +import { BinaryReader, BinaryWriter } from "../binary"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, SCALAR_TYPE_STRING = 1, SCALAR_TYPE_BYTES = 2, UNRECOGNIZED = -1, } -export enum ScalarTypeSDKType { - SCALAR_TYPE_UNSPECIFIED = 0, - SCALAR_TYPE_STRING = 1, - SCALAR_TYPE_BYTES = 2, - UNRECOGNIZED = -1, -} +export const ScalarTypeSDKType = ScalarType; +export const ScalarTypeAmino = ScalarType; export function scalarTypeFromJSON(object: any): ScalarType { switch (object) { case 0: case "SCALAR_TYPE_UNSPECIFIED": return ScalarType.SCALAR_TYPE_UNSPECIFIED; - case 1: case "SCALAR_TYPE_STRING": return ScalarType.SCALAR_TYPE_STRING; - case 2: case "SCALAR_TYPE_BYTES": return ScalarType.SCALAR_TYPE_BYTES; - case -1: case "UNRECOGNIZED": default: @@ -36,13 +28,10 @@ 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"; @@ -52,7 +41,6 @@ export function scalarTypeToJSON(object: ScalarType): string { * 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 @@ -65,27 +53,40 @@ export interface InterfaceDescriptor { * description is a human-readable description of the interface and its * purpose. */ - description: string; } +export interface InterfaceDescriptorProtoMsg { + typeUrl: "/cosmos_proto.InterfaceDescriptor"; + value: Uint8Array; +} /** * InterfaceDescriptor describes an interface type to be used with * accepts_interface and implements_interface and declared by declare_interface. */ - -export interface InterfaceDescriptorSDKType { +export interface InterfaceDescriptorAmino { /** * name is the name of the interface. It should be a short-name (without * a period) such that the fully qualified name of the interface will be * package.name, ex. for the package a.b and interface named C, the * fully-qualified name will be a.b.C. */ - name: string; + name?: string; /** * description is a human-readable description of the interface and its * purpose. */ - + description?: string; +} +export interface InterfaceDescriptorAminoMsg { + type: "/cosmos_proto.InterfaceDescriptor"; + value: InterfaceDescriptorAmino; +} +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptorSDKType { + name: string; description: string; } /** @@ -97,7 +98,6 @@ export interface InterfaceDescriptorSDKType { * 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 @@ -111,7 +111,6 @@ export interface ScalarDescriptor { * 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. @@ -119,9 +118,12 @@ export interface ScalarDescriptor { * encoding standards and simple and clear. Currently only string and * bytes fields are supported for scalars. */ - fieldType: ScalarType[]; } +export interface ScalarDescriptorProtoMsg { + typeUrl: "/cosmos_proto.ScalarDescriptor"; + value: Uint8Array; +} /** * ScalarDescriptor describes an scalar type to be used with * the scalar field option and declared by declare_scalar. @@ -131,87 +133,121 @@ export interface ScalarDescriptor { * valid syntactical representation for a given semantic meaning, * i.e. the encoding should be deterministic. */ - -export interface ScalarDescriptorSDKType { +export interface ScalarDescriptorAmino { /** * name is the name of the scalar. It should be a short-name (without * a period) such that the fully qualified name of the scalar will be * package.name, ex. for the package a.b and scalar named C, the * fully-qualified name will be a.b.C. */ - name: string; + 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; + description?: string; /** * field_type is the type of field with which this scalar can be used. * Scalars can be used with one and only one type of field so that * encoding standards and simple and clear. Currently only string and * bytes fields are supported for scalars. */ - - field_type: ScalarTypeSDKType[]; + field_type?: ScalarType[]; +} +export interface ScalarDescriptorAminoMsg { + type: "/cosmos_proto.ScalarDescriptor"; + value: ScalarDescriptorAmino; +} +/** + * 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 ScalarDescriptorSDKType { + name: string; + description: string; + field_type: ScalarType[]; } - function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", description: "" }; } - export const InterfaceDescriptor = { - encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos_proto.InterfaceDescriptor", + encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.description = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): InterfaceDescriptor { + fromPartial(object: Partial): InterfaceDescriptor { const message = createBaseInterfaceDescriptor(); message.name = object.name ?? ""; message.description = object.description ?? ""; return message; + }, + fromAmino(object: InterfaceDescriptorAmino): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { + const obj: any = {}; + obj.name = message.name; + obj.description = message.description; + return obj; + }, + fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { + return InterfaceDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: InterfaceDescriptorProtoMsg): InterfaceDescriptor { + return InterfaceDescriptor.decode(message.value); + }, + toProto(message: InterfaceDescriptor): Uint8Array { + return InterfaceDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceDescriptor): InterfaceDescriptorProtoMsg { + return { + typeUrl: "/cosmos_proto.InterfaceDescriptor", + value: InterfaceDescriptor.encode(message).finish() + }; } - }; - function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", @@ -219,72 +255,94 @@ function createBaseScalarDescriptor(): ScalarDescriptor { fieldType: [] }; } - export const ScalarDescriptor = { - encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/cosmos_proto.ScalarDescriptor", + encode(message: ScalarDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - writer.uint32(26).fork(); - for (const v of message.fieldType) { writer.int32(v); } - writer.ldelim(); return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.description = reader.string(); break; - case 3: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.fieldType.push((reader.int32() as any)); } } else { message.fieldType.push((reader.int32() as any)); } - break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ScalarDescriptor { + fromPartial(object: Partial): ScalarDescriptor { const message = createBaseScalarDescriptor(); message.name = object.name ?? ""; message.description = object.description ?? ""; message.fieldType = object.fieldType?.map(e => e) || []; return message; + }, + fromAmino(object: ScalarDescriptorAmino): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.fieldType = object.field_type?.map(e => scalarTypeFromJSON(e)) || []; + return message; + }, + toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { + const obj: any = {}; + obj.name = message.name; + obj.description = message.description; + if (message.fieldType) { + obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); + } else { + obj.field_type = []; + } + return obj; + }, + fromAminoMsg(object: ScalarDescriptorAminoMsg): ScalarDescriptor { + return ScalarDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: ScalarDescriptorProtoMsg): ScalarDescriptor { + return ScalarDescriptor.decode(message.value); + }, + toProto(message: ScalarDescriptor): Uint8Array { + return ScalarDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ScalarDescriptor): ScalarDescriptorProtoMsg { + return { + typeUrl: "/cosmos_proto.ScalarDescriptor", + value: ScalarDescriptor.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/gogoproto/bundle.ts b/src/codegen/gogoproto/bundle.ts index 39ebc79..c85c98e 100644 --- a/src/codegen/gogoproto/bundle.ts +++ b/src/codegen/gogoproto/bundle.ts @@ -1,3 +1,4 @@ import * as _94 from "./gogo"; -export const gogoproto = { ..._94 +export const gogoproto = { + ..._94 }; \ No newline at end of file diff --git a/src/codegen/google/api/http.ts b/src/codegen/google/api/http.ts index 768ba17..a3dbb76 100644 --- a/src/codegen/google/api/http.ts +++ b/src/codegen/google/api/http.ts @@ -1,11 +1,9 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; /** * 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. @@ -21,22 +19,24 @@ export interface Http { * The default behavior is to not decode RFC 6570 reserved characters in multi * segment matches. */ - fullyDecodeReservedExpansion: boolean; } +export interface HttpProtoMsg { + typeUrl: "/google.api.Http"; + value: Uint8Array; +} /** * Defines the HTTP configuration for an API service. It contains a list of * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method * to one or more HTTP REST API methods. */ - -export interface HttpSDKType { +export interface HttpAmino { /** * A list of HTTP configuration rules that apply to individual API methods. * * **NOTE:** All service configuration rules follow "last one wins" order. */ - rules: HttpRuleSDKType[]; + rules?: HttpRuleAmino[]; /** * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be @@ -45,7 +45,19 @@ export interface HttpSDKType { * The default behavior is to not decode RFC 6570 reserved characters in multi * segment matches. */ - + fully_decode_reserved_expansion?: boolean; +} +export interface HttpAminoMsg { + type: "/google.api.Http"; + value: HttpAmino; +} +/** + * 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 HttpSDKType { + rules: HttpRuleSDKType[]; fully_decode_reserved_expansion: boolean; } /** @@ -319,7 +331,6 @@ export interface HttpSDKType { * 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. @@ -331,19 +342,14 @@ export interface HttpRule { * Maps to HTTP GET. Used for listing and getting information about * resources. */ - get?: string; /** Maps to HTTP PUT. Used for replacing a resource. */ - put?: string; /** Maps to HTTP POST. Used for creating a resource or performing an action. */ - post?: string; /** Maps to HTTP DELETE. Used for deleting a resource. */ - delete?: string; /** Maps to HTTP PATCH. Used for updating a resource. */ - patch?: string; /** * The custom pattern is used for specifying an HTTP method that is not @@ -351,7 +357,6 @@ export interface HttpRule { * HTTP method unspecified for this rule. The wild-card rule is useful * for services that provide content to Web (HTML) clients. */ - custom?: CustomHttpPattern; /** * The name of the request field whose value is mapped to the HTTP request @@ -361,7 +366,6 @@ export interface HttpRule { * 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 @@ -371,16 +375,18 @@ export interface HttpRule { * NOTE: The referred field must be present at the top-level of the response * message type. */ - responseBody: string; /** * Additional HTTP bindings for the selector. Nested bindings must * not contain an `additional_bindings` field themselves (that is, * the nesting may only be one level deep). */ - additionalBindings: HttpRule[]; } +export interface HttpRuleProtoMsg { + typeUrl: "/google.api.HttpRule"; + value: Uint8Array; +} /** * # gRPC Transcoding * @@ -652,31 +658,25 @@ export interface HttpRule { * the request or response body to a repeated field. However, some gRPC * Transcoding implementations may not support this feature. */ - -export interface HttpRuleSDKType { +export interface HttpRuleAmino { /** * Selects a method to which this rule applies. * * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. */ - selector: string; + selector?: string; /** * Maps to HTTP GET. Used for listing and getting information about * resources. */ - get?: string; /** Maps to HTTP PUT. Used for replacing a resource. */ - put?: string; /** Maps to HTTP POST. Used for creating a resource or performing an action. */ - post?: string; /** Maps to HTTP DELETE. Used for deleting a resource. */ - delete?: string; /** Maps to HTTP PATCH. Used for updating a resource. */ - patch?: string; /** * The custom pattern is used for specifying an HTTP method that is not @@ -684,8 +684,7 @@ export interface HttpRuleSDKType { * HTTP method unspecified for this rule. The wild-card rule is useful * for services that provide content to Web (HTML) clients. */ - - custom?: CustomHttpPatternSDKType; + custom?: CustomHttpPatternAmino; /** * The name of the request field whose value is mapped to the HTTP request * body, or `*` for mapping all request fields not captured by the path @@ -694,8 +693,7 @@ export interface HttpRuleSDKType { * NOTE: the referred field must be present at the top-level of the request * message type. */ - - body: string; + 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 @@ -704,90 +702,405 @@ export interface HttpRuleSDKType { * NOTE: The referred field must be present at the top-level of the response * message type. */ - - response_body: string; + response_body?: string; /** * Additional HTTP bindings for the selector. Nested bindings must * not contain an `additional_bindings` field themselves (that is, * the nesting may only be one level deep). */ - + additional_bindings?: HttpRuleAmino[]; +} +export interface HttpRuleAminoMsg { + type: "/google.api.HttpRule"; + value: HttpRuleAmino; +} +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRuleSDKType { + selector: string; + get?: string; + put?: string; + post?: string; + delete?: string; + patch?: string; + custom?: CustomHttpPatternSDKType; + body: string; + response_body: string; additional_bindings: HttpRuleSDKType[]; } /** A custom pattern is used for defining custom HTTP verb. */ - export interface CustomHttpPattern { /** The name of this custom HTTP verb. */ kind: string; /** The path matched by this custom verb. */ - path: string; } +export interface CustomHttpPatternProtoMsg { + typeUrl: "/google.api.CustomHttpPattern"; + value: Uint8Array; +} /** A custom pattern is used for defining custom HTTP verb. */ - -export interface CustomHttpPatternSDKType { +export interface CustomHttpPatternAmino { /** The name of this custom HTTP verb. */ - kind: string; + kind?: string; /** The path matched by this custom verb. */ - + path?: string; +} +export interface CustomHttpPatternAminoMsg { + type: "/google.api.CustomHttpPattern"; + value: CustomHttpPatternAmino; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPatternSDKType { + kind: string; path: string; } - function createBaseHttp(): Http { return { rules: [], fullyDecodeReservedExpansion: false }; } - export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.api.Http", + encode(message: Http, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.fullyDecodeReservedExpansion === true) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.rules.push(HttpRule.decode(reader, reader.uint32())); break; - case 2: message.fullyDecodeReservedExpansion = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Http { + fromPartial(object: Partial): Http { const message = createBaseHttp(); message.rules = object.rules?.map(e => HttpRule.fromPartial(e)) || []; message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; return message; + }, + fromAmino(object: HttpAmino): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map(e => HttpRule.fromAmino(e)) || []; + if (object.fully_decode_reserved_expansion !== undefined && object.fully_decode_reserved_expansion !== null) { + message.fullyDecodeReservedExpansion = object.fully_decode_reserved_expansion; + } + return message; + }, + toAmino(message: Http): HttpAmino { + const obj: any = {}; + if (message.rules) { + obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e) : undefined); + } else { + obj.rules = []; + } + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion; + return obj; + }, + fromAminoMsg(object: HttpAminoMsg): Http { + return Http.fromAmino(object.value); + }, + fromProtoMsg(message: HttpProtoMsg): Http { + return Http.decode(message.value); + }, + toProto(message: Http): Uint8Array { + return Http.encode(message).finish(); + }, + toProtoMsg(message: Http): HttpProtoMsg { + return { + typeUrl: "/google.api.Http", + value: Http.encode(message).finish() + }; } - }; - function createBaseHttpRule(): HttpRule { return { selector: "", @@ -802,111 +1115,86 @@ function createBaseHttpRule(): HttpRule { additionalBindings: [] }; } - export const HttpRule = { - encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.api.HttpRule", + encode(message: HttpRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); } - if (message.get !== undefined) { writer.uint32(18).string(message.get); } - if (message.put !== undefined) { writer.uint32(26).string(message.put); } - if (message.post !== undefined) { writer.uint32(34).string(message.post); } - if (message.delete !== undefined) { writer.uint32(42).string(message.delete); } - if (message.patch !== undefined) { writer.uint32(50).string(message.patch); } - if (message.custom !== undefined) { CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); } - if (message.body !== "") { writer.uint32(58).string(message.body); } - if (message.responseBody !== "") { writer.uint32(98).string(message.responseBody); } - for (const v of message.additionalBindings) { HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.selector = reader.string(); break; - case 2: message.get = reader.string(); break; - case 3: message.put = reader.string(); break; - case 4: message.post = reader.string(); break; - case 5: message.delete = reader.string(); break; - case 6: message.patch = reader.string(); break; - case 8: message.custom = CustomHttpPattern.decode(reader, reader.uint32()); break; - case 7: message.body = reader.string(); break; - case 12: message.responseBody = reader.string(); break; - case 11: message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): HttpRule { + fromPartial(object: Partial): HttpRule { const message = createBaseHttpRule(); message.selector = object.selector ?? ""; message.get = object.get ?? undefined; @@ -919,61 +1207,145 @@ export const HttpRule = { message.responseBody = object.responseBody ?? ""; message.additionalBindings = object.additionalBindings?.map(e => HttpRule.fromPartial(e)) || []; return message; + }, + fromAmino(object: HttpRuleAmino): HttpRule { + const message = createBaseHttpRule(); + if (object.selector !== undefined && object.selector !== null) { + message.selector = object.selector; + } + if (object.get !== undefined && object.get !== null) { + message.get = object.get; + } + if (object.put !== undefined && object.put !== null) { + message.put = object.put; + } + if (object.post !== undefined && object.post !== null) { + message.post = object.post; + } + if (object.delete !== undefined && object.delete !== null) { + message.delete = object.delete; + } + if (object.patch !== undefined && object.patch !== null) { + message.patch = object.patch; + } + if (object.custom !== undefined && object.custom !== null) { + message.custom = CustomHttpPattern.fromAmino(object.custom); + } + if (object.body !== undefined && object.body !== null) { + message.body = object.body; + } + if (object.response_body !== undefined && object.response_body !== null) { + message.responseBody = object.response_body; + } + message.additionalBindings = object.additional_bindings?.map(e => HttpRule.fromAmino(e)) || []; + return message; + }, + toAmino(message: HttpRule): HttpRuleAmino { + const obj: any = {}; + obj.selector = message.selector; + obj.get = message.get; + obj.put = message.put; + obj.post = message.post; + obj.delete = message.delete; + obj.patch = message.patch; + obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; + obj.body = message.body; + obj.response_body = message.responseBody; + if (message.additionalBindings) { + obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); + } else { + obj.additional_bindings = []; + } + return obj; + }, + fromAminoMsg(object: HttpRuleAminoMsg): HttpRule { + return HttpRule.fromAmino(object.value); + }, + fromProtoMsg(message: HttpRuleProtoMsg): HttpRule { + return HttpRule.decode(message.value); + }, + toProto(message: HttpRule): Uint8Array { + return HttpRule.encode(message).finish(); + }, + toProtoMsg(message: HttpRule): HttpRuleProtoMsg { + return { + typeUrl: "/google.api.HttpRule", + value: HttpRule.encode(message).finish() + }; } - }; - function createBaseCustomHttpPattern(): CustomHttpPattern { return { kind: "", path: "" }; } - export const CustomHttpPattern = { - encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.api.CustomHttpPattern", + encode(message: CustomHttpPattern, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); } - if (message.path !== "") { writer.uint32(18).string(message.path); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.kind = reader.string(); break; - case 2: message.path = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CustomHttpPattern { + fromPartial(object: Partial): CustomHttpPattern { const message = createBaseCustomHttpPattern(); message.kind = object.kind ?? ""; message.path = object.path ?? ""; return message; + }, + fromAmino(object: CustomHttpPatternAmino): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + if (object.kind !== undefined && object.kind !== null) { + message.kind = object.kind; + } + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + return message; + }, + toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { + const obj: any = {}; + obj.kind = message.kind; + obj.path = message.path; + return obj; + }, + fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { + return CustomHttpPattern.fromAmino(object.value); + }, + fromProtoMsg(message: CustomHttpPatternProtoMsg): CustomHttpPattern { + return CustomHttpPattern.decode(message.value); + }, + toProto(message: CustomHttpPattern): Uint8Array { + return CustomHttpPattern.encode(message).finish(); + }, + toProtoMsg(message: CustomHttpPattern): CustomHttpPatternProtoMsg { + return { + typeUrl: "/google.api.CustomHttpPattern", + value: CustomHttpPattern.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/google/bundle.ts b/src/codegen/google/bundle.ts index 3d496d6..96743d5 100644 --- a/src/codegen/google/bundle.ts +++ b/src/codegen/google/bundle.ts @@ -6,10 +6,12 @@ import * as _99 from "./protobuf/duration"; import * as _100 from "./protobuf/empty"; import * as _101 from "./protobuf/timestamp"; export namespace google { - export const api = { ..._95, + export const api = { + ..._95, ..._96 }; - export const protobuf = { ..._97, + export const protobuf = { + ..._97, ..._98, ..._99, ..._100, diff --git a/src/codegen/google/protobuf/any.ts b/src/codegen/google/protobuf/any.ts index 4f1b5c7..44e619e 100644 --- a/src/codegen/google/protobuf/any.ts +++ b/src/codegen/google/protobuf/any.ts @@ -1,5 +1,4 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a * URL that describes the type of the serialized message. @@ -81,8 +80,8 @@ import { DeepPartial } from "../../helpers"; * "value": "1.212s" * } */ - export interface Any { + $typeUrl?: "/google.protobuf.Any"; /** * A URL/resource name that uniquely identifies the type of the serialized * protocol buffer message. This string must contain at least @@ -114,7 +113,10 @@ export interface Any { */ typeUrl: string; /** Must be a valid serialized protocol buffer of the above specified type. */ - + value: Uint8Array; +} +export interface AnyProtoMsg { + typeUrl: "/google.protobuf.Any"; value: Uint8Array; } /** @@ -198,8 +200,7 @@ export interface Any { * "value": "1.212s" * } */ - -export interface AnySDKType { +export interface AnyAmino { /** * A URL/resource name that uniquely identifies the type of the serialized * protocol buffer message. This string must contain at least @@ -229,63 +230,169 @@ export interface AnySDKType { * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. */ - type_url: string; + type: string; /** Must be a valid serialized protocol buffer of the above specified type. */ - + value: any; +} +export interface AnyAminoMsg { + type: string; + value: AnyAmino; +} +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface AnySDKType { + $typeUrl?: "/google.protobuf.Any"; + type_url: string; value: Uint8Array; } - function createBaseAny(): Any { return { + $typeUrl: "/google.protobuf.Any", typeUrl: "", value: new Uint8Array() }; } - export const Any = { - encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.Any", + encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); } - if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Any { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.typeUrl = reader.string(); break; - case 2: message.value = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Any { + fromPartial(object: Partial): Any { const message = createBaseAny(); message.typeUrl = object.typeUrl ?? ""; message.value = object.value ?? new Uint8Array(); return message; + }, + fromAmino(object: AnyAmino): Any { + return { + typeUrl: object.type, + value: object.value + }; + }, + toAmino(message: Any): AnyAmino { + const obj: any = {}; + obj.type = message.typeUrl; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: AnyAminoMsg): Any { + return Any.fromAmino(object.value); + }, + fromProtoMsg(message: AnyProtoMsg): Any { + return Any.decode(message.value); + }, + toProto(message: Any): Uint8Array { + return Any.encode(message).finish(); + }, + toProtoMsg(message: Any): AnyProtoMsg { + return { + typeUrl: "/google.protobuf.Any", + value: Any.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/google/protobuf/descriptor.ts b/src/codegen/google/protobuf/descriptor.ts index 3040bf1..4b74d80 100644 --- a/src/codegen/google/protobuf/descriptor.ts +++ b/src/codegen/google/protobuf/descriptor.ts @@ -1,5 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../helpers"; export enum FieldDescriptorProto_Type { /** * TYPE_DOUBLE - 0 is reserved for errors. @@ -7,14 +7,12 @@ export enum FieldDescriptorProto_Type { */ TYPE_DOUBLE = 1, TYPE_FLOAT = 2, - /** * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if * negative values are likely. */ TYPE_INT64 = 3, TYPE_UINT64 = 4, - /** * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if * negative values are likely. @@ -24,7 +22,6 @@ export enum FieldDescriptorProto_Type { TYPE_FIXED32 = 7, TYPE_BOOL = 8, TYPE_STRING = 9, - /** * TYPE_GROUP - Tag-delimited aggregate. * Group type is deprecated and not supported in proto3. However, Proto3 @@ -33,143 +30,76 @@ export enum FieldDescriptorProto_Type { */ TYPE_GROUP = 10, TYPE_MESSAGE = 11, - /** TYPE_BYTES - New in version 2. */ TYPE_BYTES = 12, TYPE_UINT32 = 13, TYPE_ENUM = 14, TYPE_SFIXED32 = 15, TYPE_SFIXED64 = 16, - /** TYPE_SINT32 - Uses ZigZag encoding. */ TYPE_SINT32 = 17, - - /** TYPE_SINT64 - Uses ZigZag encoding. */ - TYPE_SINT64 = 18, - UNRECOGNIZED = -1, -} -export enum FieldDescriptorProto_TypeSDKType { - /** - * TYPE_DOUBLE - 0 is reserved for errors. - * Order is weird for historical reasons. - */ - TYPE_DOUBLE = 1, - TYPE_FLOAT = 2, - - /** - * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - * negative values are likely. - */ - TYPE_INT64 = 3, - TYPE_UINT64 = 4, - - /** - * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - * negative values are likely. - */ - TYPE_INT32 = 5, - TYPE_FIXED64 = 6, - TYPE_FIXED32 = 7, - TYPE_BOOL = 8, - TYPE_STRING = 9, - - /** - * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 - * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. - */ - TYPE_GROUP = 10, - TYPE_MESSAGE = 11, - - /** TYPE_BYTES - New in version 2. */ - TYPE_BYTES = 12, - TYPE_UINT32 = 13, - TYPE_ENUM = 14, - TYPE_SFIXED32 = 15, - TYPE_SFIXED64 = 16, - - /** TYPE_SINT32 - Uses ZigZag encoding. */ - TYPE_SINT32 = 17, - /** TYPE_SINT64 - Uses ZigZag encoding. */ TYPE_SINT64 = 18, UNRECOGNIZED = -1, } +export const FieldDescriptorProto_TypeSDKType = FieldDescriptorProto_Type; +export const FieldDescriptorProto_TypeAmino = FieldDescriptorProto_Type; export function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type { switch (object) { case 1: case "TYPE_DOUBLE": return FieldDescriptorProto_Type.TYPE_DOUBLE; - case 2: case "TYPE_FLOAT": return FieldDescriptorProto_Type.TYPE_FLOAT; - case 3: case "TYPE_INT64": return FieldDescriptorProto_Type.TYPE_INT64; - case 4: case "TYPE_UINT64": return FieldDescriptorProto_Type.TYPE_UINT64; - case 5: case "TYPE_INT32": return FieldDescriptorProto_Type.TYPE_INT32; - case 6: case "TYPE_FIXED64": return FieldDescriptorProto_Type.TYPE_FIXED64; - case 7: case "TYPE_FIXED32": return FieldDescriptorProto_Type.TYPE_FIXED32; - case 8: case "TYPE_BOOL": return FieldDescriptorProto_Type.TYPE_BOOL; - case 9: case "TYPE_STRING": return FieldDescriptorProto_Type.TYPE_STRING; - case 10: case "TYPE_GROUP": return FieldDescriptorProto_Type.TYPE_GROUP; - case 11: case "TYPE_MESSAGE": return FieldDescriptorProto_Type.TYPE_MESSAGE; - case 12: case "TYPE_BYTES": return FieldDescriptorProto_Type.TYPE_BYTES; - case 13: case "TYPE_UINT32": return FieldDescriptorProto_Type.TYPE_UINT32; - case 14: case "TYPE_ENUM": return FieldDescriptorProto_Type.TYPE_ENUM; - case 15: case "TYPE_SFIXED32": return FieldDescriptorProto_Type.TYPE_SFIXED32; - case 16: case "TYPE_SFIXED64": return FieldDescriptorProto_Type.TYPE_SFIXED64; - case 17: case "TYPE_SINT32": return FieldDescriptorProto_Type.TYPE_SINT32; - case 18: case "TYPE_SINT64": return FieldDescriptorProto_Type.TYPE_SINT64; - case -1: case "UNRECOGNIZED": default: @@ -180,58 +110,40 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ switch (object) { case FieldDescriptorProto_Type.TYPE_DOUBLE: return "TYPE_DOUBLE"; - case FieldDescriptorProto_Type.TYPE_FLOAT: return "TYPE_FLOAT"; - case FieldDescriptorProto_Type.TYPE_INT64: return "TYPE_INT64"; - case FieldDescriptorProto_Type.TYPE_UINT64: return "TYPE_UINT64"; - case FieldDescriptorProto_Type.TYPE_INT32: return "TYPE_INT32"; - case FieldDescriptorProto_Type.TYPE_FIXED64: return "TYPE_FIXED64"; - case FieldDescriptorProto_Type.TYPE_FIXED32: return "TYPE_FIXED32"; - case FieldDescriptorProto_Type.TYPE_BOOL: return "TYPE_BOOL"; - case FieldDescriptorProto_Type.TYPE_STRING: return "TYPE_STRING"; - case FieldDescriptorProto_Type.TYPE_GROUP: return "TYPE_GROUP"; - case FieldDescriptorProto_Type.TYPE_MESSAGE: return "TYPE_MESSAGE"; - case FieldDescriptorProto_Type.TYPE_BYTES: return "TYPE_BYTES"; - case FieldDescriptorProto_Type.TYPE_UINT32: return "TYPE_UINT32"; - case FieldDescriptorProto_Type.TYPE_ENUM: return "TYPE_ENUM"; - case FieldDescriptorProto_Type.TYPE_SFIXED32: return "TYPE_SFIXED32"; - case FieldDescriptorProto_Type.TYPE_SFIXED64: return "TYPE_SFIXED64"; - case FieldDescriptorProto_Type.TYPE_SINT32: return "TYPE_SINT32"; - case FieldDescriptorProto_Type.TYPE_SINT64: return "TYPE_SINT64"; - case FieldDescriptorProto_Type.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -244,27 +156,19 @@ export enum FieldDescriptorProto_Label { LABEL_REPEATED = 3, UNRECOGNIZED = -1, } -export enum FieldDescriptorProto_LabelSDKType { - /** LABEL_OPTIONAL - 0 is reserved for errors */ - LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, - LABEL_REPEATED = 3, - UNRECOGNIZED = -1, -} +export const FieldDescriptorProto_LabelSDKType = FieldDescriptorProto_Label; +export const FieldDescriptorProto_LabelAmino = FieldDescriptorProto_Label; export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { switch (object) { case 1: case "LABEL_OPTIONAL": return FieldDescriptorProto_Label.LABEL_OPTIONAL; - case 2: case "LABEL_REQUIRED": return FieldDescriptorProto_Label.LABEL_REQUIRED; - case 3: case "LABEL_REPEATED": return FieldDescriptorProto_Label.LABEL_REPEATED; - case -1: case "UNRECOGNIZED": default: @@ -275,64 +179,41 @@ 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.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Generated classes can be optimized for speed or code size. */ - export enum FileOptions_OptimizeMode { /** * SPEED - Generate complete code for parsing, serialization, * etc. */ SPEED = 1, - /** CODE_SIZE - Use ReflectionOps to implement these methods. */ CODE_SIZE = 2, - - /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ - LITE_RUNTIME = 3, - UNRECOGNIZED = -1, -} -/** Generated classes can be optimized for speed or code size. */ - -export enum FileOptions_OptimizeModeSDKType { - /** - * SPEED - Generate complete code for parsing, serialization, - * etc. - */ - SPEED = 1, - - /** CODE_SIZE - Use ReflectionOps to implement these methods. */ - CODE_SIZE = 2, - /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ LITE_RUNTIME = 3, UNRECOGNIZED = -1, } +export const FileOptions_OptimizeModeSDKType = FileOptions_OptimizeMode; +export const FileOptions_OptimizeModeAmino = FileOptions_OptimizeMode; export function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode { switch (object) { case 1: case "SPEED": return FileOptions_OptimizeMode.SPEED; - case 2: case "CODE_SIZE": return FileOptions_OptimizeMode.CODE_SIZE; - case 3: case "LITE_RUNTIME": return FileOptions_OptimizeMode.LITE_RUNTIME; - case -1: case "UNRECOGNIZED": default: @@ -343,13 +224,10 @@ export function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode) switch (object) { case FileOptions_OptimizeMode.SPEED: return "SPEED"; - case FileOptions_OptimizeMode.CODE_SIZE: return "CODE_SIZE"; - case FileOptions_OptimizeMode.LITE_RUNTIME: return "LITE_RUNTIME"; - case FileOptions_OptimizeMode.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -362,27 +240,19 @@ export enum FieldOptions_CType { STRING_PIECE = 2, UNRECOGNIZED = -1, } -export enum FieldOptions_CTypeSDKType { - /** STRING - Default mode. */ - STRING = 0, - CORD = 1, - STRING_PIECE = 2, - UNRECOGNIZED = -1, -} +export const FieldOptions_CTypeSDKType = FieldOptions_CType; +export const FieldOptions_CTypeAmino = FieldOptions_CType; export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { switch (object) { case 0: case "STRING": return FieldOptions_CType.STRING; - case 1: case "CORD": return FieldOptions_CType.CORD; - case 2: case "STRING_PIECE": return FieldOptions_CType.STRING_PIECE; - case -1: case "UNRECOGNIZED": default: @@ -393,13 +263,10 @@ export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { switch (object) { case FieldOptions_CType.STRING: return "STRING"; - case FieldOptions_CType.CORD: return "CORD"; - case FieldOptions_CType.STRING_PIECE: return "STRING_PIECE"; - case FieldOptions_CType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -408,39 +275,25 @@ export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { export enum FieldOptions_JSType { /** JS_NORMAL - Use the default type. */ JS_NORMAL = 0, - - /** JS_STRING - Use JavaScript strings. */ - JS_STRING = 1, - - /** JS_NUMBER - Use JavaScript numbers. */ - JS_NUMBER = 2, - UNRECOGNIZED = -1, -} -export enum FieldOptions_JSTypeSDKType { - /** JS_NORMAL - Use the default type. */ - JS_NORMAL = 0, - /** JS_STRING - Use JavaScript strings. */ JS_STRING = 1, - /** JS_NUMBER - Use JavaScript numbers. */ JS_NUMBER = 2, UNRECOGNIZED = -1, } +export const FieldOptions_JSTypeSDKType = FieldOptions_JSType; +export const FieldOptions_JSTypeAmino = FieldOptions_JSType; export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { switch (object) { case 0: case "JS_NORMAL": return FieldOptions_JSType.JS_NORMAL; - case 1: case "JS_STRING": return FieldOptions_JSType.JS_STRING; - case 2: case "JS_NUMBER": return FieldOptions_JSType.JS_NUMBER; - case -1: case "UNRECOGNIZED": default: @@ -451,13 +304,10 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { switch (object) { case FieldOptions_JSType.JS_NORMAL: return "JS_NORMAL"; - case FieldOptions_JSType.JS_STRING: return "JS_STRING"; - case FieldOptions_JSType.JS_NUMBER: return "JS_NUMBER"; - case FieldOptions_JSType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -468,47 +318,27 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { * or neither? HTTP based RPC implementation may choose GET verb for safe * methods, and PUT verb for idempotent methods instead of the default POST. */ - export enum MethodOptions_IdempotencyLevel { IDEMPOTENCY_UNKNOWN = 0, - - /** NO_SIDE_EFFECTS - implies idempotent */ - NO_SIDE_EFFECTS = 1, - - /** IDEMPOTENT - idempotent, but may have side effects */ - IDEMPOTENT = 2, - UNRECOGNIZED = -1, -} -/** - * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - * or neither? HTTP based RPC implementation may choose GET verb for safe - * methods, and PUT verb for idempotent methods instead of the default POST. - */ - -export enum MethodOptions_IdempotencyLevelSDKType { - IDEMPOTENCY_UNKNOWN = 0, - /** NO_SIDE_EFFECTS - implies idempotent */ NO_SIDE_EFFECTS = 1, - /** IDEMPOTENT - idempotent, but may have side effects */ IDEMPOTENT = 2, UNRECOGNIZED = -1, } +export const MethodOptions_IdempotencyLevelSDKType = MethodOptions_IdempotencyLevel; +export const MethodOptions_IdempotencyLevelAmino = MethodOptions_IdempotencyLevel; export function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel { switch (object) { case 0: case "IDEMPOTENCY_UNKNOWN": return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; - case 1: case "NO_SIDE_EFFECTS": return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; - case 2: case "IDEMPOTENT": return MethodOptions_IdempotencyLevel.IDEMPOTENT; - case -1: case "UNRECOGNIZED": default: @@ -519,13 +349,10 @@ export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_Idemp switch (object) { case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: return "IDEMPOTENCY_UNKNOWN"; - case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: return "NO_SIDE_EFFECTS"; - case MethodOptions_IdempotencyLevel.IDEMPOTENT: return "IDEMPOTENT"; - case MethodOptions_IdempotencyLevel.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -535,38 +362,46 @@ export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_Idemp * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. */ - export interface FileDescriptorSet { file: FileDescriptorProto[]; } +export interface FileDescriptorSetProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorSet"; + value: Uint8Array; +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSetAmino { + file?: FileDescriptorProtoAmino[]; +} +export interface FileDescriptorSetAminoMsg { + type: "/google.protobuf.FileDescriptorSet"; + value: FileDescriptorSetAmino; +} /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. */ - export interface FileDescriptorSetSDKType { file: FileDescriptorProtoSDKType[]; } /** Describes a complete .proto file. */ - export interface FileDescriptorProto { /** file name, relative to root of source tree */ name: string; package: string; /** Names of files imported by this file. */ - dependency: string[]; /** Indexes of the public imported files in the dependency list above. */ - publicDependency: number[]; /** * Indexes of the weak imported files in the dependency list. * For Google-internal migration only. Do not use. */ - weakDependency: number[]; /** All top-level definitions in this file. */ - messageType: DescriptorProto[]; enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; @@ -578,57 +413,70 @@ export interface FileDescriptorProto { * functionality of the descriptors -- the information is needed only by * development tools. */ - sourceCodeInfo?: SourceCodeInfo; /** * The syntax of the proto file. * The supported values are "proto2" and "proto3". */ - syntax: string; } +export interface FileDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorProto"; + value: Uint8Array; +} /** Describes a complete .proto file. */ - -export interface FileDescriptorProtoSDKType { +export interface FileDescriptorProtoAmino { /** file name, relative to root of source tree */ - name: string; - package: string; + name?: string; + package?: string; /** Names of files imported by this file. */ - - dependency: string[]; + dependency?: string[]; /** Indexes of the public imported files in the dependency list above. */ - - public_dependency: number[]; + public_dependency?: number[]; /** * Indexes of the weak imported files in the dependency list. * For Google-internal migration only. Do not use. */ - - weak_dependency: number[]; + weak_dependency?: number[]; /** All top-level definitions in this file. */ - - message_type: DescriptorProtoSDKType[]; - enum_type: EnumDescriptorProtoSDKType[]; - service: ServiceDescriptorProtoSDKType[]; - extension: FieldDescriptorProtoSDKType[]; - options?: FileOptionsSDKType; + message_type?: DescriptorProtoAmino[]; + enum_type?: EnumDescriptorProtoAmino[]; + service?: ServiceDescriptorProtoAmino[]; + extension?: FieldDescriptorProtoAmino[]; + options?: FileOptionsAmino; /** * This field contains optional information about the original source code. * You may safely remove this entire field without harming runtime * functionality of the descriptors -- the information is needed only by * development tools. */ - - source_code_info?: SourceCodeInfoSDKType; + source_code_info?: SourceCodeInfoAmino; /** * The syntax of the proto file. * The supported values are "proto2" and "proto3". */ - + syntax?: string; +} +export interface FileDescriptorProtoAminoMsg { + type: "/google.protobuf.FileDescriptorProto"; + value: FileDescriptorProtoAmino; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProtoSDKType { + name: string; + package: string; + dependency: string[]; + public_dependency: number[]; + weak_dependency: number[]; + message_type: DescriptorProtoSDKType[]; + enum_type: EnumDescriptorProtoSDKType[]; + service: ServiceDescriptorProtoSDKType[]; + extension: FieldDescriptorProtoSDKType[]; + options?: FileOptionsSDKType; + source_code_info?: SourceCodeInfoSDKType; syntax: string; } /** Describes a message type. */ - export interface DescriptorProto { name: string; field: FieldDescriptorProto[]; @@ -643,11 +491,34 @@ export interface DescriptorProto { * Reserved field names, which may not be used by fields in the same message. * A given name may only be reserved once. */ - reservedName: string[]; } +export interface DescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.DescriptorProto"; + value: Uint8Array; +} +/** Describes a message type. */ +export interface DescriptorProtoAmino { + name?: string; + field?: FieldDescriptorProtoAmino[]; + extension?: FieldDescriptorProtoAmino[]; + nested_type?: DescriptorProtoAmino[]; + enum_type?: EnumDescriptorProtoAmino[]; + extension_range?: DescriptorProto_ExtensionRangeAmino[]; + oneof_decl?: OneofDescriptorProtoAmino[]; + options?: MessageOptionsAmino; + reserved_range?: DescriptorProto_ReservedRangeAmino[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reserved_name?: string[]; +} +export interface DescriptorProtoAminoMsg { + type: "/google.protobuf.DescriptorProto"; + value: DescriptorProtoAmino; +} /** Describes a message type. */ - export interface DescriptorProtoSDKType { name: string; field: FieldDescriptorProtoSDKType[]; @@ -658,26 +529,32 @@ export interface DescriptorProtoSDKType { oneof_decl: OneofDescriptorProtoSDKType[]; options?: MessageOptionsSDKType; reserved_range: DescriptorProto_ReservedRangeSDKType[]; - /** - * Reserved field names, which may not be used by fields in the same message. - * A given name may only be reserved once. - */ - reserved_name: string[]; } export interface DescriptorProto_ExtensionRange { /** Inclusive. */ start: number; /** Exclusive. */ - end: number; options?: ExtensionRangeOptions; } -export interface DescriptorProto_ExtensionRangeSDKType { +export interface DescriptorProto_ExtensionRangeProtoMsg { + typeUrl: "/google.protobuf.ExtensionRange"; + value: Uint8Array; +} +export interface DescriptorProto_ExtensionRangeAmino { /** Inclusive. */ - start: number; + start?: number; /** Exclusive. */ - + end?: number; + options?: ExtensionRangeOptionsAmino; +} +export interface DescriptorProto_ExtensionRangeAminoMsg { + type: "/google.protobuf.ExtensionRange"; + value: DescriptorProto_ExtensionRangeAmino; +} +export interface DescriptorProto_ExtensionRangeSDKType { + start: number; end: number; options?: ExtensionRangeOptionsSDKType; } @@ -686,37 +563,60 @@ export interface DescriptorProto_ExtensionRangeSDKType { * fields or extension ranges in the same message. Reserved ranges may * not overlap. */ - export interface DescriptorProto_ReservedRange { /** Inclusive. */ start: number; /** Exclusive. */ - end: number; } +export interface DescriptorProto_ReservedRangeProtoMsg { + typeUrl: "/google.protobuf.ReservedRange"; + value: Uint8Array; +} /** * Range of reserved tag numbers. Reserved tag numbers may not be used by * fields or extension ranges in the same message. Reserved ranges may * not overlap. */ - -export interface DescriptorProto_ReservedRangeSDKType { +export interface DescriptorProto_ReservedRangeAmino { /** Inclusive. */ - start: number; + start?: number; /** Exclusive. */ - + end?: number; +} +export interface DescriptorProto_ReservedRangeAminoMsg { + type: "/google.protobuf.ReservedRange"; + value: DescriptorProto_ReservedRangeAmino; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRangeSDKType { + start: number; end: number; } export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ExtensionRangeOptionsSDKType { +export interface ExtensionRangeOptionsProtoMsg { + typeUrl: "/google.protobuf.ExtensionRangeOptions"; + value: Uint8Array; +} +export interface ExtensionRangeOptionsAmino { /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface ExtensionRangeOptionsAminoMsg { + type: "/google.protobuf.ExtensionRangeOptions"; + value: ExtensionRangeOptionsAmino; +} +export interface ExtensionRangeOptionsSDKType { uninterpreted_option: UninterpretedOptionSDKType[]; } /** Describes a field within a message. */ - export interface FieldDescriptorProto { name: string; number: number; @@ -725,7 +625,6 @@ export interface FieldDescriptorProto { * If type_name is set, this need not be set. If both this and type_name * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. */ - type: FieldDescriptorProto_Type; /** * For message and enum types, this is the name of the type. If the name @@ -734,13 +633,11 @@ export interface FieldDescriptorProto { * message are searched, then within the parent, on up to the root * namespace). */ - typeName: string; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - extendee: string; /** * For numeric types, contains the original text representation of the value. @@ -749,13 +646,11 @@ export interface FieldDescriptorProto { * For bytes, contains the C escaped value. All bytes >= 128 are escaped. * TODO(kenton): Base-64 encode? */ - defaultValue: string; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - oneofIndex: number; /** * JSON name of this field. The value is set by protocol compiler. If the @@ -763,22 +658,23 @@ export interface FieldDescriptorProto { * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - jsonName: string; options?: FieldOptions; } +export interface FieldDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FieldDescriptorProto"; + value: Uint8Array; +} /** Describes a field within a message. */ - -export interface FieldDescriptorProtoSDKType { - name: string; - number: number; - label: FieldDescriptorProto_LabelSDKType; +export interface FieldDescriptorProtoAmino { + name?: string; + number?: number; + label?: FieldDescriptorProto_Label; /** * If type_name is set, this need not be set. If both this and type_name * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. */ - - type: FieldDescriptorProto_TypeSDKType; + type?: FieldDescriptorProto_Type; /** * For message and enum types, this is the name of the type. If the name * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping @@ -786,14 +682,12 @@ export interface FieldDescriptorProtoSDKType { * message are searched, then within the parent, on up to the root * namespace). */ - - type_name: string; + type_name?: string; /** * For extensions, this is the name of the type being extended. It is * resolved in the same manner as type_name. */ - - extendee: string; + extendee?: string; /** * For numeric types, contains the original text representation of the value. * For booleans, "true" or "false". @@ -801,38 +695,62 @@ export interface FieldDescriptorProtoSDKType { * For bytes, contains the C escaped value. All bytes >= 128 are escaped. * TODO(kenton): Base-64 encode? */ - - default_value: string; + default_value?: string; /** * If set, gives the index of a oneof in the containing type's oneof_decl * list. This field is a member of that oneof. */ - - oneof_index: number; + oneof_index?: number; /** * JSON name of this field. The value is set by protocol compiler. If the * user has set a "json_name" option on this field, that option's value * will be used. Otherwise, it's deduced from the field's name by converting * it to camelCase. */ - + json_name?: string; + options?: FieldOptionsAmino; +} +export interface FieldDescriptorProtoAminoMsg { + type: "/google.protobuf.FieldDescriptorProto"; + value: FieldDescriptorProtoAmino; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProtoSDKType { + name: string; + number: number; + label: FieldDescriptorProto_Label; + type: FieldDescriptorProto_Type; + type_name: string; + extendee: string; + default_value: string; + oneof_index: number; json_name: string; options?: FieldOptionsSDKType; } /** Describes a oneof. */ - export interface OneofDescriptorProto { name: string; options?: OneofOptions; } +export interface OneofDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.OneofDescriptorProto"; + value: Uint8Array; +} +/** Describes a oneof. */ +export interface OneofDescriptorProtoAmino { + name?: string; + options?: OneofOptionsAmino; +} +export interface OneofDescriptorProtoAminoMsg { + type: "/google.protobuf.OneofDescriptorProto"; + value: OneofDescriptorProtoAmino; +} /** Describes a oneof. */ - export interface OneofDescriptorProtoSDKType { name: string; options?: OneofOptionsSDKType; } /** Describes an enum type. */ - export interface EnumDescriptorProto { name: string; value: EnumValueDescriptorProto[]; @@ -842,33 +760,44 @@ export interface EnumDescriptorProto { * by enum values in the same enum declaration. Reserved ranges may not * overlap. */ - reservedRange: EnumDescriptorProto_EnumReservedRange[]; /** * Reserved enum value names, which may not be reused. A given name may only * be reserved once. */ - reservedName: string[]; } +export interface EnumDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumDescriptorProto"; + value: Uint8Array; +} /** Describes an enum type. */ - -export interface EnumDescriptorProtoSDKType { - name: string; - value: EnumValueDescriptorProtoSDKType[]; - options?: EnumOptionsSDKType; +export interface EnumDescriptorProtoAmino { + name?: string; + value?: EnumValueDescriptorProtoAmino[]; + options?: EnumOptionsAmino; /** * Range of reserved numeric values. Reserved numeric values may not be used * by enum values in the same enum declaration. Reserved ranges may not * overlap. */ - - reserved_range: EnumDescriptorProto_EnumReservedRangeSDKType[]; + reserved_range?: EnumDescriptorProto_EnumReservedRangeAmino[]; /** * Reserved enum value names, which may not be reused. A given name may only * be reserved once. */ - + reserved_name?: string[]; +} +export interface EnumDescriptorProtoAminoMsg { + type: "/google.protobuf.EnumDescriptorProto"; + value: EnumDescriptorProtoAmino; +} +/** Describes an enum type. */ +export interface EnumDescriptorProtoSDKType { + name: string; + value: EnumValueDescriptorProtoSDKType[]; + options?: EnumOptionsSDKType; + reserved_range: EnumDescriptorProto_EnumReservedRangeSDKType[]; reserved_name: string[]; } /** @@ -879,14 +808,16 @@ export interface EnumDescriptorProtoSDKType { * is inclusive such that it can appropriately represent the entire int32 * domain. */ - export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ start: number; /** Inclusive. */ - end: number; } +export interface EnumDescriptorProto_EnumReservedRangeProtoMsg { + typeUrl: "/google.protobuf.EnumReservedRange"; + value: Uint8Array; +} /** * Range of reserved numeric values. Reserved values may not be used by * entries in the same enum. Reserved ranges may not overlap. @@ -895,78 +826,125 @@ export interface EnumDescriptorProto_EnumReservedRange { * is inclusive such that it can appropriately represent the entire int32 * domain. */ - -export interface EnumDescriptorProto_EnumReservedRangeSDKType { +export interface EnumDescriptorProto_EnumReservedRangeAmino { /** Inclusive. */ - start: number; + start?: number; /** Inclusive. */ - + end?: number; +} +export interface EnumDescriptorProto_EnumReservedRangeAminoMsg { + type: "/google.protobuf.EnumReservedRange"; + value: EnumDescriptorProto_EnumReservedRangeAmino; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRangeSDKType { + start: number; end: number; } /** Describes a value within an enum. */ - export interface EnumValueDescriptorProto { name: string; number: number; options?: EnumValueOptions; } +export interface EnumValueDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumValueDescriptorProto"; + value: Uint8Array; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProtoAmino { + name?: string; + number?: number; + options?: EnumValueOptionsAmino; +} +export interface EnumValueDescriptorProtoAminoMsg { + type: "/google.protobuf.EnumValueDescriptorProto"; + value: EnumValueDescriptorProtoAmino; +} /** Describes a value within an enum. */ - export interface EnumValueDescriptorProtoSDKType { name: string; number: number; options?: EnumValueOptionsSDKType; } /** Describes a service. */ - export interface ServiceDescriptorProto { name: string; method: MethodDescriptorProto[]; options?: ServiceOptions; } +export interface ServiceDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.ServiceDescriptorProto"; + value: Uint8Array; +} +/** Describes a service. */ +export interface ServiceDescriptorProtoAmino { + name?: string; + method?: MethodDescriptorProtoAmino[]; + options?: ServiceOptionsAmino; +} +export interface ServiceDescriptorProtoAminoMsg { + type: "/google.protobuf.ServiceDescriptorProto"; + value: ServiceDescriptorProtoAmino; +} /** Describes a service. */ - export interface ServiceDescriptorProtoSDKType { name: string; method: MethodDescriptorProtoSDKType[]; options?: ServiceOptionsSDKType; } /** Describes a method of a service. */ - export interface MethodDescriptorProto { name: string; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - inputType: string; outputType: string; options?: MethodOptions; /** Identifies if client streams multiple client messages */ - clientStreaming: boolean; /** Identifies if server streams multiple server messages */ - serverStreaming: boolean; } +export interface MethodDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.MethodDescriptorProto"; + value: Uint8Array; +} /** Describes a method of a service. */ - -export interface MethodDescriptorProtoSDKType { - name: string; +export interface MethodDescriptorProtoAmino { + name?: string; /** * Input and output type names. These are resolved in the same way as * FieldDescriptorProto.type_name, but must refer to a message type. */ - + input_type?: string; + output_type?: string; + options?: MethodOptionsAmino; + /** Identifies if client streams multiple client messages */ + client_streaming?: boolean; + /** Identifies if server streams multiple server messages */ + server_streaming?: boolean; +} +export interface MethodDescriptorProtoAminoMsg { + type: "/google.protobuf.MethodDescriptorProto"; + value: MethodDescriptorProtoAmino; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProtoSDKType { + name: string; input_type: string; output_type: string; options?: MethodOptionsSDKType; - /** Identifies if client streams multiple client messages */ - client_streaming: boolean; - /** Identifies if server streams multiple server messages */ - server_streaming: boolean; } export interface FileOptions { @@ -984,7 +962,6 @@ export interface FileOptions { * a .proto always translates to a single class, but you may want to * explicitly choose the class name). */ - javaOuterClassname: string; /** * If set true, then the Java code generator will generate a separate .java @@ -994,12 +971,9 @@ export interface FileOptions { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - javaMultipleFiles: boolean; /** This option does nothing. */ - /** @deprecated */ - javaGenerateEqualsAndHash: boolean; /** * If set true, then the Java2 code generator will generate code that @@ -1009,7 +983,6 @@ 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; /** @@ -1019,7 +992,6 @@ export interface FileOptions { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - goPackage: string; /** * Should generic services be generated in each language? "Generic" services @@ -1033,7 +1005,6 @@ 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; @@ -1044,22 +1015,18 @@ export interface FileOptions { * for everything in the file, or it will be completely ignored; in the very * least, this is a formalization for deprecating files. */ - deprecated: boolean; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - ccEnableArenas: boolean; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - objcClassPrefix: string; /** Namespace for generated classes; defaults to the package. */ - csharpNamespace: string; /** * By default Swift generators will take the proto package and CamelCase it @@ -1067,50 +1034,48 @@ export interface FileOptions { * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - swiftPrefix: string; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - phpClassPrefix: string; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - phpNamespace: string; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - phpMetadataNamespace: string; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - rubyPackage: string; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. */ - uninterpretedOption: UninterpretedOption[]; } -export interface FileOptionsSDKType { +export interface FileOptionsProtoMsg { + typeUrl: "/google.protobuf.FileOptions"; + value: Uint8Array; +} +export interface FileOptionsAmino { /** * Sets the Java package where classes generated from this .proto will be * placed. By default, the proto package is used, but this is often * inappropriate because proto packages do not normally start with backwards * domain names. */ - java_package: string; + java_package?: string; /** * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 @@ -1118,8 +1083,7 @@ export interface FileOptionsSDKType { * a .proto always translates to a single class, but you may want to * explicitly choose the class name). */ - - java_outer_classname: string; + java_outer_classname?: string; /** * If set true, then the Java code generator will generate a separate .java * file for each top-level message, enum, and service defined in the .proto @@ -1128,13 +1092,10 @@ export interface FileOptionsSDKType { * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. */ - - java_multiple_files: boolean; + java_multiple_files?: boolean; /** This option does nothing. */ - /** @deprecated */ - - java_generate_equals_and_hash: boolean; + java_generate_equals_and_hash?: boolean; /** * If set true, then the Java2 code generator will generate code that * throws an exception whenever an attempt is made to assign a non-UTF-8 @@ -1143,9 +1104,8 @@ export interface FileOptionsSDKType { * However, an extension field still accepts non-UTF-8 byte sequences. * This option has no effect on when used with the lite runtime. */ - - java_string_check_utf8: boolean; - optimize_for: FileOptions_OptimizeModeSDKType; + java_string_check_utf8?: boolean; + optimize_for?: FileOptions_OptimizeMode; /** * Sets the Go package where structs generated from this .proto will be * placed. If omitted, the Go package will be derived from the following: @@ -1153,8 +1113,7 @@ export interface FileOptionsSDKType { * - Otherwise, the package statement in the .proto file, if present. * - Otherwise, the basename of the .proto file, without extension. */ - - go_package: string; + go_package?: string; /** * Should generic services be generated in each language? "Generic" services * are not specific to any particular RPC system. They are generated by the @@ -1167,74 +1126,91 @@ export interface FileOptionsSDKType { * these default to false. Old code which depends on generic services should * explicitly set them to true. */ - - cc_generic_services: boolean; - java_generic_services: boolean; - py_generic_services: boolean; - php_generic_services: boolean; + cc_generic_services?: boolean; + java_generic_services?: boolean; + py_generic_services?: boolean; + php_generic_services?: boolean; /** * Is this file deprecated? * Depending on the target platform, this can emit Deprecated annotations * for everything in the file, or it will be completely ignored; in the very * least, this is a formalization for deprecating files. */ - - deprecated: boolean; + deprecated?: boolean; /** * Enables the use of arenas for the proto messages in this file. This applies * only to generated classes for C++. */ - - cc_enable_arenas: boolean; + cc_enable_arenas?: boolean; /** * Sets the objective c class prefix which is prepended to all objective c * generated classes from this .proto. There is no default. */ - - objc_class_prefix: string; + objc_class_prefix?: string; /** Namespace for generated classes; defaults to the package. */ - - csharp_namespace: string; + csharp_namespace?: string; /** * By default Swift generators will take the proto package and CamelCase it * replacing '.' with underscore and use that to prefix the types/symbols * defined. When this options is provided, they will use this value instead * to prefix the types/symbols defined. */ - - swift_prefix: string; + swift_prefix?: string; /** * Sets the php class prefix which is prepended to all php generated classes * from this .proto. Default is empty. */ - - php_class_prefix: string; + php_class_prefix?: string; /** * Use this option to change the namespace of php generated classes. Default * is empty. When this option is empty, the package name will be used for * determining the namespace. */ - - php_namespace: string; + php_namespace?: string; /** * Use this option to change the namespace of php generated metadata classes. * Default is empty. When this option is empty, the proto file name will be * used for determining the namespace. */ - - php_metadata_namespace: string; + php_metadata_namespace?: string; /** * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. */ - - ruby_package: string; + ruby_package?: string; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. */ - + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface FileOptionsAminoMsg { + type: "/google.protobuf.FileOptions"; + value: FileOptionsAmino; +} +export interface FileOptionsSDKType { + java_package: string; + java_outer_classname: string; + java_multiple_files: boolean; + /** @deprecated */ + java_generate_equals_and_hash: boolean; + java_string_check_utf8: boolean; + optimize_for: FileOptions_OptimizeMode; + go_package: string; + cc_generic_services: boolean; + java_generic_services: boolean; + py_generic_services: boolean; + php_generic_services: boolean; + deprecated: boolean; + cc_enable_arenas: boolean; + objc_class_prefix: string; + csharp_namespace: string; + swift_prefix: string; + php_class_prefix: string; + php_namespace: string; + php_metadata_namespace: string; + ruby_package: string; uninterpreted_option: UninterpretedOptionSDKType[]; } export interface MessageOptions { @@ -1264,7 +1240,6 @@ export interface MessageOptions { * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - noStandardDescriptorAccessor: boolean; /** * Is this message deprecated? @@ -1272,7 +1247,6 @@ export interface MessageOptions { * for the message, or it will be completely ignored; in the very least, * this is a formalization for deprecating messages. */ - deprecated: boolean; /** * Whether the message is an automatically generated map entry type for the @@ -1297,13 +1271,15 @@ export interface MessageOptions { * instead. The option should only be implicitly set by the proto compiler * parser. */ - mapEntry: boolean; /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; } -export interface MessageOptionsSDKType { +export interface MessageOptionsProtoMsg { + typeUrl: "/google.protobuf.MessageOptions"; + value: Uint8Array; +} +export interface MessageOptionsAmino { /** * Set true to use the old proto1 MessageSet wire format for extensions. * This is provided for backwards-compatibility with the MessageSet wire @@ -1324,22 +1300,20 @@ export interface MessageOptionsSDKType { * Because this is an option, the above two restrictions are not enforced by * the protocol compiler. */ - message_set_wire_format: boolean; + message_set_wire_format?: boolean; /** * Disables the generation of the standard "descriptor()" accessor, which can * conflict with a field of the same name. This is meant to make migration * from proto1 easier; new code should avoid fields named "descriptor". */ - - no_standard_descriptor_accessor: boolean; + no_standard_descriptor_accessor?: boolean; /** * Is this message deprecated? * Depending on the target platform, this can emit Deprecated annotations * for the message, or it will be completely ignored; in the very least, * this is a formalization for deprecating messages. */ - - deprecated: boolean; + deprecated?: boolean; /** * Whether the message is an automatically generated map entry type for the * maps field. @@ -1363,10 +1337,19 @@ export interface MessageOptionsSDKType { * instead. The option should only be implicitly set by the proto compiler * parser. */ - - map_entry: boolean; + map_entry?: boolean; /** The parser stores options it doesn't recognize here. See above. */ - + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface MessageOptionsAminoMsg { + type: "/google.protobuf.MessageOptions"; + value: MessageOptionsAmino; +} +export interface MessageOptionsSDKType { + message_set_wire_format: boolean; + no_standard_descriptor_accessor: boolean; + deprecated: boolean; + map_entry: boolean; uninterpreted_option: UninterpretedOptionSDKType[]; } export interface FieldOptions { @@ -1384,7 +1367,6 @@ export interface FieldOptions { * a single length-delimited blob. In proto3, only explicit setting it to * false will avoid using packed encoding. */ - packed: boolean; /** * The jstype option determines the JavaScript type used for values of the @@ -1399,7 +1381,6 @@ export interface FieldOptions { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - jstype: FieldOptions_JSType; /** * Should this field be parsed lazily? Lazy applies only to message-type @@ -1431,7 +1412,6 @@ export interface FieldOptions { * check its required fields, regardless of whether or not the message has * been parsed. */ - lazy: boolean; /** * Is this field deprecated? @@ -1439,23 +1419,24 @@ export interface FieldOptions { * for accessors, or it will be completely ignored; in the very least, this * is a formalization for deprecating fields. */ - deprecated: boolean; /** For Google-internal migration only. Do not use. */ - weak: boolean; /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; } -export interface FieldOptionsSDKType { +export interface FieldOptionsProtoMsg { + typeUrl: "/google.protobuf.FieldOptions"; + value: Uint8Array; +} +export interface FieldOptionsAmino { /** * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific * options below. This option is not yet implemented in the open source * release -- sorry, we'll try to include it in a future version! */ - ctype: FieldOptions_CTypeSDKType; + ctype?: FieldOptions_CType; /** * The packed option can be enabled for repeated primitive fields to enable * a more efficient representation on the wire. Rather than repeatedly @@ -1463,8 +1444,7 @@ export interface FieldOptionsSDKType { * a single length-delimited blob. In proto3, only explicit setting it to * false will avoid using packed encoding. */ - - packed: boolean; + packed?: boolean; /** * The jstype option determines the JavaScript type used for values of the * field. The option is permitted only for 64 bit integral and fixed types @@ -1478,8 +1458,7 @@ export interface FieldOptionsSDKType { * This option is an enum to permit additional types to be added, e.g. * goog.math.Integer. */ - - jstype: FieldOptions_JSTypeSDKType; + jstype?: FieldOptions_JSType; /** * Should this field be parsed lazily? Lazy applies only to message-type * fields. It means that when the outer message is initially parsed, the @@ -1510,29 +1489,49 @@ export interface FieldOptionsSDKType { * check its required fields, regardless of whether or not the message has * been parsed. */ - - lazy: boolean; + lazy?: boolean; /** * Is this field deprecated? * Depending on the target platform, this can emit Deprecated annotations * for accessors, or it will be completely ignored; in the very least, this * is a formalization for deprecating fields. */ - - deprecated: boolean; + deprecated?: boolean; /** For Google-internal migration only. Do not use. */ - - weak: boolean; + weak?: boolean; /** The parser stores options it doesn't recognize here. See above. */ - + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface FieldOptionsAminoMsg { + type: "/google.protobuf.FieldOptions"; + value: FieldOptionsAmino; +} +export interface FieldOptionsSDKType { + ctype: FieldOptions_CType; + packed: boolean; + jstype: FieldOptions_JSType; + lazy: boolean; + deprecated: boolean; + weak: boolean; uninterpreted_option: UninterpretedOptionSDKType[]; } export interface OneofOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface OneofOptionsSDKType { +export interface OneofOptionsProtoMsg { + typeUrl: "/google.protobuf.OneofOptions"; + value: Uint8Array; +} +export interface OneofOptionsAmino { /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface OneofOptionsAminoMsg { + type: "/google.protobuf.OneofOptions"; + value: OneofOptionsAmino; +} +export interface OneofOptionsSDKType { uninterpreted_option: UninterpretedOptionSDKType[]; } export interface EnumOptions { @@ -1547,28 +1546,37 @@ export interface EnumOptions { * for the enum, or it will be completely ignored; in the very least, this * is a formalization for deprecating enums. */ - deprecated: boolean; /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; } -export interface EnumOptionsSDKType { +export interface EnumOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumOptions"; + value: Uint8Array; +} +export interface EnumOptionsAmino { /** * Set this option to true to allow mapping different tag names to the same * value. */ - allow_alias: boolean; + allow_alias?: boolean; /** * Is this enum deprecated? * Depending on the target platform, this can emit Deprecated annotations * for the enum, or it will be completely ignored; in the very least, this * is a formalization for deprecating enums. */ - - deprecated: boolean; + deprecated?: boolean; /** The parser stores options it doesn't recognize here. See above. */ - + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface EnumOptionsAminoMsg { + type: "/google.protobuf.EnumOptions"; + value: EnumOptionsAmino; +} +export interface EnumOptionsSDKType { + allow_alias: boolean; + deprecated: boolean; uninterpreted_option: UninterpretedOptionSDKType[]; } export interface EnumValueOptions { @@ -1580,19 +1588,29 @@ export interface EnumValueOptions { */ deprecated: boolean; /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; } -export interface EnumValueOptionsSDKType { +export interface EnumValueOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumValueOptions"; + value: Uint8Array; +} +export interface EnumValueOptionsAmino { /** * Is this enum value deprecated? * Depending on the target platform, this can emit Deprecated annotations * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. */ - deprecated: boolean; + deprecated?: boolean; /** The parser stores options it doesn't recognize here. See above. */ - + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface EnumValueOptionsAminoMsg { + type: "/google.protobuf.EnumValueOptions"; + value: EnumValueOptionsAmino; +} +export interface EnumValueOptionsSDKType { + deprecated: boolean; uninterpreted_option: UninterpretedOptionSDKType[]; } export interface ServiceOptions { @@ -1604,19 +1622,29 @@ export interface ServiceOptions { */ deprecated: boolean; /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; } -export interface ServiceOptionsSDKType { +export interface ServiceOptionsProtoMsg { + typeUrl: "/google.protobuf.ServiceOptions"; + value: Uint8Array; +} +export interface ServiceOptionsAmino { /** * 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; /** The parser stores options it doesn't recognize here. See above. */ - + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface ServiceOptionsAminoMsg { + type: "/google.protobuf.ServiceOptions"; + value: ServiceOptionsAmino; +} +export interface ServiceOptionsSDKType { + deprecated: boolean; uninterpreted_option: UninterpretedOptionSDKType[]; } export interface MethodOptions { @@ -1629,20 +1657,31 @@ export interface MethodOptions { deprecated: boolean; idempotencyLevel: MethodOptions_IdempotencyLevel; /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; } -export interface MethodOptionsSDKType { +export interface MethodOptionsProtoMsg { + typeUrl: "/google.protobuf.MethodOptions"; + value: Uint8Array; +} +export interface MethodOptionsAmino { /** * Is this method deprecated? * Depending on the target platform, this can emit Deprecated annotations * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. */ - deprecated: boolean; - idempotency_level: MethodOptions_IdempotencyLevelSDKType; + deprecated?: boolean; + idempotency_level?: MethodOptions_IdempotencyLevel; /** The parser stores options it doesn't recognize here. See above. */ - + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface MethodOptionsAminoMsg { + type: "/google.protobuf.MethodOptions"; + value: MethodOptionsAmino; +} +export interface MethodOptionsSDKType { + deprecated: boolean; + idempotency_level: MethodOptions_IdempotencyLevel; uninterpreted_option: UninterpretedOptionSDKType[]; } /** @@ -1653,21 +1692,23 @@ export interface MethodOptionsSDKType { * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions * in them. */ - export interface UninterpretedOption { name: UninterpretedOption_NamePart[]; /** * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - identifierValue: string; - positiveIntValue: Long; - negativeIntValue: Long; + positiveIntValue: bigint; + negativeIntValue: bigint; doubleValue: number; stringValue: Uint8Array; aggregateValue: string; } +export interface UninterpretedOptionProtoMsg { + typeUrl: "/google.protobuf.UninterpretedOption"; + value: Uint8Array; +} /** * A message representing a option the parser does not recognize. This only * appears in options protos created by the compiler::Parser class. @@ -1676,17 +1717,36 @@ export interface UninterpretedOption { * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions * in them. */ - -export interface UninterpretedOptionSDKType { - name: UninterpretedOption_NamePartSDKType[]; +export interface UninterpretedOptionAmino { + name?: UninterpretedOption_NamePartAmino[]; /** * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. */ - + identifier_value?: string; + positive_int_value?: string; + negative_int_value?: string; + double_value?: number; + string_value?: string; + aggregate_value?: string; +} +export interface UninterpretedOptionAminoMsg { + type: "/google.protobuf.UninterpretedOption"; + value: UninterpretedOptionAmino; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOptionSDKType { + name: UninterpretedOption_NamePartSDKType[]; identifier_value: string; - positive_int_value: Long; - negative_int_value: Long; + positive_int_value: bigint; + negative_int_value: bigint; double_value: number; string_value: Uint8Array; aggregate_value: string; @@ -1698,11 +1758,29 @@ export interface UninterpretedOptionSDKType { * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents * "foo.(bar.baz).qux". */ - export interface UninterpretedOption_NamePart { namePart: string; isExtension: boolean; } +export interface UninterpretedOption_NamePartProtoMsg { + typeUrl: "/google.protobuf.NamePart"; + value: Uint8Array; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePartAmino { + name_part?: string; + is_extension?: boolean; +} +export interface UninterpretedOption_NamePartAminoMsg { + type: "/google.protobuf.NamePart"; + value: UninterpretedOption_NamePartAmino; +} /** * 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 @@ -1710,7 +1788,6 @@ export interface UninterpretedOption_NamePart { * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents * "foo.(bar.baz).qux". */ - export interface UninterpretedOption_NamePartSDKType { name_part: string; is_extension: boolean; @@ -1719,7 +1796,6 @@ export interface UninterpretedOption_NamePartSDKType { * 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 @@ -1768,12 +1844,15 @@ export interface SourceCodeInfo { */ location: SourceCodeInfo_Location[]; } +export interface SourceCodeInfoProtoMsg { + typeUrl: "/google.protobuf.SourceCodeInfo"; + value: Uint8Array; +} /** * Encapsulates information about the original source file from which a * FileDescriptorProto was generated. */ - -export interface SourceCodeInfoSDKType { +export interface SourceCodeInfoAmino { /** * A Location identifies a piece of source code in a .proto file which * corresponds to a particular definition. This information is intended @@ -1819,6 +1898,17 @@ export interface SourceCodeInfoSDKType { * ignore those that it doesn't understand, as more types of locations could * be recorded in the future. */ + location?: SourceCodeInfo_LocationAmino[]; +} +export interface SourceCodeInfoAminoMsg { + type: "/google.protobuf.SourceCodeInfo"; + value: SourceCodeInfoAmino; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfoSDKType { location: SourceCodeInfo_LocationSDKType[]; } export interface SourceCodeInfo_Location { @@ -1855,7 +1945,6 @@ export interface SourceCodeInfo_Location { * and column numbers are zero-based -- typically you will want to add * 1 to each before displaying to a user. */ - span: number[]; /** * If this SourceCodeInfo represents a complete declaration, these are any @@ -1906,12 +1995,15 @@ export interface SourceCodeInfo_Location { * * // ignored detached comments. */ - leadingComments: string; trailingComments: string; leadingDetachedComments: string[]; } -export interface SourceCodeInfo_LocationSDKType { +export interface SourceCodeInfo_LocationProtoMsg { + typeUrl: "/google.protobuf.Location"; + value: Uint8Array; +} +export interface SourceCodeInfo_LocationAmino { /** * Identifies which part of the FileDescriptorProto was defined at this * location. @@ -1937,7 +2029,7 @@ export interface SourceCodeInfo_LocationSDKType { * this path refers to the whole field declaration (from the beginning * of the label to the terminating semicolon). */ - path: number[]; + path?: number[]; /** * Always has exactly three or four elements: start line, start column, * end line (optional, otherwise assumed same as start line), end column. @@ -1945,8 +2037,7 @@ export interface SourceCodeInfo_LocationSDKType { * and column numbers are zero-based -- typically you will want to add * 1 to each before displaying to a user. */ - - span: number[]; + span?: number[]; /** * If this SourceCodeInfo represents a complete declaration, these are any * comments appearing before and after the declaration which appear to be @@ -1996,7 +2087,17 @@ export interface SourceCodeInfo_LocationSDKType { * * // ignored detached comments. */ - + leading_comments?: string; + trailing_comments?: string; + leading_detached_comments?: string[]; +} +export interface SourceCodeInfo_LocationAminoMsg { + type: "/google.protobuf.Location"; + value: SourceCodeInfo_LocationAmino; +} +export interface SourceCodeInfo_LocationSDKType { + path: number[]; + span: number[]; leading_comments: string; trailing_comments: string; leading_detached_comments: string[]; @@ -2006,7 +2107,6 @@ export interface SourceCodeInfo_LocationSDKType { * file. A GeneratedCodeInfo message is associated with only one generated * source file, but may contain references to different source .proto files. */ - export interface GeneratedCodeInfo { /** * An Annotation connects some span of text in generated code to an element @@ -2014,17 +2114,32 @@ export interface GeneratedCodeInfo { */ annotation: GeneratedCodeInfo_Annotation[]; } +export interface GeneratedCodeInfoProtoMsg { + typeUrl: "/google.protobuf.GeneratedCodeInfo"; + value: Uint8Array; +} /** * Describes the relationship between generated code and its original source * file. A GeneratedCodeInfo message is associated with only one generated * source file, but may contain references to different source .proto files. */ - -export interface GeneratedCodeInfoSDKType { +export interface GeneratedCodeInfoAmino { /** * An Annotation connects some span of text in generated code to an element * of its generating .proto file. */ + annotation?: GeneratedCodeInfo_AnnotationAmino[]; +} +export interface GeneratedCodeInfoAminoMsg { + type: "/google.protobuf.GeneratedCodeInfo"; + value: GeneratedCodeInfoAmino; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfoSDKType { annotation: GeneratedCodeInfo_AnnotationSDKType[]; } export interface GeneratedCodeInfo_Annotation { @@ -2034,91 +2149,118 @@ export interface GeneratedCodeInfo_Annotation { */ path: number[]; /** Identifies the filesystem path to the original source .proto. */ - sourceFile: string; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - begin: number; /** * Identifies the ending offset in bytes in the generated code that * relates to the identified offset. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - end: number; } -export interface GeneratedCodeInfo_AnnotationSDKType { +export interface GeneratedCodeInfo_AnnotationProtoMsg { + typeUrl: "/google.protobuf.Annotation"; + value: Uint8Array; +} +export interface GeneratedCodeInfo_AnnotationAmino { /** * Identifies the element in the original source .proto file. This field * is formatted the same as SourceCodeInfo.Location.path. */ - path: number[]; + path?: number[]; /** Identifies the filesystem path to the original source .proto. */ - - source_file: string; + source_file?: string; /** * Identifies the starting offset in bytes in the generated code * that relates to the identified object. */ - - begin: number; + begin?: number; /** * Identifies the ending offset in bytes in the generated code that * relates to the identified offset. The end offset should be one past * the last relevant byte (so the length of the text = end - begin). */ - + end?: number; +} +export interface GeneratedCodeInfo_AnnotationAminoMsg { + type: "/google.protobuf.Annotation"; + value: GeneratedCodeInfo_AnnotationAmino; +} +export interface GeneratedCodeInfo_AnnotationSDKType { + path: number[]; + source_file: string; + begin: number; end: number; } - function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [] }; } - export const FileDescriptorSet = { - encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.FileDescriptorSet", + encode(message: FileDescriptorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.file) { FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): FileDescriptorSet { + fromPartial(object: Partial): FileDescriptorSet { const message = createBaseFileDescriptorSet(); message.file = object.file?.map(e => FileDescriptorProto.fromPartial(e)) || []; return message; + }, + fromAmino(object: FileDescriptorSetAmino): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map(e => FileDescriptorProto.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileDescriptorSet): FileDescriptorSetAmino { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); + } else { + obj.file = []; + } + return obj; + }, + fromAminoMsg(object: FileDescriptorSetAminoMsg): FileDescriptorSet { + return FileDescriptorSet.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorSetProtoMsg): FileDescriptorSet { + return FileDescriptorSet.decode(message.value); + }, + toProto(message: FileDescriptorSet): Uint8Array { + return FileDescriptorSet.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorSet): FileDescriptorSetProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorSet", + value: FileDescriptorSet.encode(message).finish() + }; } - }; - function createBaseFileDescriptorProto(): FileDescriptorProto { return { name: "", @@ -2135,152 +2277,116 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { syntax: "" }; } - export const FileDescriptorProto = { - encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.FileDescriptorProto", + encode(message: FileDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== "") { writer.uint32(18).string(message.package); } - for (const v of message.dependency) { writer.uint32(26).string(v!); } - writer.uint32(82).fork(); - for (const v of message.publicDependency) { writer.int32(v); } - writer.ldelim(); writer.uint32(90).fork(); - for (const v of message.weakDependency) { writer.int32(v); } - writer.ldelim(); - for (const v of message.messageType) { DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); } - for (const v of message.enumType) { EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); } - for (const v of message.service) { ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); } - for (const v of message.extension) { FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.options !== undefined) { FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); } - if (message.sourceCodeInfo !== undefined) { SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); } - if (message.syntax !== "") { writer.uint32(98).string(message.syntax); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.package = reader.string(); break; - case 3: message.dependency.push(reader.string()); break; - case 10: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.publicDependency.push(reader.int32()); } } else { message.publicDependency.push(reader.int32()); } - break; - case 11: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.weakDependency.push(reader.int32()); } } else { message.weakDependency.push(reader.int32()); } - break; - case 4: message.messageType.push(DescriptorProto.decode(reader, reader.uint32())); break; - case 5: message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); break; - case 6: message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); break; - case 7: message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); break; - case 8: message.options = FileOptions.decode(reader, reader.uint32()); break; - case 9: message.sourceCodeInfo = SourceCodeInfo.decode(reader, reader.uint32()); break; - case 12: message.syntax = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): FileDescriptorProto { + fromPartial(object: Partial): FileDescriptorProto { const message = createBaseFileDescriptorProto(); message.name = object.name ?? ""; message.package = object.package ?? ""; @@ -2295,10 +2401,93 @@ export const FileDescriptorProto = { message.sourceCodeInfo = object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; return message; + }, + fromAmino(object: FileDescriptorProtoAmino): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.package !== undefined && object.package !== null) { + message.package = object.package; + } + message.dependency = object.dependency?.map(e => e) || []; + message.publicDependency = object.public_dependency?.map(e => e) || []; + message.weakDependency = object.weak_dependency?.map(e => e) || []; + message.messageType = object.message_type?.map(e => DescriptorProto.fromAmino(e)) || []; + message.enumType = object.enum_type?.map(e => EnumDescriptorProto.fromAmino(e)) || []; + message.service = object.service?.map(e => ServiceDescriptorProto.fromAmino(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = FileOptions.fromAmino(object.options); + } + if (object.source_code_info !== undefined && object.source_code_info !== null) { + message.sourceCodeInfo = SourceCodeInfo.fromAmino(object.source_code_info); + } + if (object.syntax !== undefined && object.syntax !== null) { + message.syntax = object.syntax; + } + return message; + }, + toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.package = message.package; + if (message.dependency) { + obj.dependency = message.dependency.map(e => e); + } else { + obj.dependency = []; + } + if (message.publicDependency) { + obj.public_dependency = message.publicDependency.map(e => e); + } else { + obj.public_dependency = []; + } + if (message.weakDependency) { + obj.weak_dependency = message.weakDependency.map(e => e); + } else { + obj.weak_dependency = []; + } + if (message.messageType) { + obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); + } else { + obj.message_type = []; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); + } else { + obj.enum_type = []; + } + if (message.service) { + obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.extension = []; + } + obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; + obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; + obj.syntax = message.syntax; + return obj; + }, + fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { + return FileDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorProtoProtoMsg): FileDescriptorProto { + return FileDescriptorProto.decode(message.value); + }, + toProto(message: FileDescriptorProto): Uint8Array { + return FileDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorProto): FileDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorProto", + value: FileDescriptorProto.encode(message).finish() + }; } - }; - function createBaseDescriptorProto(): DescriptorProto { return { name: "", @@ -2313,111 +2502,86 @@ function createBaseDescriptorProto(): DescriptorProto { reservedName: [] }; } - export const DescriptorProto = { - encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.DescriptorProto", + encode(message: DescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - for (const v of message.field) { FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.extension) { FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); } - for (const v of message.nestedType) { DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.enumType) { EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); } - for (const v of message.extensionRange) { DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); } - for (const v of message.oneofDecl) { OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); } - if (message.options !== undefined) { MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); } - for (const v of message.reservedRange) { DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); } - for (const v of message.reservedName) { writer.uint32(82).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); break; - case 6: message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); break; - case 3: message.nestedType.push(DescriptorProto.decode(reader, reader.uint32())); break; - case 4: message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); break; - case 5: message.extensionRange.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); break; - case 8: message.oneofDecl.push(OneofDescriptorProto.decode(reader, reader.uint32())); break; - case 7: message.options = MessageOptions.decode(reader, reader.uint32()); break; - case 9: message.reservedRange.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); break; - case 10: message.reservedName.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DescriptorProto { + fromPartial(object: Partial): DescriptorProto { const message = createBaseDescriptorProto(); message.name = object.name ?? ""; message.field = object.field?.map(e => FieldDescriptorProto.fromPartial(e)) || []; @@ -2430,10 +2594,87 @@ export const DescriptorProto = { message.reservedRange = object.reservedRange?.map(e => DescriptorProto_ReservedRange.fromPartial(e)) || []; message.reservedName = object.reservedName?.map(e => e) || []; return message; + }, + fromAmino(object: DescriptorProtoAmino): DescriptorProto { + const message = createBaseDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.field = object.field?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + message.nestedType = object.nested_type?.map(e => DescriptorProto.fromAmino(e)) || []; + message.enumType = object.enum_type?.map(e => EnumDescriptorProto.fromAmino(e)) || []; + message.extensionRange = object.extension_range?.map(e => DescriptorProto_ExtensionRange.fromAmino(e)) || []; + message.oneofDecl = object.oneof_decl?.map(e => OneofDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = MessageOptions.fromAmino(object.options); + } + message.reservedRange = object.reserved_range?.map(e => DescriptorProto_ReservedRange.fromAmino(e)) || []; + message.reservedName = object.reserved_name?.map(e => e) || []; + return message; + }, + toAmino(message: DescriptorProto): DescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + if (message.field) { + obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.extension = []; + } + if (message.nestedType) { + obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); + } else { + obj.nested_type = []; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); + } else { + obj.enum_type = []; + } + if (message.extensionRange) { + obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); + } else { + obj.extension_range = []; + } + if (message.oneofDecl) { + obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); + } else { + obj.oneof_decl = []; + } + obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); + } else { + obj.reserved_range = []; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + fromAminoMsg(object: DescriptorProtoAminoMsg): DescriptorProto { + return DescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProtoProtoMsg): DescriptorProto { + return DescriptorProto.decode(message.value); + }, + toProto(message: DescriptorProto): Uint8Array { + return DescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto): DescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.DescriptorProto", + value: DescriptorProto.encode(message).finish() + }; } - }; - function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { return { start: 0, @@ -2441,164 +2682,226 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa options: undefined }; } - export const DescriptorProto_ExtensionRange = { - encode(message: DescriptorProto_ExtensionRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.ExtensionRange", + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { writer.uint32(16).int32(message.end); } - if (message.options !== undefined) { ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.start = reader.int32(); break; - case 2: message.end = reader.int32(); break; - case 3: message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { + fromPartial(object: Partial): DescriptorProto_ExtensionRange { const message = createBaseDescriptorProto_ExtensionRange(); message.start = object.start ?? 0; message.end = object.end ?? 0; message.options = object.options !== undefined && object.options !== null ? ExtensionRangeOptions.fromPartial(object.options) : undefined; return message; + }, + fromAmino(object: DescriptorProto_ExtensionRangeAmino): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + if (object.options !== undefined && object.options !== null) { + message.options = ExtensionRangeOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: DescriptorProto_ExtensionRangeAminoMsg): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProto_ExtensionRangeProtoMsg): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.decode(message.value); + }, + toProto(message: DescriptorProto_ExtensionRange): Uint8Array { + return DescriptorProto_ExtensionRange.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRange", + value: DescriptorProto_ExtensionRange.encode(message).finish() + }; } - }; - function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { return { start: 0, end: 0 }; } - export const DescriptorProto_ReservedRange = { - encode(message: DescriptorProto_ReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.ReservedRange", + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { writer.uint32(16).int32(message.end); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ReservedRange { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.start = reader.int32(); break; - case 2: message.end = reader.int32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { + fromPartial(object: Partial): DescriptorProto_ReservedRange { const message = createBaseDescriptorProto_ReservedRange(); message.start = object.start ?? 0; message.end = object.end ?? 0; return message; + }, + fromAmino(object: DescriptorProto_ReservedRangeAmino): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + return obj; + }, + fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProto_ReservedRangeProtoMsg): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.decode(message.value); + }, + toProto(message: DescriptorProto_ReservedRange): Uint8Array { + return DescriptorProto_ReservedRange.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ReservedRange", + value: DescriptorProto_ReservedRange.encode(message).finish() + }; } - }; - function createBaseExtensionRangeOptions(): ExtensionRangeOptions { return { uninterpretedOption: [] }; } - export const ExtensionRangeOptions = { - encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + encode(message: ExtensionRangeOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExtensionRangeOptions(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ExtensionRangeOptions { + fromPartial(object: Partial): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: ExtensionRangeOptionsAmino): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExtensionRangeOptions): ExtensionRangeOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: ExtensionRangeOptionsAminoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ExtensionRangeOptionsProtoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.decode(message.value); + }, + toProto(message: ExtensionRangeOptions): Uint8Array { + return ExtensionRangeOptions.encode(message).finish(); + }, + toProtoMsg(message: ExtensionRangeOptions): ExtensionRangeOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + value: ExtensionRangeOptions.encode(message).finish() + }; } - }; - function createBaseFieldDescriptorProto(): FieldDescriptorProto { return { name: "", @@ -2613,111 +2916,86 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { options: undefined }; } - export const FieldDescriptorProto = { - encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.FieldDescriptorProto", + encode(message: FieldDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { writer.uint32(24).int32(message.number); } - if (message.label !== 1) { writer.uint32(32).int32(message.label); } - if (message.type !== 1) { writer.uint32(40).int32(message.type); } - if (message.typeName !== "") { writer.uint32(50).string(message.typeName); } - if (message.extendee !== "") { writer.uint32(18).string(message.extendee); } - if (message.defaultValue !== "") { writer.uint32(58).string(message.defaultValue); } - if (message.oneofIndex !== 0) { writer.uint32(72).int32(message.oneofIndex); } - if (message.jsonName !== "") { writer.uint32(82).string(message.jsonName); } - if (message.options !== undefined) { FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 3: message.number = reader.int32(); break; - case 4: message.label = (reader.int32() as any); break; - case 5: message.type = (reader.int32() as any); break; - case 6: message.typeName = reader.string(); break; - case 2: message.extendee = reader.string(); break; - case 7: message.defaultValue = reader.string(); break; - case 9: message.oneofIndex = reader.int32(); break; - case 10: message.jsonName = reader.string(); break; - case 8: message.options = FieldOptions.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): FieldDescriptorProto { + fromPartial(object: Partial): FieldDescriptorProto { const message = createBaseFieldDescriptorProto(); message.name = object.name ?? ""; message.number = object.number ?? 0; @@ -2730,65 +3008,146 @@ export const FieldDescriptorProto = { message.jsonName = object.jsonName ?? ""; message.options = object.options !== undefined && object.options !== null ? FieldOptions.fromPartial(object.options) : undefined; return message; + }, + fromAmino(object: FieldDescriptorProtoAmino): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.label !== undefined && object.label !== null) { + message.label = fieldDescriptorProto_LabelFromJSON(object.label); + } + if (object.type !== undefined && object.type !== null) { + message.type = fieldDescriptorProto_TypeFromJSON(object.type); + } + if (object.type_name !== undefined && object.type_name !== null) { + message.typeName = object.type_name; + } + if (object.extendee !== undefined && object.extendee !== null) { + message.extendee = object.extendee; + } + if (object.default_value !== undefined && object.default_value !== null) { + message.defaultValue = object.default_value; + } + if (object.oneof_index !== undefined && object.oneof_index !== null) { + message.oneofIndex = object.oneof_index; + } + if (object.json_name !== undefined && object.json_name !== null) { + message.jsonName = object.json_name; + } + if (object.options !== undefined && object.options !== null) { + message.options = FieldOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.number = message.number; + obj.label = fieldDescriptorProto_LabelToJSON(message.label); + obj.type = fieldDescriptorProto_TypeToJSON(message.type); + obj.type_name = message.typeName; + obj.extendee = message.extendee; + obj.default_value = message.defaultValue; + obj.oneof_index = message.oneofIndex; + obj.json_name = message.jsonName; + obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: FieldDescriptorProtoAminoMsg): FieldDescriptorProto { + return FieldDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FieldDescriptorProtoProtoMsg): FieldDescriptorProto { + return FieldDescriptorProto.decode(message.value); + }, + toProto(message: FieldDescriptorProto): Uint8Array { + return FieldDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FieldDescriptorProto): FieldDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FieldDescriptorProto", + value: FieldDescriptorProto.encode(message).finish() + }; } - }; - function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", options: undefined }; } - export const OneofDescriptorProto = { - encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.OneofDescriptorProto", + encode(message: OneofDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.options !== undefined) { OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.options = OneofOptions.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): OneofDescriptorProto { + fromPartial(object: Partial): OneofDescriptorProto { const message = createBaseOneofDescriptorProto(); message.name = object.name ?? ""; message.options = object.options !== undefined && object.options !== null ? OneofOptions.fromPartial(object.options) : undefined; return message; + }, + fromAmino(object: OneofDescriptorProtoAmino): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.options !== undefined && object.options !== null) { + message.options = OneofOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: OneofDescriptorProtoAminoMsg): OneofDescriptorProto { + return OneofDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: OneofDescriptorProtoProtoMsg): OneofDescriptorProto { + return OneofDescriptorProto.decode(message.value); + }, + toProto(message: OneofDescriptorProto): Uint8Array { + return OneofDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: OneofDescriptorProto): OneofDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.OneofDescriptorProto", + value: OneofDescriptorProto.encode(message).finish() + }; } - }; - function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", @@ -2798,71 +3157,56 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { reservedName: [] }; } - export const EnumDescriptorProto = { - encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.EnumDescriptorProto", + encode(message: EnumDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - for (const v of message.value) { EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.options !== undefined) { EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); } - for (const v of message.reservedRange) { EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); } - for (const v of message.reservedName) { writer.uint32(42).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); break; - case 3: message.options = EnumOptions.decode(reader, reader.uint32()); break; - case 4: message.reservedRange.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); break; - case 5: message.reservedName.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EnumDescriptorProto { + fromPartial(object: Partial): EnumDescriptorProto { const message = createBaseEnumDescriptorProto(); message.name = object.name ?? ""; message.value = object.value?.map(e => EnumValueDescriptorProto.fromPartial(e)) || []; @@ -2870,65 +3214,132 @@ export const EnumDescriptorProto = { message.reservedRange = object.reservedRange?.map(e => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || []; message.reservedName = object.reservedName?.map(e => e) || []; return message; + }, + fromAmino(object: EnumDescriptorProtoAmino): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.value = object.value?.map(e => EnumValueDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = EnumOptions.fromAmino(object.options); + } + message.reservedRange = object.reserved_range?.map(e => EnumDescriptorProto_EnumReservedRange.fromAmino(e)) || []; + message.reservedName = object.reserved_name?.map(e => e) || []; + return message; + }, + toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + if (message.value) { + obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); + } else { + obj.value = []; + } + obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); + } else { + obj.reserved_range = []; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + fromAminoMsg(object: EnumDescriptorProtoAminoMsg): EnumDescriptorProto { + return EnumDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProtoProtoMsg): EnumDescriptorProto { + return EnumDescriptorProto.decode(message.value); + }, + toProto(message: EnumDescriptorProto): Uint8Array { + return EnumDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto): EnumDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumDescriptorProto", + value: EnumDescriptorProto.encode(message).finish() + }; } - }; - function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { return { start: 0, end: 0 }; } - export const EnumDescriptorProto_EnumReservedRange = { - encode(message: EnumDescriptorProto_EnumReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.EnumReservedRange", + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { writer.uint32(16).int32(message.end); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.start = reader.int32(); break; - case 2: message.end = reader.int32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EnumDescriptorProto_EnumReservedRange { + fromPartial(object: Partial): EnumDescriptorProto_EnumReservedRange { const message = createBaseEnumDescriptorProto_EnumReservedRange(); message.start = object.start ?? 0; message.end = object.end ?? 0; return message; + }, + fromAmino(object: EnumDescriptorProto_EnumReservedRangeAmino): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + return obj; + }, + fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProto_EnumReservedRangeProtoMsg): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.decode(message.value); + }, + toProto(message: EnumDescriptorProto_EnumReservedRange): Uint8Array { + return EnumDescriptorProto_EnumReservedRange.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.EnumReservedRange", + value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() + }; } - }; - function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { return { name: "", @@ -2936,64 +3347,86 @@ function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { options: undefined }; } - export const EnumValueDescriptorProto = { - encode(message: EnumValueDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== 0) { writer.uint32(16).int32(message.number); } - if (message.options !== undefined) { EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.number = reader.int32(); break; - case 3: message.options = EnumValueOptions.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EnumValueDescriptorProto { + fromPartial(object: Partial): EnumValueDescriptorProto { const message = createBaseEnumValueDescriptorProto(); message.name = object.name ?? ""; message.number = object.number ?? 0; message.options = object.options !== undefined && object.options !== null ? EnumValueOptions.fromPartial(object.options) : undefined; return message; + }, + fromAmino(object: EnumValueDescriptorProtoAmino): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.options !== undefined && object.options !== null) { + message.options = EnumValueOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.number = message.number; + obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: EnumValueDescriptorProtoAminoMsg): EnumValueDescriptorProto { + return EnumValueDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueDescriptorProtoProtoMsg): EnumValueDescriptorProto { + return EnumValueDescriptorProto.decode(message.value); + }, + toProto(message: EnumValueDescriptorProto): Uint8Array { + return EnumValueDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumValueDescriptorProto): EnumValueDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + value: EnumValueDescriptorProto.encode(message).finish() + }; } - }; - function createBaseServiceDescriptorProto(): ServiceDescriptorProto { return { name: "", @@ -3001,64 +3434,88 @@ function createBaseServiceDescriptorProto(): ServiceDescriptorProto { options: undefined }; } - export const ServiceDescriptorProto = { - encode(message: ServiceDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + encode(message: ServiceDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - for (const v of message.method) { MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.options !== undefined) { ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); break; - case 3: message.options = ServiceOptions.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ServiceDescriptorProto { + fromPartial(object: Partial): ServiceDescriptorProto { const message = createBaseServiceDescriptorProto(); message.name = object.name ?? ""; message.method = object.method?.map(e => MethodDescriptorProto.fromPartial(e)) || []; message.options = object.options !== undefined && object.options !== null ? ServiceOptions.fromPartial(object.options) : undefined; return message; + }, + fromAmino(object: ServiceDescriptorProtoAmino): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.method = object.method?.map(e => MethodDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = ServiceOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + if (message.method) { + obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); + } else { + obj.method = []; + } + obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: ServiceDescriptorProtoAminoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceDescriptorProtoProtoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.decode(message.value); + }, + toProto(message: ServiceDescriptorProto): Uint8Array { + return ServiceDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: ServiceDescriptorProto): ServiceDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + value: ServiceDescriptorProto.encode(message).finish() + }; } - }; - function createBaseMethodDescriptorProto(): MethodDescriptorProto { return { name: "", @@ -3069,79 +3526,62 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { serverStreaming: false }; } - export const MethodDescriptorProto = { - encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.MethodDescriptorProto", + encode(message: MethodDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { writer.uint32(26).string(message.outputType); } - if (message.options !== undefined) { MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); } - if (message.clientStreaming === true) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { writer.uint32(48).bool(message.serverStreaming); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: message.inputType = reader.string(); break; - case 3: message.outputType = reader.string(); break; - case 4: message.options = MethodOptions.decode(reader, reader.uint32()); break; - case 5: message.clientStreaming = reader.bool(); break; - case 6: message.serverStreaming = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MethodDescriptorProto { + fromPartial(object: Partial): MethodDescriptorProto { const message = createBaseMethodDescriptorProto(); message.name = object.name ?? ""; message.inputType = object.inputType ?? ""; @@ -3150,10 +3590,55 @@ export const MethodDescriptorProto = { message.clientStreaming = object.clientStreaming ?? false; message.serverStreaming = object.serverStreaming ?? false; return message; + }, + fromAmino(object: MethodDescriptorProtoAmino): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.input_type !== undefined && object.input_type !== null) { + message.inputType = object.input_type; + } + if (object.output_type !== undefined && object.output_type !== null) { + message.outputType = object.output_type; + } + if (object.options !== undefined && object.options !== null) { + message.options = MethodOptions.fromAmino(object.options); + } + if (object.client_streaming !== undefined && object.client_streaming !== null) { + message.clientStreaming = object.client_streaming; + } + if (object.server_streaming !== undefined && object.server_streaming !== null) { + message.serverStreaming = object.server_streaming; + } + return message; + }, + toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.input_type = message.inputType; + obj.output_type = message.outputType; + obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; + obj.client_streaming = message.clientStreaming; + obj.server_streaming = message.serverStreaming; + return obj; + }, + fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { + return MethodDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: MethodDescriptorProtoProtoMsg): MethodDescriptorProto { + return MethodDescriptorProto.decode(message.value); + }, + toProto(message: MethodDescriptorProto): Uint8Array { + return MethodDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: MethodDescriptorProto): MethodDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.MethodDescriptorProto", + value: MethodDescriptorProto.encode(message).finish() + }; } - }; - function createBaseFileOptions(): FileOptions { return { javaPackage: "", @@ -3179,199 +3664,152 @@ function createBaseFileOptions(): FileOptions { uninterpretedOption: [] }; } - export const FileOptions = { - encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.FileOptions", + encode(message: FileOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { writer.uint32(216).bool(message.javaStringCheckUtf8); } - if (message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated === true) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } - for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFileOptions(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.javaPackage = reader.string(); break; - case 8: message.javaOuterClassname = reader.string(); break; - case 10: message.javaMultipleFiles = reader.bool(); break; - case 20: message.javaGenerateEqualsAndHash = reader.bool(); break; - case 27: message.javaStringCheckUtf8 = reader.bool(); break; - case 9: message.optimizeFor = (reader.int32() as any); break; - case 11: message.goPackage = reader.string(); break; - case 16: message.ccGenericServices = reader.bool(); break; - case 17: message.javaGenericServices = reader.bool(); break; - case 18: message.pyGenericServices = reader.bool(); break; - case 42: message.phpGenericServices = reader.bool(); break; - case 23: message.deprecated = reader.bool(); break; - case 31: message.ccEnableArenas = reader.bool(); break; - case 36: message.objcClassPrefix = reader.string(); break; - case 37: message.csharpNamespace = reader.string(); break; - case 39: message.swiftPrefix = reader.string(); break; - case 40: message.phpClassPrefix = reader.string(); break; - case 41: message.phpNamespace = reader.string(); break; - case 44: message.phpMetadataNamespace = reader.string(); break; - case 45: message.rubyPackage = reader.string(); break; - case 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): FileOptions { + fromPartial(object: Partial): FileOptions { const message = createBaseFileOptions(); message.javaPackage = object.javaPackage ?? ""; message.javaOuterClassname = object.javaOuterClassname ?? ""; @@ -3395,10 +3833,117 @@ export const FileOptions = { message.rubyPackage = object.rubyPackage ?? ""; message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: FileOptionsAmino): FileOptions { + const message = createBaseFileOptions(); + if (object.java_package !== undefined && object.java_package !== null) { + message.javaPackage = object.java_package; + } + if (object.java_outer_classname !== undefined && object.java_outer_classname !== null) { + message.javaOuterClassname = object.java_outer_classname; + } + if (object.java_multiple_files !== undefined && object.java_multiple_files !== null) { + message.javaMultipleFiles = object.java_multiple_files; + } + if (object.java_generate_equals_and_hash !== undefined && object.java_generate_equals_and_hash !== null) { + message.javaGenerateEqualsAndHash = object.java_generate_equals_and_hash; + } + if (object.java_string_check_utf8 !== undefined && object.java_string_check_utf8 !== null) { + message.javaStringCheckUtf8 = object.java_string_check_utf8; + } + if (object.optimize_for !== undefined && object.optimize_for !== null) { + message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + } + if (object.go_package !== undefined && object.go_package !== null) { + message.goPackage = object.go_package; + } + if (object.cc_generic_services !== undefined && object.cc_generic_services !== null) { + message.ccGenericServices = object.cc_generic_services; + } + if (object.java_generic_services !== undefined && object.java_generic_services !== null) { + message.javaGenericServices = object.java_generic_services; + } + if (object.py_generic_services !== undefined && object.py_generic_services !== null) { + message.pyGenericServices = object.py_generic_services; + } + if (object.php_generic_services !== undefined && object.php_generic_services !== null) { + message.phpGenericServices = object.php_generic_services; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.cc_enable_arenas !== undefined && object.cc_enable_arenas !== null) { + message.ccEnableArenas = object.cc_enable_arenas; + } + if (object.objc_class_prefix !== undefined && object.objc_class_prefix !== null) { + message.objcClassPrefix = object.objc_class_prefix; + } + if (object.csharp_namespace !== undefined && object.csharp_namespace !== null) { + message.csharpNamespace = object.csharp_namespace; + } + if (object.swift_prefix !== undefined && object.swift_prefix !== null) { + message.swiftPrefix = object.swift_prefix; + } + if (object.php_class_prefix !== undefined && object.php_class_prefix !== null) { + message.phpClassPrefix = object.php_class_prefix; + } + if (object.php_namespace !== undefined && object.php_namespace !== null) { + message.phpNamespace = object.php_namespace; + } + if (object.php_metadata_namespace !== undefined && object.php_metadata_namespace !== null) { + message.phpMetadataNamespace = object.php_metadata_namespace; + } + if (object.ruby_package !== undefined && object.ruby_package !== null) { + message.rubyPackage = object.ruby_package; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileOptions): FileOptionsAmino { + const obj: any = {}; + obj.java_package = message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8; + obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); + obj.go_package = message.goPackage; + obj.cc_generic_services = message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices; + obj.deprecated = message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix; + obj.php_namespace = message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: FileOptionsAminoMsg): FileOptions { + return FileOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FileOptionsProtoMsg): FileOptions { + return FileOptions.decode(message.value); + }, + toProto(message: FileOptions): Uint8Array { + return FileOptions.encode(message).finish(); + }, + toProtoMsg(message: FileOptions): FileOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FileOptions", + value: FileOptions.encode(message).finish() + }; } - }; - function createBaseMessageOptions(): MessageOptions { return { messageSetWireFormat: false, @@ -3408,71 +3953,56 @@ function createBaseMessageOptions(): MessageOptions { uninterpretedOption: [] }; } - export const MessageOptions = { - encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.MessageOptions", + encode(message: MessageOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.messageSetWireFormat === true) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { writer.uint32(56).bool(message.mapEntry); } - for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMessageOptions(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.messageSetWireFormat = reader.bool(); break; - case 2: message.noStandardDescriptorAccessor = reader.bool(); break; - case 3: message.deprecated = reader.bool(); break; - case 7: message.mapEntry = reader.bool(); break; - case 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MessageOptions { + fromPartial(object: Partial): MessageOptions { const message = createBaseMessageOptions(); message.messageSetWireFormat = object.messageSetWireFormat ?? false; message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; @@ -3480,10 +4010,53 @@ export const MessageOptions = { message.mapEntry = object.mapEntry ?? false; message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: MessageOptionsAmino): MessageOptions { + const message = createBaseMessageOptions(); + if (object.message_set_wire_format !== undefined && object.message_set_wire_format !== null) { + message.messageSetWireFormat = object.message_set_wire_format; + } + if (object.no_standard_descriptor_accessor !== undefined && object.no_standard_descriptor_accessor !== null) { + message.noStandardDescriptorAccessor = object.no_standard_descriptor_accessor; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.map_entry !== undefined && object.map_entry !== null) { + message.mapEntry = object.map_entry; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MessageOptions): MessageOptionsAmino { + const obj: any = {}; + obj.message_set_wire_format = message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated; + obj.map_entry = message.mapEntry; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: MessageOptionsAminoMsg): MessageOptions { + return MessageOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MessageOptionsProtoMsg): MessageOptions { + return MessageOptions.decode(message.value); + }, + toProto(message: MessageOptions): Uint8Array { + return MessageOptions.encode(message).finish(); + }, + toProtoMsg(message: MessageOptions): MessageOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MessageOptions", + value: MessageOptions.encode(message).finish() + }; } - }; - function createBaseFieldOptions(): FieldOptions { return { ctype: 1, @@ -3495,87 +4068,68 @@ function createBaseFieldOptions(): FieldOptions { uninterpretedOption: [] }; } - export const FieldOptions = { - encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.FieldOptions", + encode(message: FieldOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ctype !== 1) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { writer.uint32(16).bool(message.packed); } - if (message.jstype !== 1) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { writer.uint32(80).bool(message.weak); } - for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFieldOptions(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.ctype = (reader.int32() as any); break; - case 2: message.packed = reader.bool(); break; - case 6: message.jstype = (reader.int32() as any); break; - case 5: message.lazy = reader.bool(); break; - case 3: message.deprecated = reader.bool(); break; - case 10: message.weak = reader.bool(); break; - case 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): FieldOptions { + fromPartial(object: Partial): FieldOptions { const message = createBaseFieldOptions(); message.ctype = object.ctype ?? 1; message.packed = object.packed ?? false; @@ -3585,55 +4139,126 @@ export const FieldOptions = { message.weak = object.weak ?? false; message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: FieldOptionsAmino): FieldOptions { + const message = createBaseFieldOptions(); + if (object.ctype !== undefined && object.ctype !== null) { + message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + } + if (object.packed !== undefined && object.packed !== null) { + message.packed = object.packed; + } + if (object.jstype !== undefined && object.jstype !== null) { + message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + } + if (object.lazy !== undefined && object.lazy !== null) { + message.lazy = object.lazy; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.weak !== undefined && object.weak !== null) { + message.weak = object.weak; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: FieldOptions): FieldOptionsAmino { + const obj: any = {}; + obj.ctype = fieldOptions_CTypeToJSON(message.ctype); + obj.packed = message.packed; + obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); + obj.lazy = message.lazy; + obj.deprecated = message.deprecated; + obj.weak = message.weak; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: FieldOptionsAminoMsg): FieldOptions { + return FieldOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FieldOptionsProtoMsg): FieldOptions { + return FieldOptions.decode(message.value); + }, + toProto(message: FieldOptions): Uint8Array { + return FieldOptions.encode(message).finish(); + }, + toProtoMsg(message: FieldOptions): FieldOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FieldOptions", + value: FieldOptions.encode(message).finish() + }; } - }; - function createBaseOneofOptions(): OneofOptions { return { uninterpretedOption: [] }; } - export const OneofOptions = { - encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.OneofOptions", + encode(message: OneofOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): OneofOptions { + fromPartial(object: Partial): OneofOptions { const message = createBaseOneofOptions(); message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: OneofOptionsAmino): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: OneofOptions): OneofOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: OneofOptionsAminoMsg): OneofOptions { + return OneofOptions.fromAmino(object.value); + }, + fromProtoMsg(message: OneofOptionsProtoMsg): OneofOptions { + return OneofOptions.decode(message.value); + }, + toProto(message: OneofOptions): Uint8Array { + return OneofOptions.encode(message).finish(); + }, + toProtoMsg(message: OneofOptions): OneofOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.OneofOptions", + value: OneofOptions.encode(message).finish() + }; } - }; - function createBaseEnumOptions(): EnumOptions { return { allowAlias: false, @@ -3641,174 +4266,242 @@ function createBaseEnumOptions(): EnumOptions { uninterpretedOption: [] }; } - export const EnumOptions = { - encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.EnumOptions", + encode(message: EnumOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowAlias === true) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated === true) { writer.uint32(24).bool(message.deprecated); } - for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumOptions(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 2: message.allowAlias = reader.bool(); break; - case 3: message.deprecated = reader.bool(); break; - case 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EnumOptions { + fromPartial(object: Partial): EnumOptions { const message = createBaseEnumOptions(); message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: EnumOptionsAmino): EnumOptions { + const message = createBaseEnumOptions(); + if (object.allow_alias !== undefined && object.allow_alias !== null) { + message.allowAlias = object.allow_alias; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: EnumOptions): EnumOptionsAmino { + const obj: any = {}; + obj.allow_alias = message.allowAlias; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: EnumOptionsAminoMsg): EnumOptions { + return EnumOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumOptionsProtoMsg): EnumOptions { + return EnumOptions.decode(message.value); + }, + toProto(message: EnumOptions): Uint8Array { + return EnumOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumOptions): EnumOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumOptions", + value: EnumOptions.encode(message).finish() + }; } - }; - function createBaseEnumValueOptions(): EnumValueOptions { return { deprecated: false, uninterpretedOption: [] }; } - export const EnumValueOptions = { - encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.EnumValueOptions", + encode(message: EnumValueOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(8).bool(message.deprecated); } - for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEnumValueOptions(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.deprecated = reader.bool(); break; - case 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EnumValueOptions { + fromPartial(object: Partial): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: EnumValueOptionsAmino): EnumValueOptions { + const message = createBaseEnumValueOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: EnumValueOptions): EnumValueOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: EnumValueOptionsAminoMsg): EnumValueOptions { + return EnumValueOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueOptionsProtoMsg): EnumValueOptions { + return EnumValueOptions.decode(message.value); + }, + toProto(message: EnumValueOptions): Uint8Array { + return EnumValueOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumValueOptions): EnumValueOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueOptions", + value: EnumValueOptions.encode(message).finish() + }; } - }; - function createBaseServiceOptions(): ServiceOptions { return { deprecated: false, uninterpretedOption: [] }; } - export const ServiceOptions = { - encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.ServiceOptions", + encode(message: ServiceOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); } - for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 33: message.deprecated = reader.bool(); break; - case 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ServiceOptions { + fromPartial(object: Partial): ServiceOptions { const message = createBaseServiceOptions(); message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: ServiceOptionsAmino): ServiceOptions { + const message = createBaseServiceOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: ServiceOptions): ServiceOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: ServiceOptionsAminoMsg): ServiceOptions { + return ServiceOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceOptionsProtoMsg): ServiceOptions { + return ServiceOptions.decode(message.value); + }, + toProto(message: ServiceOptions): Uint8Array { + return ServiceOptions.encode(message).finish(); + }, + toProtoMsg(message: ServiceOptions): ServiceOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceOptions", + value: ServiceOptions.encode(message).finish() + }; } - }; - function createBaseMethodOptions(): MethodOptions { return { deprecated: false, @@ -3816,269 +4509,365 @@ function createBaseMethodOptions(): MethodOptions { uninterpretedOption: [] }; } - export const MethodOptions = { - encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.MethodOptions", + encode(message: MethodOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); } - if (message.idempotencyLevel !== 1) { writer.uint32(272).int32(message.idempotencyLevel); } - for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMethodOptions(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 33: message.deprecated = reader.bool(); break; - case 34: message.idempotencyLevel = (reader.int32() as any); break; - case 999: message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MethodOptions { + fromPartial(object: Partial): MethodOptions { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 1; message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; return message; + }, + fromAmino(object: MethodOptionsAmino): MethodOptions { + const message = createBaseMethodOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.idempotency_level !== undefined && object.idempotency_level !== null) { + message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MethodOptions): MethodOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated; + obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: MethodOptionsAminoMsg): MethodOptions { + return MethodOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MethodOptionsProtoMsg): MethodOptions { + return MethodOptions.decode(message.value); + }, + toProto(message: MethodOptions): Uint8Array { + return MethodOptions.encode(message).finish(); + }, + toProtoMsg(message: MethodOptions): MethodOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MethodOptions", + value: MethodOptions.encode(message).finish() + }; } - }; - function createBaseUninterpretedOption(): UninterpretedOption { return { name: [], identifierValue: "", - positiveIntValue: Long.UZERO, - negativeIntValue: Long.ZERO, + positiveIntValue: BigInt(0), + negativeIntValue: BigInt(0), doubleValue: 0, stringValue: new Uint8Array(), aggregateValue: "" }; } - export const UninterpretedOption = { - encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.UninterpretedOption", + encode(message: UninterpretedOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.name) { UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - - if (!message.positiveIntValue.isZero()) { + if (message.positiveIntValue !== BigInt(0)) { writer.uint32(32).uint64(message.positiveIntValue); } - - if (!message.negativeIntValue.isZero()) { + if (message.negativeIntValue !== BigInt(0)) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } - if (message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 2: message.name.push(UninterpretedOption_NamePart.decode(reader, reader.uint32())); break; - case 3: message.identifierValue = reader.string(); break; - case 4: - message.positiveIntValue = (reader.uint64() as Long); + message.positiveIntValue = reader.uint64(); break; - case 5: - message.negativeIntValue = (reader.int64() as Long); + message.negativeIntValue = reader.int64(); break; - case 6: message.doubleValue = reader.double(); break; - case 7: message.stringValue = reader.bytes(); break; - case 8: message.aggregateValue = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): UninterpretedOption { + fromPartial(object: Partial): UninterpretedOption { const message = createBaseUninterpretedOption(); message.name = object.name?.map(e => UninterpretedOption_NamePart.fromPartial(e)) || []; message.identifierValue = object.identifierValue ?? ""; - message.positiveIntValue = object.positiveIntValue !== undefined && object.positiveIntValue !== null ? Long.fromValue(object.positiveIntValue) : Long.UZERO; - message.negativeIntValue = object.negativeIntValue !== undefined && object.negativeIntValue !== null ? Long.fromValue(object.negativeIntValue) : Long.ZERO; + message.positiveIntValue = object.positiveIntValue !== undefined && object.positiveIntValue !== null ? BigInt(object.positiveIntValue.toString()) : BigInt(0); + message.negativeIntValue = object.negativeIntValue !== undefined && object.negativeIntValue !== null ? BigInt(object.negativeIntValue.toString()) : BigInt(0); message.doubleValue = object.doubleValue ?? 0; message.stringValue = object.stringValue ?? new Uint8Array(); message.aggregateValue = object.aggregateValue ?? ""; return message; + }, + fromAmino(object: UninterpretedOptionAmino): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map(e => UninterpretedOption_NamePart.fromAmino(e)) || []; + if (object.identifier_value !== undefined && object.identifier_value !== null) { + message.identifierValue = object.identifier_value; + } + if (object.positive_int_value !== undefined && object.positive_int_value !== null) { + message.positiveIntValue = BigInt(object.positive_int_value); + } + if (object.negative_int_value !== undefined && object.negative_int_value !== null) { + message.negativeIntValue = BigInt(object.negative_int_value); + } + if (object.double_value !== undefined && object.double_value !== null) { + message.doubleValue = object.double_value; + } + if (object.string_value !== undefined && object.string_value !== null) { + message.stringValue = bytesFromBase64(object.string_value); + } + if (object.aggregate_value !== undefined && object.aggregate_value !== null) { + message.aggregateValue = object.aggregate_value; + } + return message; + }, + toAmino(message: UninterpretedOption): UninterpretedOptionAmino { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); + } else { + obj.name = []; + } + obj.identifier_value = message.identifierValue; + obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.double_value = message.doubleValue; + obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; + obj.aggregate_value = message.aggregateValue; + return obj; + }, + fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { + return UninterpretedOption.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOptionProtoMsg): UninterpretedOption { + return UninterpretedOption.decode(message.value); + }, + toProto(message: UninterpretedOption): Uint8Array { + return UninterpretedOption.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption): UninterpretedOptionProtoMsg { + return { + typeUrl: "/google.protobuf.UninterpretedOption", + value: UninterpretedOption.encode(message).finish() + }; } - }; - 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 { + typeUrl: "/google.protobuf.NamePart", + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { writer.uint32(16).bool(message.isExtension); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.namePart = reader.string(); break; - case 2: message.isExtension = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): UninterpretedOption_NamePart { + fromPartial(object: Partial): UninterpretedOption_NamePart { const message = createBaseUninterpretedOption_NamePart(); message.namePart = object.namePart ?? ""; message.isExtension = object.isExtension ?? false; return message; + }, + fromAmino(object: UninterpretedOption_NamePartAmino): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + if (object.name_part !== undefined && object.name_part !== null) { + message.namePart = object.name_part; + } + if (object.is_extension !== undefined && object.is_extension !== null) { + message.isExtension = object.is_extension; + } + return message; + }, + toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { + const obj: any = {}; + obj.name_part = message.namePart; + obj.is_extension = message.isExtension; + return obj; + }, + fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOption_NamePartProtoMsg): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.decode(message.value); + }, + toProto(message: UninterpretedOption_NamePart): Uint8Array { + return UninterpretedOption_NamePart.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartProtoMsg { + return { + typeUrl: "/google.protobuf.NamePart", + value: UninterpretedOption_NamePart.encode(message).finish() + }; } - }; - function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } - export const SourceCodeInfo = { - encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.SourceCodeInfo", + encode(message: SourceCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.location) { SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.location.push(SourceCodeInfo_Location.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SourceCodeInfo { + fromPartial(object: Partial): SourceCodeInfo { const message = createBaseSourceCodeInfo(); message.location = object.location?.map(e => SourceCodeInfo_Location.fromPartial(e)) || []; return message; + }, + fromAmino(object: SourceCodeInfoAmino): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map(e => SourceCodeInfo_Location.fromAmino(e)) || []; + return message; + }, + toAmino(message: SourceCodeInfo): SourceCodeInfoAmino { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); + } else { + obj.location = []; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfoAminoMsg): SourceCodeInfo { + return SourceCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfoProtoMsg): SourceCodeInfo { + return SourceCodeInfo.decode(message.value); + }, + toProto(message: SourceCodeInfo): Uint8Array { + return SourceCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo): SourceCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.SourceCodeInfo", + value: SourceCodeInfo.encode(message).finish() + }; } - }; - function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], @@ -4088,96 +4877,74 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { leadingDetachedComments: [] }; } - export const SourceCodeInfo_Location = { - encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.Location", + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); - for (const v of message.path) { writer.int32(v); } - writer.ldelim(); writer.uint32(18).fork(); - for (const v of message.span) { writer.int32(v); } - writer.ldelim(); - if (message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } - for (const v of message.leadingDetachedComments) { writer.uint32(50).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.path.push(reader.int32()); } } else { message.path.push(reader.int32()); } - break; - case 2: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.span.push(reader.int32()); } } else { message.span.push(reader.int32()); } - break; - case 3: message.leadingComments = reader.string(); break; - case 4: message.trailingComments = reader.string(); break; - case 6: message.leadingDetachedComments.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SourceCodeInfo_Location { + fromPartial(object: Partial): SourceCodeInfo_Location { const message = createBaseSourceCodeInfo_Location(); message.path = object.path?.map(e => e) || []; message.span = object.span?.map(e => e) || []; @@ -4185,55 +4952,122 @@ export const SourceCodeInfo_Location = { message.trailingComments = object.trailingComments ?? ""; message.leadingDetachedComments = object.leadingDetachedComments?.map(e => e) || []; return message; + }, + fromAmino(object: SourceCodeInfo_LocationAmino): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map(e => e) || []; + message.span = object.span?.map(e => e) || []; + if (object.leading_comments !== undefined && object.leading_comments !== null) { + message.leadingComments = object.leading_comments; + } + if (object.trailing_comments !== undefined && object.trailing_comments !== null) { + message.trailingComments = object.trailing_comments; + } + message.leadingDetachedComments = object.leading_detached_comments?.map(e => e) || []; + return message; + }, + toAmino(message: SourceCodeInfo_Location): SourceCodeInfo_LocationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map(e => e); + } else { + obj.span = []; + } + obj.leading_comments = message.leadingComments; + obj.trailing_comments = message.trailingComments; + if (message.leadingDetachedComments) { + obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); + } else { + obj.leading_detached_comments = []; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfo_LocationAminoMsg): SourceCodeInfo_Location { + return SourceCodeInfo_Location.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfo_LocationProtoMsg): SourceCodeInfo_Location { + return SourceCodeInfo_Location.decode(message.value); + }, + toProto(message: SourceCodeInfo_Location): Uint8Array { + return SourceCodeInfo_Location.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo_Location): SourceCodeInfo_LocationProtoMsg { + return { + typeUrl: "/google.protobuf.Location", + value: SourceCodeInfo_Location.encode(message).finish() + }; } - }; - function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] }; } - export const GeneratedCodeInfo = { - encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + encode(message: GeneratedCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.annotation) { GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.annotation.push(GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GeneratedCodeInfo { + fromPartial(object: Partial): GeneratedCodeInfo { const message = createBaseGeneratedCodeInfo(); message.annotation = object.annotation?.map(e => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; return message; + }, + fromAmino(object: GeneratedCodeInfoAmino): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map(e => GeneratedCodeInfo_Annotation.fromAmino(e)) || []; + return message; + }, + toAmino(message: GeneratedCodeInfo): GeneratedCodeInfoAmino { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); + } else { + obj.annotation = []; + } + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfoAminoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfoProtoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.decode(message.value); + }, + toProto(message: GeneratedCodeInfo): Uint8Array { + return GeneratedCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo): GeneratedCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + value: GeneratedCodeInfo.encode(message).finish() + }; } - }; - function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { return { path: [], @@ -4242,82 +5076,105 @@ function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation end: 0 }; } - export const GeneratedCodeInfo_Annotation = { - encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.Annotation", + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); - for (const v of message.path) { writer.int32(v); } - writer.ldelim(); - if (message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { writer.uint32(32).int32(message.end); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.path.push(reader.int32()); } } else { message.path.push(reader.int32()); } - break; - case 2: message.sourceFile = reader.string(); break; - case 3: message.begin = reader.int32(); break; - case 4: message.end = reader.int32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { + fromPartial(object: Partial): GeneratedCodeInfo_Annotation { const message = createBaseGeneratedCodeInfo_Annotation(); message.path = object.path?.map(e => e) || []; message.sourceFile = object.sourceFile ?? ""; message.begin = object.begin ?? 0; message.end = object.end ?? 0; return message; + }, + fromAmino(object: GeneratedCodeInfo_AnnotationAmino): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map(e => e) || []; + if (object.source_file !== undefined && object.source_file !== null) { + message.sourceFile = object.source_file; + } + if (object.begin !== undefined && object.begin !== null) { + message.begin = object.begin; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = []; + } + obj.source_file = message.sourceFile; + obj.begin = message.begin; + obj.end = message.end; + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfo_AnnotationProtoMsg): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.decode(message.value); + }, + toProto(message: GeneratedCodeInfo_Annotation): Uint8Array { + return GeneratedCodeInfo_Annotation.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationProtoMsg { + return { + typeUrl: "/google.protobuf.Annotation", + value: GeneratedCodeInfo_Annotation.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/google/protobuf/duration.ts b/src/codegen/google/protobuf/duration.ts index 69a3477..29ed9b4 100644 --- a/src/codegen/google/protobuf/duration.ts +++ b/src/codegen/google/protobuf/duration.ts @@ -1,5 +1,4 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; /** * A Duration represents a signed, fixed-length span of time represented * as a count of seconds and fractions of seconds at nanosecond @@ -60,14 +59,13 @@ import { Long, DeepPartial } from "../../helpers"; * 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: Long; + seconds: bigint; /** * Signed fractions of a second at nanosecond resolution of the span * of time. Durations less than one second are represented with a 0 @@ -76,9 +74,77 @@ export interface Duration { * of the same sign as the `seconds` field. Must be from -999,999,999 * to +999,999,999 inclusive. */ - nanos: number; } +export interface DurationProtoMsg { + typeUrl: "/google.protobuf.Duration"; + value: Uint8Array; +} +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (durations.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export type DurationAmino = string; +export interface DurationAminoMsg { + type: "/google.protobuf.Duration"; + value: DurationAmino; +} /** * A Duration represents a signed, fixed-length span of time represented * as a count of seconds and fractions of seconds at nanosecond @@ -139,77 +205,76 @@ export interface Duration { * 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 DurationSDKType { - /** - * 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: Long; - /** - * 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. - */ - + seconds: bigint; nanos: number; } - function createBaseDuration(): Duration { return { - seconds: Long.ZERO, + seconds: BigInt(0), nanos: 0 }; } - export const Duration = { - encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.seconds.isZero()) { + typeUrl: "/google.protobuf.Duration", + encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); } - if (message.nanos !== 0) { writer.uint32(16).int32(message.nanos); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.seconds = (reader.int64() as Long); + message.seconds = reader.int64(); break; - case 2: message.nanos = reader.int32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Duration { + fromPartial(object: Partial): Duration { const message = createBaseDuration(); - message.seconds = object.seconds !== undefined && object.seconds !== null ? Long.fromValue(object.seconds) : Long.ZERO; + message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); message.nanos = object.nanos ?? 0; return message; + }, + fromAmino(object: DurationAmino): Duration { + const value = BigInt(object); + return { + seconds: value / BigInt("1000000000"), + nanos: Number(value % BigInt("1000000000")) + }; + }, + toAmino(message: Duration): DurationAmino { + return (message.seconds * BigInt("1000000000") + BigInt(message.nanos)).toString(); + }, + fromAminoMsg(object: DurationAminoMsg): Duration { + return Duration.fromAmino(object.value); + }, + fromProtoMsg(message: DurationProtoMsg): Duration { + return Duration.decode(message.value); + }, + toProto(message: Duration): Uint8Array { + return Duration.encode(message).finish(); + }, + toProtoMsg(message: Duration): DurationProtoMsg { + return { + typeUrl: "/google.protobuf.Duration", + value: Duration.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/google/protobuf/empty.ts b/src/codegen/google/protobuf/empty.ts index 16b43f9..3347358 100644 --- a/src/codegen/google/protobuf/empty.ts +++ b/src/codegen/google/protobuf/empty.ts @@ -1,5 +1,4 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; /** * A generic empty message that you can re-use to avoid defining duplicated * empty messages in your APIs. A typical example is to use it as the request @@ -11,8 +10,27 @@ import { DeepPartial } from "../../helpers"; * * The JSON representation for `Empty` is empty JSON object `{}`. */ - export interface Empty {} +export interface EmptyProtoMsg { + typeUrl: "/google.protobuf.Empty"; + value: Uint8Array; +} +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + */ +export interface EmptyAmino {} +export interface EmptyAminoMsg { + type: "/google.protobuf.Empty"; + value: EmptyAmino; +} /** * A generic empty message that you can re-use to avoid defining duplicated * empty messages in your APIs. A typical example is to use it as the request @@ -24,39 +42,54 @@ export interface Empty {} * * The JSON representation for `Empty` is empty JSON object `{}`. */ - export interface EmptySDKType {} - function createBaseEmpty(): Empty { return {}; } - export const Empty = { - encode(_: Empty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/google.protobuf.Empty", + encode(_: Empty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Empty { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Empty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEmpty(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): Empty { + fromPartial(_: Partial): Empty { + const message = createBaseEmpty(); + return message; + }, + fromAmino(_: EmptyAmino): Empty { const message = createBaseEmpty(); return message; + }, + toAmino(_: Empty): EmptyAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: EmptyAminoMsg): Empty { + return Empty.fromAmino(object.value); + }, + fromProtoMsg(message: EmptyProtoMsg): Empty { + return Empty.decode(message.value); + }, + toProto(message: Empty): Uint8Array { + return Empty.encode(message).finish(); + }, + toProtoMsg(message: Empty): EmptyProtoMsg { + return { + typeUrl: "/google.protobuf.Empty", + value: Empty.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/google/protobuf/timestamp.ts b/src/codegen/google/protobuf/timestamp.ts index b17b65d..43d45be 100644 --- a/src/codegen/google/protobuf/timestamp.ts +++ b/src/codegen/google/protobuf/timestamp.ts @@ -1,5 +1,5 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { fromJsonTimestamp, fromTimestamp } from "../../helpers"; /** * 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 @@ -84,23 +84,114 @@ import { Long, DeepPartial } from "../../helpers"; * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D * ) to obtain a formatter capable of generating timestamps in this format. */ - export interface Timestamp { /** * Represents seconds of UTC time since Unix epoch * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to * 9999-12-31T23:59:59Z inclusive. */ - seconds: Long; + seconds: bigint; /** * Non-negative fractions of a second at nanosecond resolution. Negative * second values with fractions must still have non-negative nanos values * that count forward in time. Must be from 0 to 999,999,999 * inclusive. */ - nanos: number; } +export interface TimestampProtoMsg { + typeUrl: "/google.protobuf.Timestamp"; + value: Uint8Array; +} +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export type TimestampAmino = string; +export interface TimestampAminoMsg { + type: "/google.protobuf.Timestamp"; + value: TimestampAmino; +} /** * 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 @@ -185,75 +276,72 @@ export interface Timestamp { * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D * ) to obtain a formatter capable of generating timestamps in this format. */ - export interface TimestampSDKType { - /** - * 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: Long; - /** - * 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. - */ - + seconds: bigint; nanos: number; } - function createBaseTimestamp(): Timestamp { return { - seconds: Long.ZERO, + seconds: BigInt(0), nanos: 0 }; } - export const Timestamp = { - encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.seconds.isZero()) { + typeUrl: "/google.protobuf.Timestamp", + encode(message: Timestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); } - if (message.nanos !== 0) { writer.uint32(16).int32(message.nanos); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.seconds = (reader.int64() as Long); + message.seconds = reader.int64(); break; - case 2: message.nanos = reader.int32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Timestamp { + fromPartial(object: Partial): Timestamp { const message = createBaseTimestamp(); - message.seconds = object.seconds !== undefined && object.seconds !== null ? Long.fromValue(object.seconds) : Long.ZERO; + message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); message.nanos = object.nanos ?? 0; return message; + }, + fromAmino(object: TimestampAmino): Timestamp { + return fromJsonTimestamp(object); + }, + toAmino(message: Timestamp): TimestampAmino { + return fromTimestamp(message).toISOString().replace(/\.\d+Z$/, "Z"); + }, + fromAminoMsg(object: TimestampAminoMsg): Timestamp { + return Timestamp.fromAmino(object.value); + }, + fromProtoMsg(message: TimestampProtoMsg): Timestamp { + return Timestamp.decode(message.value); + }, + toProto(message: Timestamp): Uint8Array { + return Timestamp.encode(message).finish(); + }, + toProtoMsg(message: Timestamp): TimestampProtoMsg { + return { + typeUrl: "/google.protobuf.Timestamp", + value: Timestamp.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/helpers.ts b/src/codegen/helpers.ts index cea1e8f..feaf1af 100644 --- a/src/codegen/helpers.ts +++ b/src/codegen/helpers.ts @@ -1,240 +1,250 @@ /** - * This file and any referenced files were automatically generated by @osmonauts/telescope@0.75.0 - * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain - * and run the transpile command or yarn proto command to regenerate this bundle. - */ - -import * as _m0 from "protobufjs/minimal"; -import Long from 'long'; +* This file and any referenced files were automatically generated by @cosmology/telescope@1.3.2 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ -// @ts-ignore -if (_m0.util.Long !== Long) { - _m0.util.Long = (Long as any); - - _m0.configure(); -} - -export { Long }; declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; var globalThis: any = (() => { - if (typeof globalThis !== 'undefined') return globalThis; - if (typeof self !== 'undefined') return self; - if (typeof window !== 'undefined') return window; - if (typeof global !== 'undefined') return global; - throw 'Unable to locate global object'; + if (typeof globalThis !== 'undefined') return globalThis; + if (typeof self !== 'undefined') return self; + if (typeof window !== 'undefined') return window; + if (typeof global !== 'undefined') return global; + throw 'Unable to locate global object'; })(); const atob: (b64: string) => string = - globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); + globalThis.atob || + ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); export function bytesFromBase64(b64: string): Uint8Array { - const bin = atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; + const bin = atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; } const btoa: (bin: string) => string = - globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); + globalThis.btoa || + ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); export function base64FromBytes(arr: Uint8Array): string { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return btoa(bin.join('')); + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return btoa(bin.join('')); } export interface AminoHeight { - readonly revision_number?: string; - readonly revision_height?: string; -}; + readonly revision_number?: string; + readonly revision_height?: string; +} -export function omitDefault(input: T): T | undefined { - if (typeof input === "string") { - return input === "" ? undefined : input; - } +export function omitDefault( + input: T +): T | undefined { + if (typeof input === 'string') { + return input === '' ? undefined : input; + } - if (typeof input === "number") { - return input === 0 ? undefined : input; - } + if (typeof input === 'number') { + return input === 0 ? undefined : input; + } - if (Long.isLong(input)) { - return input.isZero() ? undefined : input; - } + if (typeof input === 'bigint') { + return input === BigInt(0) ? undefined : input; + } - throw new Error(`Got unsupported type ${typeof input}`); -}; + throw new Error(`Got unsupported type ${typeof input}`); +} interface Duration { - /** - * Signed seconds of the span of time. Must be from -315,576,000,000 - * to +315,576,000,000 inclusive. Note: these bounds are computed from: - * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - */ - seconds: Long; - /** - * 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; + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: bigint; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + + nanos: number; } export function toDuration(duration: string): Duration { - return { - seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)), - nanos: parseInt(duration) % 1000000000 - }; -}; + return { + seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)), + nanos: parseInt(duration) % 1000000000 + }; +} export function fromDuration(duration: Duration): string { - return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString(); -}; + return ( + parseInt(duration.seconds.toString()) * 1000000000 + + duration.nanos + ).toString(); +} export function isSet(value: any): boolean { - return value !== null && value !== undefined; -}; + return value !== null && value !== undefined; +} export function isObject(value: any): boolean { - return typeof value === 'object' && value !== null; -}; + return typeof value === 'object' && value !== null; +} export interface PageRequest { - key: Uint8Array; - offset: Long; - limit: Long; - countTotal: boolean; - reverse: boolean; -}; + key: Uint8Array; + offset: bigint; + limit: bigint; + countTotal: boolean; + reverse: boolean; +} export interface PageRequestParams { - "pagination.key"?: string; - "pagination.offset"?: string; - "pagination.limit"?: string; - "pagination.count_total"?: boolean; - "pagination.reverse"?: boolean; -}; + 'pagination.key'?: string; + 'pagination.offset'?: string; + 'pagination.limit'?: string; + 'pagination.count_total'?: boolean; + 'pagination.reverse'?: boolean; +} export interface Params { - params: PageRequestParams; -}; - -export const setPaginationParams = (options: Params, pagination?: PageRequest) => { - - if (!pagination) { - return options; - } - - if (typeof pagination?.countTotal !== "undefined") { - options.params['pagination.count_total'] = pagination.countTotal; - } - if (typeof pagination?.key !== "undefined") { - // String to Uint8Array - // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); - - // Uint8Array to String - options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); - } - if (typeof pagination?.limit !== "undefined") { - options.params["pagination.limit"] = pagination.limit.toString() - } - if (typeof pagination?.offset !== "undefined") { - options.params["pagination.offset"] = pagination.offset.toString() - } - if (typeof pagination?.reverse !== "undefined") { - options.params['pagination.reverse'] = pagination.reverse; - } + params: PageRequestParams; +} +export const setPaginationParams = ( + options: Params, + pagination?: PageRequest +) => { + if (!pagination) { return options; + } + + if (typeof pagination?.countTotal !== 'undefined') { + options.params['pagination.count_total'] = pagination.countTotal; + } + if (typeof pagination?.key !== 'undefined') { + // String to Uint8Array + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + + // Uint8Array to String + options.params['pagination.key'] = Buffer.from(pagination.key).toString( + 'base64' + ); + } + if (typeof pagination?.limit !== 'undefined') { + options.params['pagination.limit'] = pagination.limit.toString(); + } + if (typeof pagination?.offset !== 'undefined') { + options.params['pagination.offset'] = pagination.offset.toString(); + } + if (typeof pagination?.reverse !== 'undefined') { + options.params['pagination.reverse'] = pagination.reverse; + } + + return options; }; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | bigint + | boolean + | undefined; export type DeepPartial = T extends Builtin - ? T - : T extends Array - ? Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & Record>, never>; + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude>, + never + >; export interface Rpc { - request(service: string, method: string, data: Uint8Array): Promise; -}; + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} 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: Long; - /** - * 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; + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: bigint; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + + nanos: number; } export function toTimestamp(date: Date): Timestamp { - const seconds = numberToLong(date.getTime() / 1_000); - const nanos = date.getTime() % 1000 * 1000000; - return { - seconds, - nanos - }; -}; + const seconds = numberToLong(date.getTime() / 1_000); + const nanos = (date.getTime() % 1000) * 1000000; + return { + seconds, + nanos + }; +} export function fromTimestamp(t: Timestamp): Date { - let millis = t.seconds.toNumber() * 1000; - millis += t.nanos / 1000000; - return new Date(millis); -}; - -const fromJSON = (object: any): Timestamp => { - return { - seconds: isSet(object.seconds) ? Long.fromString(object.seconds) : Long.ZERO, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0 - }; -}; + let millis = Number(t.seconds) * 1000; + millis += t.nanos / 1000000; + return new Date(millis); +} const timestampFromJSON = (object: any): Timestamp => { return { - seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) + ? BigInt(object.seconds.toString()) + : BigInt(0), + nanos: isSet(object.nanos) ? Number(object.nanos) : 0 }; -} - +}; + export function fromJsonTimestamp(o: any): Timestamp { if (o instanceof Date) { return toTimestamp(o); - } else if (typeof o === "string") { + } else if (typeof o === 'string') { return toTimestamp(new Date(o)); } else { return timestampFromJSON(o); } } - + function numberToLong(number: number) { - return Long.fromNumber(number); + return BigInt(Math.trunc(number)); } diff --git a/src/codegen/ibc/applications/transfer/v1/genesis.ts b/src/codegen/ibc/applications/transfer/v1/genesis.ts index a44fcba..57b5b79 100644 --- a/src/codegen/ibc/applications/transfer/v1/genesis.ts +++ b/src/codegen/ibc/applications/transfer/v1/genesis.ts @@ -1,82 +1,123 @@ -import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** GenesisState defines the ibc-transfer genesis state */ - export interface GenesisState { portId: string; denomTraces: DenomTrace[]; - params?: Params; + params: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the ibc-transfer genesis state */ +export interface GenesisStateAmino { + port_id?: string; + denom_traces?: DenomTraceAmino[]; + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; } /** GenesisState defines the ibc-transfer genesis state */ - export interface GenesisStateSDKType { port_id: string; denom_traces: DenomTraceSDKType[]; - params?: ParamsSDKType; + params: ParamsSDKType; } - function createBaseGenesisState(): GenesisState { return { portId: "", denomTraces: [], - params: undefined + params: Params.fromPartial({}) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - for (const v of message.denomTraces) { DenomTrace.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.params !== undefined) { Params.encode(message.params, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.portId = reader.string(); break; - case 2: message.denomTraces.push(DenomTrace.decode(reader, reader.uint32())); break; - case 3: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.portId = object.portId ?? ""; message.denomTraces = object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + message.denomTraces = object.denom_traces?.map(e => DenomTrace.fromAmino(e)) || []; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.port_id = message.portId; + if (message.denomTraces) { + obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); + } else { + obj.denom_traces = []; + } + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v1/query.lcd.ts b/src/codegen/ibc/applications/transfer/v1/query.lcd.ts index 7bce53a..c2d2721 100644 --- a/src/codegen/ibc/applications/transfer/v1/query.lcd.ts +++ b/src/codegen/ibc/applications/transfer/v1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryDenomTraceRequest, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -15,35 +14,26 @@ export class LCDQueryClient { this.params = this.params.bind(this); } /* DenomTrace queries a denomination trace information. */ - - async denomTrace(params: QueryDenomTraceRequest): Promise { const endpoint = `ibc/apps/transfer/v1/denom_traces/${params.hash}`; return await this.req.get(endpoint); } /* DenomTraces queries all denomination traces. */ - - async denomTraces(params: QueryDenomTracesRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `ibc/apps/transfer/v1/denom_traces`; return await this.req.get(endpoint, options); } /* Params queries all parameters of the ibc-transfer module. */ - - async params(_params: QueryParamsRequest = {}): Promise { const endpoint = `ibc/apps/transfer/v1/params`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v1/query.rpc.Query.ts b/src/codegen/ibc/applications/transfer/v1/query.rpc.Query.ts index 62b2cc9..72480f0 100644 --- a/src/codegen/ibc/applications/transfer/v1/query.rpc.Query.ts +++ b/src/codegen/ibc/applications/transfer/v1/query.rpc.Query.ts @@ -1,49 +1,41 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryDenomTraceRequest, QueryDenomTraceResponse, QueryDenomTracesRequest, QueryDenomTracesResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; /** Query provides defines the gRPC querier service. */ - export interface Query { /** DenomTrace queries a denomination trace information. */ denomTrace(request: QueryDenomTraceRequest): Promise; /** DenomTraces queries all denomination traces. */ - denomTraces(request?: QueryDenomTracesRequest): Promise; /** Params queries all parameters of the ibc-transfer module. */ - params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.denomTrace = this.denomTrace.bind(this); this.denomTraces = this.denomTraces.bind(this); this.params = this.params.bind(this); } - denomTrace(request: QueryDenomTraceRequest): Promise { const data = QueryDenomTraceRequest.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTrace", data); - return promise.then(data => QueryDenomTraceResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryDenomTraceResponse.decode(new BinaryReader(data))); } - denomTraces(request: QueryDenomTracesRequest = { pagination: undefined }): Promise { const data = QueryDenomTracesRequest.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTraces", data); - return promise.then(data => QueryDenomTracesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryDenomTracesResponse.decode(new BinaryReader(data))); } - params(request: QueryParamsRequest = {}): Promise { const data = QueryParamsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -52,14 +44,11 @@ export const createRpcQueryExtension = (base: QueryClient) => { denomTrace(request: QueryDenomTraceRequest): Promise { return queryService.denomTrace(request); }, - denomTraces(request?: QueryDenomTracesRequest): Promise { return queryService.denomTraces(request); }, - params(request?: QueryParamsRequest): Promise { return queryService.params(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v1/query.ts b/src/codegen/ibc/applications/transfer/v1/query.ts index da2d869..e689f50 100644 --- a/src/codegen/ibc/applications/transfer/v1/query.ts +++ b/src/codegen/ibc/applications/transfer/v1/query.ts @@ -1,369 +1,583 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC * method */ - export interface QueryDenomTraceRequest { /** hash (in hex format) of the denomination trace information. */ hash: string; } +export interface QueryDenomTraceRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest"; + value: Uint8Array; +} /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC * method */ - -export interface QueryDenomTraceRequestSDKType { +export interface QueryDenomTraceRequestAmino { /** hash (in hex format) of the denomination trace information. */ + hash?: string; +} +export interface QueryDenomTraceRequestAminoMsg { + type: "cosmos-sdk/QueryDenomTraceRequest"; + value: QueryDenomTraceRequestAmino; +} +/** + * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * method + */ +export interface QueryDenomTraceRequestSDKType { hash: string; } /** * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC * method. */ - export interface QueryDenomTraceResponse { /** denom_trace returns the requested denomination trace information. */ denomTrace?: DenomTrace; } +export interface QueryDenomTraceResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse"; + value: Uint8Array; +} /** * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC * method. */ - -export interface QueryDenomTraceResponseSDKType { +export interface QueryDenomTraceResponseAmino { /** denom_trace returns the requested denomination trace information. */ + denom_trace?: DenomTraceAmino; +} +export interface QueryDenomTraceResponseAminoMsg { + type: "cosmos-sdk/QueryDenomTraceResponse"; + value: QueryDenomTraceResponseAmino; +} +/** + * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * method. + */ +export interface QueryDenomTraceResponseSDKType { denom_trace?: DenomTraceSDKType; } /** * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC * method */ - export interface QueryDenomTracesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryDenomTracesRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest"; + value: Uint8Array; +} /** * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC * method */ - -export interface QueryDenomTracesRequestSDKType { +export interface QueryDenomTracesRequestAmino { /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomTracesRequestAminoMsg { + type: "cosmos-sdk/QueryDenomTracesRequest"; + value: QueryDenomTracesRequestAmino; +} +/** + * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * method + */ +export interface QueryDenomTracesRequestSDKType { pagination?: PageRequestSDKType; } /** * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC * method. */ - export interface QueryDenomTracesResponse { /** denom_traces returns all denominations trace information. */ denomTraces: DenomTrace[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; } +export interface QueryDenomTracesResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse"; + value: Uint8Array; +} /** * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC * method. */ - -export interface QueryDenomTracesResponseSDKType { +export interface QueryDenomTracesResponseAmino { /** denom_traces returns all denominations trace information. */ - denom_traces: DenomTraceSDKType[]; + denom_traces?: DenomTraceAmino[]; /** pagination defines the pagination in the response. */ - + pagination?: PageResponseAmino; +} +export interface QueryDenomTracesResponseAminoMsg { + type: "cosmos-sdk/QueryDenomTracesResponse"; + value: QueryDenomTracesResponseAmino; +} +/** + * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * method. + */ +export interface QueryDenomTracesResponseSDKType { + denom_traces: DenomTraceSDKType[]; pagination?: PageResponseSDKType; } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsRequest is the request type for the Query/Params RPC method. */ - export interface QueryParamsRequestSDKType {} /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** params defines the parameters of the module. */ params?: Params; } +export interface QueryParamsResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse"; + value: Uint8Array; +} /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { params?: ParamsSDKType; } - function createBaseQueryDenomTraceRequest(): QueryDenomTraceRequest { return { hash: "" }; } - export const QueryDenomTraceRequest = { - encode(message: QueryDenomTraceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", + encode(message: QueryDenomTraceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== "") { writer.uint32(10).string(message.hash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomTraceRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTraceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomTraceRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomTraceRequest { + fromPartial(object: Partial): QueryDenomTraceRequest { const message = createBaseQueryDenomTraceRequest(); message.hash = object.hash ?? ""; return message; + }, + fromAmino(object: QueryDenomTraceRequestAmino): QueryDenomTraceRequest { + const message = createBaseQueryDenomTraceRequest(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + return message; + }, + toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { + const obj: any = {}; + obj.hash = message.hash; + return obj; + }, + fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { + return QueryDenomTraceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomTraceRequest): QueryDenomTraceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomTraceRequest", + value: QueryDenomTraceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomTraceRequestProtoMsg): QueryDenomTraceRequest { + return QueryDenomTraceRequest.decode(message.value); + }, + toProto(message: QueryDenomTraceRequest): Uint8Array { + return QueryDenomTraceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTraceRequest): QueryDenomTraceRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", + value: QueryDenomTraceRequest.encode(message).finish() + }; } - }; - function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { return { denomTrace: undefined }; } - export const QueryDenomTraceResponse = { - encode(message: QueryDenomTraceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", + encode(message: QueryDenomTraceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denomTrace !== undefined) { DenomTrace.encode(message.denomTrace, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomTraceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTraceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomTraceResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denomTrace = DenomTrace.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomTraceResponse { + fromPartial(object: Partial): QueryDenomTraceResponse { const message = createBaseQueryDenomTraceResponse(); message.denomTrace = object.denomTrace !== undefined && object.denomTrace !== null ? DenomTrace.fromPartial(object.denomTrace) : undefined; return message; + }, + fromAmino(object: QueryDenomTraceResponseAmino): QueryDenomTraceResponse { + const message = createBaseQueryDenomTraceResponse(); + if (object.denom_trace !== undefined && object.denom_trace !== null) { + message.denomTrace = DenomTrace.fromAmino(object.denom_trace); + } + return message; + }, + toAmino(message: QueryDenomTraceResponse): QueryDenomTraceResponseAmino { + const obj: any = {}; + obj.denom_trace = message.denomTrace ? DenomTrace.toAmino(message.denomTrace) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomTraceResponseAminoMsg): QueryDenomTraceResponse { + return QueryDenomTraceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomTraceResponse): QueryDenomTraceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomTraceResponse", + value: QueryDenomTraceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomTraceResponseProtoMsg): QueryDenomTraceResponse { + return QueryDenomTraceResponse.decode(message.value); + }, + toProto(message: QueryDenomTraceResponse): Uint8Array { + return QueryDenomTraceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTraceResponse): QueryDenomTraceResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", + value: QueryDenomTraceResponse.encode(message).finish() + }; } - }; - function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { return { pagination: undefined }; } - export const QueryDenomTracesRequest = { - encode(message: QueryDenomTracesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", + encode(message: QueryDenomTracesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomTracesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTracesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomTracesRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomTracesRequest { + fromPartial(object: Partial): QueryDenomTracesRequest { const message = createBaseQueryDenomTracesRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDenomTracesRequestAmino): QueryDenomTracesRequest { + const message = createBaseQueryDenomTracesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomTracesRequest): QueryDenomTracesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomTracesRequestAminoMsg): QueryDenomTracesRequest { + return QueryDenomTracesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomTracesRequest): QueryDenomTracesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomTracesRequest", + value: QueryDenomTracesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomTracesRequestProtoMsg): QueryDenomTracesRequest { + return QueryDenomTracesRequest.decode(message.value); + }, + toProto(message: QueryDenomTracesRequest): Uint8Array { + return QueryDenomTracesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTracesRequest): QueryDenomTracesRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", + value: QueryDenomTracesRequest.encode(message).finish() + }; } - }; - function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { return { denomTraces: [], pagination: undefined }; } - export const QueryDenomTracesResponse = { - encode(message: QueryDenomTracesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", + encode(message: QueryDenomTracesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denomTraces) { DenomTrace.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): QueryDenomTracesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTracesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryDenomTracesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denomTraces.push(DenomTrace.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryDenomTracesResponse { + fromPartial(object: Partial): QueryDenomTracesResponse { const message = createBaseQueryDenomTracesResponse(); message.denomTraces = object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryDenomTracesResponseAmino): QueryDenomTracesResponse { + const message = createBaseQueryDenomTracesResponse(); + message.denomTraces = object.denom_traces?.map(e => DenomTrace.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomTracesResponse): QueryDenomTracesResponseAmino { + const obj: any = {}; + if (message.denomTraces) { + obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); + } else { + obj.denom_traces = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomTracesResponseAminoMsg): QueryDenomTracesResponse { + return QueryDenomTracesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomTracesResponse): QueryDenomTracesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomTracesResponse", + value: QueryDenomTracesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomTracesResponseProtoMsg): QueryDenomTracesResponse { + return QueryDenomTracesResponse.decode(message.value); + }, + toProto(message: QueryDenomTracesResponse): Uint8Array { + return QueryDenomTracesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTracesResponse): QueryDenomTracesResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", + value: QueryDenomTracesResponse.encode(message).finish() + }; } - }; - function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } - export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParamsRequest { + fromPartial(_: Partial): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { params: undefined }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v1/transfer.ts b/src/codegen/ibc/applications/transfer/v1/transfer.ts index 12f29ca..07d32f1 100644 --- a/src/codegen/ibc/applications/transfer/v1/transfer.ts +++ b/src/codegen/ibc/applications/transfer/v1/transfer.ts @@ -1,10 +1,8 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the * source tracing information path. */ - export interface DenomTrace { /** * path defines the chain of port/channel identifiers used for tracing the @@ -12,22 +10,35 @@ export interface DenomTrace { */ path: string; /** base denomination of the relayed fungible token. */ - baseDenom: string; } +export interface DenomTraceProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.DenomTrace"; + value: Uint8Array; +} /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the * source tracing information path. */ - -export interface DenomTraceSDKType { +export interface DenomTraceAmino { /** * path defines the chain of port/channel identifiers used for tracing the * source of the fungible token. */ - path: string; + path?: string; /** base denomination of the relayed fungible token. */ - + base_denom?: string; +} +export interface DenomTraceAminoMsg { + type: "cosmos-sdk/DenomTrace"; + value: DenomTraceAmino; +} +/** + * DenomTrace contains the base denomination for ICS20 fungible tokens and the + * source tracing information path. + */ +export interface DenomTraceSDKType { + path: string; base_denom: string; } /** @@ -36,7 +47,6 @@ export interface DenomTraceSDKType { * TransfersEnabled parameter to true and then set the bank module's SendEnabled * parameter for the denomination to false. */ - export interface Params { /** * send_enabled enables or disables all cross-chain token transfers from this @@ -47,136 +57,203 @@ export interface Params { * receive_enabled enables or disables all cross-chain token transfers to this * chain. */ - receiveEnabled: boolean; } +export interface ParamsProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.Params"; + value: Uint8Array; +} /** * Params defines the set of IBC transfer parameters. * NOTE: To prevent a single token from being transferred, set the * TransfersEnabled parameter to true and then set the bank module's SendEnabled * parameter for the denomination to false. */ - -export interface ParamsSDKType { +export interface ParamsAmino { /** * send_enabled enables or disables all cross-chain token transfers from this * chain. */ - send_enabled: boolean; + send_enabled?: boolean; /** * receive_enabled enables or disables all cross-chain token transfers to this * chain. */ - + receive_enabled?: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** + * Params defines the set of IBC transfer parameters. + * NOTE: To prevent a single token from being transferred, set the + * TransfersEnabled parameter to true and then set the bank module's SendEnabled + * parameter for the denomination to false. + */ +export interface ParamsSDKType { + send_enabled: boolean; receive_enabled: boolean; } - function createBaseDenomTrace(): DenomTrace { return { path: "", baseDenom: "" }; } - export const DenomTrace = { - encode(message: DenomTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.DenomTrace", + encode(message: DenomTrace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path !== "") { writer.uint32(10).string(message.path); } - if (message.baseDenom !== "") { writer.uint32(18).string(message.baseDenom); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DenomTrace { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DenomTrace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDenomTrace(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.string(); break; - case 2: message.baseDenom = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DenomTrace { + fromPartial(object: Partial): DenomTrace { const message = createBaseDenomTrace(); message.path = object.path ?? ""; message.baseDenom = object.baseDenom ?? ""; return message; + }, + fromAmino(object: DenomTraceAmino): DenomTrace { + const message = createBaseDenomTrace(); + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + if (object.base_denom !== undefined && object.base_denom !== null) { + message.baseDenom = object.base_denom; + } + return message; + }, + toAmino(message: DenomTrace): DenomTraceAmino { + const obj: any = {}; + obj.path = message.path; + obj.base_denom = message.baseDenom; + return obj; + }, + fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { + return DenomTrace.fromAmino(object.value); + }, + toAminoMsg(message: DenomTrace): DenomTraceAminoMsg { + return { + type: "cosmos-sdk/DenomTrace", + value: DenomTrace.toAmino(message) + }; + }, + fromProtoMsg(message: DenomTraceProtoMsg): DenomTrace { + return DenomTrace.decode(message.value); + }, + toProto(message: DenomTrace): Uint8Array { + return DenomTrace.encode(message).finish(); + }, + toProtoMsg(message: DenomTrace): DenomTraceProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.DenomTrace", + value: DenomTrace.encode(message).finish() + }; } - }; - function createBaseParams(): Params { return { sendEnabled: false, receiveEnabled: false }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sendEnabled === true) { writer.uint32(8).bool(message.sendEnabled); } - if (message.receiveEnabled === true) { writer.uint32(16).bool(message.receiveEnabled); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.sendEnabled = reader.bool(); break; - case 2: message.receiveEnabled = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); message.sendEnabled = object.sendEnabled ?? false; message.receiveEnabled = object.receiveEnabled ?? false; return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.send_enabled !== undefined && object.send_enabled !== null) { + message.sendEnabled = object.send_enabled; + } + if (object.receive_enabled !== undefined && object.receive_enabled !== null) { + message.receiveEnabled = object.receive_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.send_enabled = message.sendEnabled; + obj.receive_enabled = message.receiveEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.Params", + value: Params.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v1/tx.amino.ts b/src/codegen/ibc/applications/transfer/v1/tx.amino.ts index 27b3d3e..65002c1 100644 --- a/src/codegen/ibc/applications/transfer/v1/tx.amino.ts +++ b/src/codegen/ibc/applications/transfer/v1/tx.amino.ts @@ -1,73 +1,8 @@ -import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, Long, omitDefault } from "../../../../helpers"; import { MsgTransfer } from "./tx"; -export interface AminoMsgTransfer extends AminoMsg { - type: "cosmos-sdk/MsgTransfer"; - value: { - source_port: string; - source_channel: string; - token: { - denom: string; - amount: string; - }; - sender: string; - receiver: string; - timeout_height: AminoHeight; - timeout_timestamp: string; - }; -} export const AminoConverter = { "/ibc.applications.transfer.v1.MsgTransfer": { aminoType: "cosmos-sdk/MsgTransfer", - toAmino: ({ - sourcePort, - sourceChannel, - token, - sender, - receiver, - timeoutHeight, - timeoutTimestamp - }: MsgTransfer): AminoMsgTransfer["value"] => { - return { - source_port: sourcePort, - source_channel: sourceChannel, - token: { - denom: token.denom, - amount: Long.fromValue(token.amount).toString() - }, - sender, - receiver, - timeout_height: timeoutHeight ? { - revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), - revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() - } : {}, - timeout_timestamp: timeoutTimestamp.toString() - }; - }, - fromAmino: ({ - source_port, - source_channel, - token, - sender, - receiver, - timeout_height, - timeout_timestamp - }: AminoMsgTransfer["value"]): MsgTransfer => { - return { - sourcePort: source_port, - sourceChannel: source_channel, - token: { - denom: token.denom, - amount: token.amount - }, - sender, - receiver, - timeoutHeight: timeout_height ? { - revisionHeight: Long.fromString(timeout_height.revision_height || "0", true), - revisionNumber: Long.fromString(timeout_height.revision_number || "0", true) - } : undefined, - timeoutTimestamp: Long.fromString(timeout_timestamp) - }; - } + toAmino: MsgTransfer.toAmino, + fromAmino: MsgTransfer.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v1/tx.registry.ts b/src/codegen/ibc/applications/transfer/v1/tx.registry.ts index 548e3b8..6726e57 100644 --- a/src/codegen/ibc/applications/transfer/v1/tx.registry.ts +++ b/src/codegen/ibc/applications/transfer/v1/tx.registry.ts @@ -14,7 +14,6 @@ export const MessageComposer = { value: MsgTransfer.encode(value).finish() }; } - }, withTypeUrl: { transfer(value: MsgTransfer) { @@ -23,7 +22,6 @@ export const MessageComposer = { value }; } - }, fromPartial: { transfer(value: MsgTransfer) { @@ -32,6 +30,5 @@ export const MessageComposer = { value: MsgTransfer.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v1/tx.rpc.msg.ts b/src/codegen/ibc/applications/transfer/v1/tx.rpc.msg.ts index b0ed7b3..c4f2857 100644 --- a/src/codegen/ibc/applications/transfer/v1/tx.rpc.msg.ts +++ b/src/codegen/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -1,24 +1,20 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { MsgTransfer, MsgTransferResponse } from "./tx"; /** Msg defines the ibc/transfer Msg service. */ - export interface Msg { /** Transfer defines a rpc handler method for MsgTransfer. */ transfer(request: MsgTransfer): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.transfer = this.transfer.bind(this); } - transfer(request: MsgTransfer): Promise { const data = MsgTransfer.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Msg", "Transfer", data); - return promise.then(data => MsgTransferResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgTransferResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v1/tx.ts b/src/codegen/ibc/applications/transfer/v1/tx.ts index 2a1e356..c110422 100644 --- a/src/codegen/ibc/applications/transfer/v1/tx.ts +++ b/src/codegen/ibc/applications/transfer/v1/tx.ts @@ -1,174 +1,169 @@ -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; -import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between * ICS20 enabled chains. See ICS Spec here: * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures */ - export interface MsgTransfer { /** the port on which the packet will be sent */ sourcePort: string; /** the channel by which the packet will be sent */ - sourceChannel: string; /** the tokens to be transferred */ - - token?: Coin; + token: Coin; /** the sender address */ - sender: string; /** the recipient address on the destination chain */ - receiver: string; /** * Timeout height relative to the current block height. * The timeout is disabled when set to 0. */ - - timeoutHeight?: Height; + timeoutHeight: Height; /** * Timeout timestamp (in nanoseconds) relative to the current block timestamp. * The timeout is disabled when set to 0. */ - - timeoutTimestamp: Long; + timeoutTimestamp: bigint; +} +export interface MsgTransferProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer"; + value: Uint8Array; } /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between * ICS20 enabled chains. See ICS Spec here: * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures */ - -export interface MsgTransferSDKType { +export interface MsgTransferAmino { /** the port on which the packet will be sent */ - source_port: string; + source_port?: string; /** the channel by which the packet will be sent */ - - source_channel: string; + source_channel?: string; /** the tokens to be transferred */ - - token?: CoinSDKType; + token?: CoinAmino; /** the sender address */ - - sender: string; + sender?: string; /** the recipient address on the destination chain */ - - receiver: string; + receiver?: string; /** * Timeout height relative to the current block height. * The timeout is disabled when set to 0. */ - - timeout_height?: HeightSDKType; + timeout_height?: HeightAmino; /** * Timeout timestamp (in nanoseconds) relative to the current block timestamp. * The timeout is disabled when set to 0. */ - - timeout_timestamp: Long; + timeout_timestamp?: string; +} +export interface MsgTransferAminoMsg { + type: "cosmos-sdk/MsgTransfer"; + value: MsgTransferAmino; +} +/** + * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between + * ICS20 enabled chains. See ICS Spec here: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface MsgTransferSDKType { + source_port: string; + source_channel: string; + token: CoinSDKType; + sender: string; + receiver: string; + timeout_height: HeightSDKType; + timeout_timestamp: bigint; } /** MsgTransferResponse defines the Msg/Transfer response type. */ - export interface MsgTransferResponse {} +export interface MsgTransferResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse"; + value: Uint8Array; +} +/** MsgTransferResponse defines the Msg/Transfer response type. */ +export interface MsgTransferResponseAmino {} +export interface MsgTransferResponseAminoMsg { + type: "cosmos-sdk/MsgTransferResponse"; + value: MsgTransferResponseAmino; +} /** MsgTransferResponse defines the Msg/Transfer response type. */ - export interface MsgTransferResponseSDKType {} - function createBaseMsgTransfer(): MsgTransfer { return { sourcePort: "", sourceChannel: "", - token: undefined, + token: Coin.fromPartial({}), sender: "", receiver: "", - timeoutHeight: undefined, - timeoutTimestamp: Long.UZERO + timeoutHeight: Height.fromPartial({}), + timeoutTimestamp: BigInt(0) }; } - export const MsgTransfer = { - encode(message: MsgTransfer, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + encode(message: MsgTransfer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sourcePort !== "") { writer.uint32(10).string(message.sourcePort); } - if (message.sourceChannel !== "") { writer.uint32(18).string(message.sourceChannel); } - if (message.token !== undefined) { Coin.encode(message.token, writer.uint32(26).fork()).ldelim(); } - if (message.sender !== "") { writer.uint32(34).string(message.sender); } - if (message.receiver !== "") { writer.uint32(42).string(message.receiver); } - if (message.timeoutHeight !== undefined) { Height.encode(message.timeoutHeight, writer.uint32(50).fork()).ldelim(); } - - if (!message.timeoutTimestamp.isZero()) { + if (message.timeoutTimestamp !== BigInt(0)) { writer.uint32(56).uint64(message.timeoutTimestamp); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgTransfer { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgTransfer { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTransfer(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.sourcePort = reader.string(); break; - case 2: message.sourceChannel = reader.string(); break; - case 3: message.token = Coin.decode(reader, reader.uint32()); break; - case 4: message.sender = reader.string(); break; - case 5: message.receiver = reader.string(); break; - case 6: message.timeoutHeight = Height.decode(reader, reader.uint32()); break; - case 7: - message.timeoutTimestamp = (reader.uint64() as Long); + message.timeoutTimestamp = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgTransfer { + fromPartial(object: Partial): MsgTransfer { const message = createBaseMsgTransfer(); message.sourcePort = object.sourcePort ?? ""; message.sourceChannel = object.sourceChannel ?? ""; @@ -176,42 +171,120 @@ export const MsgTransfer = { message.sender = object.sender ?? ""; message.receiver = object.receiver ?? ""; message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; - message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? Long.fromValue(object.timeoutTimestamp) : Long.UZERO; + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgTransferAmino): MsgTransfer { + const message = createBaseMsgTransfer(); + if (object.source_port !== undefined && object.source_port !== null) { + message.sourcePort = object.source_port; + } + if (object.source_channel !== undefined && object.source_channel !== null) { + message.sourceChannel = object.source_channel; + } + if (object.token !== undefined && object.token !== null) { + message.token = Coin.fromAmino(object.token); + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.receiver !== undefined && object.receiver !== null) { + message.receiver = object.receiver; + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = Height.fromAmino(object.timeout_height); + } + if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeout_timestamp); + } return message; + }, + toAmino(message: MsgTransfer): MsgTransferAmino { + const obj: any = {}; + obj.source_port = message.sourcePort; + obj.source_channel = message.sourceChannel; + obj.token = message.token ? Coin.toAmino(message.token) : undefined; + obj.sender = message.sender; + obj.receiver = message.receiver; + obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; + obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { + return MsgTransfer.fromAmino(object.value); + }, + toAminoMsg(message: MsgTransfer): MsgTransferAminoMsg { + return { + type: "cosmos-sdk/MsgTransfer", + value: MsgTransfer.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTransferProtoMsg): MsgTransfer { + return MsgTransfer.decode(message.value); + }, + toProto(message: MsgTransfer): Uint8Array { + return MsgTransfer.encode(message).finish(); + }, + toProtoMsg(message: MsgTransfer): MsgTransferProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value: MsgTransfer.encode(message).finish() + }; } - }; - function createBaseMsgTransferResponse(): MsgTransferResponse { return {}; } - export const MsgTransferResponse = { - encode(_: MsgTransferResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", + encode(_: MsgTransferResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgTransferResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgTransferResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTransferResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgTransferResponse { + fromPartial(_: Partial): MsgTransferResponse { + const message = createBaseMsgTransferResponse(); + return message; + }, + fromAmino(_: MsgTransferResponseAmino): MsgTransferResponse { const message = createBaseMsgTransferResponse(); return message; + }, + toAmino(_: MsgTransferResponse): MsgTransferResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgTransferResponseAminoMsg): MsgTransferResponse { + return MsgTransferResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTransferResponse): MsgTransferResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTransferResponse", + value: MsgTransferResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTransferResponseProtoMsg): MsgTransferResponse { + return MsgTransferResponse.decode(message.value); + }, + toProto(message: MsgTransferResponse): Uint8Array { + return MsgTransferResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTransferResponse): MsgTransferResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", + value: MsgTransferResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/applications/transfer/v2/packet.ts b/src/codegen/ibc/applications/transfer/v2/packet.ts index d186555..fd5a156 100644 --- a/src/codegen/ibc/applications/transfer/v2/packet.ts +++ b/src/codegen/ibc/applications/transfer/v2/packet.ts @@ -1,44 +1,53 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * FungibleTokenPacketData defines a struct for the packet payload * See FungibleTokenPacketData spec: * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures */ - export interface FungibleTokenPacketData { /** the token denomination to be transferred */ denom: string; /** the token amount to be transferred */ - amount: string; /** the sender address */ - sender: string; /** the recipient address on the destination chain */ - receiver: string; } +export interface FungibleTokenPacketDataProtoMsg { + typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData"; + value: Uint8Array; +} /** * FungibleTokenPacketData defines a struct for the packet payload * See FungibleTokenPacketData spec: * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures */ - -export interface FungibleTokenPacketDataSDKType { +export interface FungibleTokenPacketDataAmino { /** the token denomination to be transferred */ - denom: string; + denom?: string; /** the token amount to be transferred */ - - amount: string; + amount?: string; /** the sender address */ - - sender: string; + sender?: string; /** the recipient address on the destination chain */ - + receiver?: string; +} +export interface FungibleTokenPacketDataAminoMsg { + type: "cosmos-sdk/FungibleTokenPacketData"; + value: FungibleTokenPacketDataAmino; +} +/** + * FungibleTokenPacketData defines a struct for the packet payload + * See FungibleTokenPacketData spec: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface FungibleTokenPacketDataSDKType { + denom: string; + amount: string; + sender: string; receiver: string; } - function createBaseFungibleTokenPacketData(): FungibleTokenPacketData { return { denom: "", @@ -47,69 +56,100 @@ function createBaseFungibleTokenPacketData(): FungibleTokenPacketData { receiver: "" }; } - export const FungibleTokenPacketData = { - encode(message: FungibleTokenPacketData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", + encode(message: FungibleTokenPacketData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.amount !== "") { writer.uint32(18).string(message.amount); } - if (message.sender !== "") { writer.uint32(26).string(message.sender); } - if (message.receiver !== "") { writer.uint32(34).string(message.receiver); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FungibleTokenPacketData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): FungibleTokenPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFungibleTokenPacketData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: message.amount = reader.string(); break; - case 3: message.sender = reader.string(); break; - case 4: message.receiver = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): FungibleTokenPacketData { + fromPartial(object: Partial): FungibleTokenPacketData { const message = createBaseFungibleTokenPacketData(); message.denom = object.denom ?? ""; message.amount = object.amount ?? ""; message.sender = object.sender ?? ""; message.receiver = object.receiver ?? ""; return message; + }, + fromAmino(object: FungibleTokenPacketDataAmino): FungibleTokenPacketData { + const message = createBaseFungibleTokenPacketData(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.receiver !== undefined && object.receiver !== null) { + message.receiver = object.receiver; + } + return message; + }, + toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.amount = message.amount; + obj.sender = message.sender; + obj.receiver = message.receiver; + return obj; + }, + fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { + return FungibleTokenPacketData.fromAmino(object.value); + }, + toAminoMsg(message: FungibleTokenPacketData): FungibleTokenPacketDataAminoMsg { + return { + type: "cosmos-sdk/FungibleTokenPacketData", + value: FungibleTokenPacketData.toAmino(message) + }; + }, + fromProtoMsg(message: FungibleTokenPacketDataProtoMsg): FungibleTokenPacketData { + return FungibleTokenPacketData.decode(message.value); + }, + toProto(message: FungibleTokenPacketData): Uint8Array { + return FungibleTokenPacketData.encode(message).finish(); + }, + toProtoMsg(message: FungibleTokenPacketData): FungibleTokenPacketDataProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", + value: FungibleTokenPacketData.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/bundle.ts b/src/codegen/ibc/bundle.ts index 6fe8014..5c3b9db 100644 --- a/src/codegen/ibc/bundle.ts +++ b/src/codegen/ibc/bundle.ts @@ -22,116 +22,129 @@ import * as _122 from "./lightclients/localhost/v1/localhost"; import * as _123 from "./lightclients/solomachine/v1/solomachine"; import * as _124 from "./lightclients/solomachine/v2/solomachine"; import * as _125 from "./lightclients/tendermint/v1/tendermint"; -import * as _225 from "./applications/transfer/v1/tx.amino"; -import * as _226 from "./core/channel/v1/tx.amino"; -import * as _227 from "./core/client/v1/tx.amino"; -import * as _228 from "./core/connection/v1/tx.amino"; -import * as _229 from "./applications/transfer/v1/tx.registry"; -import * as _230 from "./core/channel/v1/tx.registry"; -import * as _231 from "./core/client/v1/tx.registry"; -import * as _232 from "./core/connection/v1/tx.registry"; -import * as _233 from "./applications/transfer/v1/query.lcd"; -import * as _234 from "./core/channel/v1/query.lcd"; -import * as _235 from "./core/client/v1/query.lcd"; -import * as _236 from "./core/connection/v1/query.lcd"; -import * as _237 from "./applications/transfer/v1/query.rpc.Query"; -import * as _238 from "./core/channel/v1/query.rpc.Query"; -import * as _239 from "./core/client/v1/query.rpc.Query"; -import * as _240 from "./core/connection/v1/query.rpc.Query"; -import * as _241 from "./core/port/v1/query.rpc.Query"; -import * as _242 from "./applications/transfer/v1/tx.rpc.msg"; -import * as _243 from "./core/channel/v1/tx.rpc.msg"; -import * as _244 from "./core/client/v1/tx.rpc.msg"; -import * as _245 from "./core/connection/v1/tx.rpc.msg"; -import * as _259 from "./lcd"; -import * as _260 from "./rpc.query"; -import * as _261 from "./rpc.tx"; +import * as _243 from "./applications/transfer/v1/tx.amino"; +import * as _244 from "./core/channel/v1/tx.amino"; +import * as _245 from "./core/client/v1/tx.amino"; +import * as _246 from "./core/connection/v1/tx.amino"; +import * as _247 from "./applications/transfer/v1/tx.registry"; +import * as _248 from "./core/channel/v1/tx.registry"; +import * as _249 from "./core/client/v1/tx.registry"; +import * as _250 from "./core/connection/v1/tx.registry"; +import * as _251 from "./applications/transfer/v1/query.lcd"; +import * as _252 from "./core/channel/v1/query.lcd"; +import * as _253 from "./core/client/v1/query.lcd"; +import * as _254 from "./core/connection/v1/query.lcd"; +import * as _255 from "./applications/transfer/v1/query.rpc.Query"; +import * as _256 from "./core/channel/v1/query.rpc.Query"; +import * as _257 from "./core/client/v1/query.rpc.Query"; +import * as _258 from "./core/connection/v1/query.rpc.Query"; +import * as _259 from "./core/port/v1/query.rpc.Query"; +import * as _260 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _261 from "./core/channel/v1/tx.rpc.msg"; +import * as _262 from "./core/client/v1/tx.rpc.msg"; +import * as _263 from "./core/connection/v1/tx.rpc.msg"; +import * as _297 from "./lcd"; +import * as _298 from "./rpc.query"; +import * as _299 from "./rpc.tx"; export namespace ibc { export namespace applications { export namespace transfer { - export const v1 = { ..._102, + export const v1 = { + ..._102, ..._103, ..._104, ..._105, - ..._225, - ..._229, - ..._233, - ..._237, - ..._242 + ..._243, + ..._247, + ..._251, + ..._255, + ..._260 }; - export const v2 = { ..._106 + export const v2 = { + ..._106 }; } } export namespace core { export namespace channel { - export const v1 = { ..._107, + export const v1 = { + ..._107, ..._108, ..._109, ..._110, - ..._226, - ..._230, - ..._234, - ..._238, - ..._243 + ..._244, + ..._248, + ..._252, + ..._256, + ..._261 }; } export namespace client { - export const v1 = { ..._111, + export const v1 = { + ..._111, ..._112, ..._113, ..._114, - ..._227, - ..._231, - ..._235, - ..._239, - ..._244 + ..._245, + ..._249, + ..._253, + ..._257, + ..._262 }; } export namespace commitment { - export const v1 = { ..._115 + export const v1 = { + ..._115 }; } export namespace connection { - export const v1 = { ..._116, + export const v1 = { + ..._116, ..._117, ..._118, ..._119, - ..._228, - ..._232, - ..._236, - ..._240, - ..._245 + ..._246, + ..._250, + ..._254, + ..._258, + ..._263 }; } export namespace port { - export const v1 = { ..._120, - ..._241 + export const v1 = { + ..._120, + ..._259 }; } export namespace types { - export const v1 = { ..._121 + export const v1 = { + ..._121 }; } } export namespace lightclients { export namespace localhost { - export const v1 = { ..._122 + export const v1 = { + ..._122 }; } export namespace solomachine { - export const v1 = { ..._123 + export const v1 = { + ..._123 }; - export const v2 = { ..._124 + export const v2 = { + ..._124 }; } export namespace tendermint { - export const v1 = { ..._125 + export const v1 = { + ..._125 }; } } - export const ClientFactory = { ..._259, - ..._260, - ..._261 + export const ClientFactory = { + ..._297, + ..._298, + ..._299 }; } \ No newline at end of file diff --git a/src/codegen/ibc/client.ts b/src/codegen/ibc/client.ts index 48e2318..1256ef0 100644 --- a/src/codegen/ibc/client.ts +++ b/src/codegen/ibc/client.ts @@ -9,7 +9,8 @@ import * as ibcApplicationsTransferV1TxAmino from "./applications/transfer/v1/tx import * as ibcCoreChannelV1TxAmino from "./core/channel/v1/tx.amino"; import * as ibcCoreClientV1TxAmino from "./core/client/v1/tx.amino"; import * as ibcCoreConnectionV1TxAmino from "./core/connection/v1/tx.amino"; -export const ibcAminoConverters = { ...ibcApplicationsTransferV1TxAmino.AminoConverter, +export const ibcAminoConverters = { + ...ibcApplicationsTransferV1TxAmino.AminoConverter, ...ibcCoreChannelV1TxAmino.AminoConverter, ...ibcCoreClientV1TxAmino.AminoConverter, ...ibcCoreConnectionV1TxAmino.AminoConverter @@ -24,7 +25,8 @@ export const getSigningIbcClientOptions = ({ aminoTypes: AminoTypes; } => { const registry = new Registry([...defaultTypes, ...ibcProtoRegistry]); - const aminoTypes = new AminoTypes({ ...ibcAminoConverters + const aminoTypes = new AminoTypes({ + ...ibcAminoConverters }); return { registry, @@ -47,7 +49,7 @@ export const getSigningIbcClient = async ({ defaultTypes }); const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { - registry, + registry: (registry as any), aminoTypes }); return client; diff --git a/src/codegen/ibc/core/channel/v1/channel.ts b/src/codegen/ibc/core/channel/v1/channel.ts index 51c6fe1..6926cb7 100644 --- a/src/codegen/ibc/core/channel/v1/channel.ts +++ b/src/codegen/ibc/core/channel/v1/channel.ts @@ -1,55 +1,22 @@ -import { Height, HeightSDKType } from "../../client/v1/client"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../../helpers"; +import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * State defines if a channel is in one of the following states: * CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. */ - export enum State { /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ STATE_UNINITIALIZED_UNSPECIFIED = 0, - /** STATE_INIT - A channel has just started the opening handshake. */ STATE_INIT = 1, - /** STATE_TRYOPEN - A channel has acknowledged the handshake step on the counterparty chain. */ STATE_TRYOPEN = 2, - /** * STATE_OPEN - A channel has completed the handshake. Open channels are * ready to send and receive packets. */ STATE_OPEN = 3, - - /** - * STATE_CLOSED - A channel has been closed and can no longer be used to send or receive - * packets. - */ - STATE_CLOSED = 4, - UNRECOGNIZED = -1, -} -/** - * State defines if a channel is in one of the following states: - * CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - */ - -export enum StateSDKType { - /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ - STATE_UNINITIALIZED_UNSPECIFIED = 0, - - /** STATE_INIT - A channel has just started the opening handshake. */ - STATE_INIT = 1, - - /** STATE_TRYOPEN - A channel has acknowledged the handshake step on the counterparty chain. */ - STATE_TRYOPEN = 2, - - /** - * STATE_OPEN - A channel has completed the handshake. Open channels are - * ready to send and receive packets. - */ - STATE_OPEN = 3, - /** * STATE_CLOSED - A channel has been closed and can no longer be used to send or receive * packets. @@ -57,28 +24,25 @@ export enum StateSDKType { STATE_CLOSED = 4, UNRECOGNIZED = -1, } +export const StateSDKType = State; +export const StateAmino = State; export function stateFromJSON(object: any): State { switch (object) { case 0: case "STATE_UNINITIALIZED_UNSPECIFIED": return State.STATE_UNINITIALIZED_UNSPECIFIED; - case 1: case "STATE_INIT": return State.STATE_INIT; - case 2: case "STATE_TRYOPEN": return State.STATE_TRYOPEN; - case 3: case "STATE_OPEN": return State.STATE_OPEN; - case 4: case "STATE_CLOSED": return State.STATE_CLOSED; - case -1: case "UNRECOGNIZED": default: @@ -89,70 +53,45 @@ export function stateToJSON(object: State): string { switch (object) { case State.STATE_UNINITIALIZED_UNSPECIFIED: return "STATE_UNINITIALIZED_UNSPECIFIED"; - case State.STATE_INIT: return "STATE_INIT"; - case State.STATE_TRYOPEN: return "STATE_TRYOPEN"; - case State.STATE_OPEN: return "STATE_OPEN"; - case State.STATE_CLOSED: return "STATE_CLOSED"; - case State.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Order defines if a channel is ORDERED or UNORDERED */ - export enum Order { /** ORDER_NONE_UNSPECIFIED - zero-value for channel ordering */ ORDER_NONE_UNSPECIFIED = 0, - - /** - * ORDER_UNORDERED - packets can be delivered in any order, which may differ from the order in - * which they were sent. - */ - ORDER_UNORDERED = 1, - - /** ORDER_ORDERED - packets are delivered exactly in the order which they were sent */ - ORDER_ORDERED = 2, - UNRECOGNIZED = -1, -} -/** Order defines if a channel is ORDERED or UNORDERED */ - -export enum OrderSDKType { - /** ORDER_NONE_UNSPECIFIED - zero-value for channel ordering */ - ORDER_NONE_UNSPECIFIED = 0, - /** * ORDER_UNORDERED - packets can be delivered in any order, which may differ from the order in * which they were sent. */ ORDER_UNORDERED = 1, - /** ORDER_ORDERED - packets are delivered exactly in the order which they were sent */ ORDER_ORDERED = 2, UNRECOGNIZED = -1, } +export const OrderSDKType = Order; +export const OrderAmino = Order; export function orderFromJSON(object: any): Order { switch (object) { case 0: case "ORDER_NONE_UNSPECIFIED": return Order.ORDER_NONE_UNSPECIFIED; - case 1: case "ORDER_UNORDERED": return Order.ORDER_UNORDERED; - case 2: case "ORDER_ORDERED": return Order.ORDER_ORDERED; - case -1: case "UNRECOGNIZED": default: @@ -163,13 +102,10 @@ export function orderToJSON(object: Order): string { switch (object) { case Order.ORDER_NONE_UNSPECIFIED: return "ORDER_NONE_UNSPECIFIED"; - case Order.ORDER_UNORDERED: return "ORDER_UNORDERED"; - case Order.ORDER_ORDERED: return "ORDER_ORDERED"; - case Order.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -180,190 +116,219 @@ export function orderToJSON(object: Order): string { * modules on separate blockchains, which has at least one end capable of * sending packets and one end capable of receiving packets. */ - export interface Channel { /** current state of the channel end */ state: State; /** whether the channel is ordered or unordered */ - ordering: Order; /** counterparty channel end */ - - counterparty?: Counterparty; + counterparty: Counterparty; /** * list of connection identifiers, in order, along which packets sent on * this channel will travel */ - connectionHops: string[]; /** opaque channel version, which is agreed upon during the handshake */ - version: string; } +export interface ChannelProtoMsg { + typeUrl: "/ibc.core.channel.v1.Channel"; + value: Uint8Array; +} /** * Channel defines pipeline for exactly-once packet delivery between specific * modules on separate blockchains, which has at least one end capable of * sending packets and one end capable of receiving packets. */ - -export interface ChannelSDKType { +export interface ChannelAmino { /** current state of the channel end */ - state: StateSDKType; + state?: State; /** whether the channel is ordered or unordered */ - - ordering: OrderSDKType; + ordering?: Order; /** counterparty channel end */ - - counterparty?: CounterpartySDKType; + counterparty?: CounterpartyAmino; /** * list of connection identifiers, in order, along which packets sent on * this channel will travel */ - - connection_hops: string[]; + connection_hops?: string[]; /** opaque channel version, which is agreed upon during the handshake */ - + version?: string; +} +export interface ChannelAminoMsg { + type: "cosmos-sdk/Channel"; + value: ChannelAmino; +} +/** + * Channel defines pipeline for exactly-once packet delivery between specific + * modules on separate blockchains, which has at least one end capable of + * sending packets and one end capable of receiving packets. + */ +export interface ChannelSDKType { + state: State; + ordering: Order; + counterparty: CounterpartySDKType; + connection_hops: string[]; version: string; } /** * IdentifiedChannel defines a channel with additional port and channel * identifier fields. */ - export interface IdentifiedChannel { /** current state of the channel end */ state: State; /** whether the channel is ordered or unordered */ - ordering: Order; /** counterparty channel end */ - - counterparty?: Counterparty; + counterparty: Counterparty; /** * list of connection identifiers, in order, along which packets sent on * this channel will travel */ - connectionHops: string[]; /** opaque channel version, which is agreed upon during the handshake */ - version: string; /** port identifier */ - portId: string; /** channel identifier */ - channelId: string; } +export interface IdentifiedChannelProtoMsg { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel"; + value: Uint8Array; +} /** * IdentifiedChannel defines a channel with additional port and channel * identifier fields. */ - -export interface IdentifiedChannelSDKType { +export interface IdentifiedChannelAmino { /** current state of the channel end */ - state: StateSDKType; + state?: State; /** whether the channel is ordered or unordered */ - - ordering: OrderSDKType; + ordering?: Order; /** counterparty channel end */ - - counterparty?: CounterpartySDKType; + counterparty?: CounterpartyAmino; /** * list of connection identifiers, in order, along which packets sent on * this channel will travel */ - - connection_hops: string[]; + connection_hops?: string[]; /** opaque channel version, which is agreed upon during the handshake */ - - version: string; + version?: string; /** port identifier */ - - port_id: string; + port_id?: string; /** channel identifier */ - + channel_id?: string; +} +export interface IdentifiedChannelAminoMsg { + type: "cosmos-sdk/IdentifiedChannel"; + value: IdentifiedChannelAmino; +} +/** + * IdentifiedChannel defines a channel with additional port and channel + * identifier fields. + */ +export interface IdentifiedChannelSDKType { + state: State; + ordering: Order; + counterparty: CounterpartySDKType; + connection_hops: string[]; + version: string; + port_id: string; channel_id: string; } /** Counterparty defines a channel end counterparty */ - export interface Counterparty { /** port on the counterparty chain which owns the other end of the channel. */ portId: string; /** channel end on the counterparty chain */ - channelId: string; } +export interface CounterpartyProtoMsg { + typeUrl: "/ibc.core.channel.v1.Counterparty"; + value: Uint8Array; +} /** Counterparty defines a channel end counterparty */ - -export interface CounterpartySDKType { +export interface CounterpartyAmino { /** port on the counterparty chain which owns the other end of the channel. */ - port_id: string; + port_id?: string; /** channel end on the counterparty chain */ - + channel_id?: string; +} +export interface CounterpartyAminoMsg { + type: "cosmos-sdk/Counterparty"; + value: CounterpartyAmino; +} +/** Counterparty defines a channel end counterparty */ +export interface CounterpartySDKType { + port_id: string; channel_id: string; } /** Packet defines a type that carries data across different chains through IBC */ - export interface Packet { /** * number corresponds to the order of sends and receives, where a Packet * with an earlier sequence number must be sent and received before a Packet * with a later sequence number. */ - sequence: Long; + sequence: bigint; /** identifies the port on the sending chain. */ - sourcePort: string; /** identifies the channel end on the sending chain. */ - sourceChannel: string; /** identifies the port on the receiving chain. */ - destinationPort: string; /** identifies the channel end on the receiving chain. */ - destinationChannel: string; /** actual opaque bytes transferred directly to the application module */ - data: Uint8Array; /** block height after which the packet times out */ - - timeoutHeight?: Height; + timeoutHeight: Height; /** block timestamp (in nanoseconds) after which the packet times out */ - - timeoutTimestamp: Long; + timeoutTimestamp: bigint; +} +export interface PacketProtoMsg { + typeUrl: "/ibc.core.channel.v1.Packet"; + value: Uint8Array; } /** Packet defines a type that carries data across different chains through IBC */ - -export interface PacketSDKType { +export interface PacketAmino { /** * number corresponds to the order of sends and receives, where a Packet * with an earlier sequence number must be sent and received before a Packet * with a later sequence number. */ - sequence: Long; + sequence?: string; /** identifies the port on the sending chain. */ - - source_port: string; + source_port?: string; /** identifies the channel end on the sending chain. */ - - source_channel: string; + source_channel?: string; /** identifies the port on the receiving chain. */ - - destination_port: string; + destination_port?: string; /** identifies the channel end on the receiving chain. */ - - destination_channel: string; + destination_channel?: string; /** actual opaque bytes transferred directly to the application module */ - - data: Uint8Array; + data?: string; /** block height after which the packet times out */ - - timeout_height?: HeightSDKType; + timeout_height?: HeightAmino; /** block timestamp (in nanoseconds) after which the packet times out */ - - timeout_timestamp: Long; + timeout_timestamp?: string; +} +export interface PacketAminoMsg { + type: "cosmos-sdk/Packet"; + value: PacketAmino; +} +/** Packet defines a type that carries data across different chains through IBC */ +export interface PacketSDKType { + sequence: bigint; + source_port: string; + source_channel: string; + destination_port: string; + destination_channel: string; + data: Uint8Array; + timeout_height: HeightSDKType; + timeout_timestamp: bigint; } /** * PacketState defines the generic type necessary to retrieve and store @@ -371,38 +336,50 @@ export interface PacketSDKType { * Caller is responsible for knowing the context necessary to interpret this * state as a commitment, acknowledgement, or a receipt. */ - export interface PacketState { /** channel port identifier. */ portId: string; /** channel unique identifier. */ - channelId: string; /** packet sequence. */ - - sequence: Long; + sequence: bigint; /** embedded data that represents packet state. */ - data: Uint8Array; } +export interface PacketStateProtoMsg { + typeUrl: "/ibc.core.channel.v1.PacketState"; + value: Uint8Array; +} /** * PacketState defines the generic type necessary to retrieve and store * packet commitments, acknowledgements, and receipts. * Caller is responsible for knowing the context necessary to interpret this * state as a commitment, acknowledgement, or a receipt. */ - -export interface PacketStateSDKType { +export interface PacketStateAmino { /** channel port identifier. */ - port_id: string; + port_id?: string; /** channel unique identifier. */ - - channel_id: string; + channel_id?: string; /** packet sequence. */ - - sequence: Long; + sequence?: string; /** embedded data that represents packet state. */ - + data?: string; +} +export interface PacketStateAminoMsg { + type: "cosmos-sdk/PacketState"; + value: PacketStateAmino; +} +/** + * PacketState defines the generic type necessary to retrieve and store + * packet commitments, acknowledgements, and receipts. + * Caller is responsible for knowing the context necessary to interpret this + * state as a commitment, acknowledgement, or a receipt. + */ +export interface PacketStateSDKType { + port_id: string; + channel_id: string; + sequence: bigint; data: Uint8Array; } /** @@ -414,11 +391,31 @@ export interface PacketStateSDKType { * `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: * https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope */ - export interface Acknowledgement { result?: Uint8Array; error?: string; } +export interface AcknowledgementProtoMsg { + typeUrl: "/ibc.core.channel.v1.Acknowledgement"; + value: Uint8Array; +} +/** + * Acknowledgement is the recommended acknowledgement format to be used by + * app-specific protocols. + * NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental + * conflicts with other protobuf message formats used for acknowledgements. + * The first byte of any message with this format will be the non-ASCII values + * `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: + * https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope + */ +export interface AcknowledgementAmino { + result?: string; + error?: string; +} +export interface AcknowledgementAminoMsg { + type: "cosmos-sdk/Acknowledgement"; + value: AcknowledgementAmino; +} /** * Acknowledgement is the recommended acknowledgement format to be used by * app-specific protocols. @@ -428,86 +425,69 @@ export interface Acknowledgement { * `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: * https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope */ - export interface AcknowledgementSDKType { result?: Uint8Array; error?: string; } - function createBaseChannel(): Channel { return { state: 0, ordering: 0, - counterparty: undefined, + counterparty: Counterparty.fromPartial({}), connectionHops: [], version: "" }; } - export const Channel = { - encode(message: Channel, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.Channel", + encode(message: Channel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.state !== 0) { writer.uint32(8).int32(message.state); } - if (message.ordering !== 0) { writer.uint32(16).int32(message.ordering); } - if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); } - for (const v of message.connectionHops) { writer.uint32(34).string(v!); } - if (message.version !== "") { writer.uint32(42).string(message.version); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Channel { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Channel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseChannel(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.state = (reader.int32() as any); break; - case 2: message.ordering = (reader.int32() as any); break; - case 3: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; - case 4: message.connectionHops.push(reader.string()); break; - case 5: message.version = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Channel { + fromPartial(object: Partial): Channel { const message = createBaseChannel(); message.state = object.state ?? 0; message.ordering = object.ordering ?? 0; @@ -515,102 +495,132 @@ export const Channel = { message.connectionHops = object.connectionHops?.map(e => e) || []; message.version = object.version ?? ""; return message; + }, + fromAmino(object: ChannelAmino): Channel { + const message = createBaseChannel(); + if (object.state !== undefined && object.state !== null) { + message.state = stateFromJSON(object.state); + } + if (object.ordering !== undefined && object.ordering !== null) { + message.ordering = orderFromJSON(object.ordering); + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + message.connectionHops = object.connection_hops?.map(e => e) || []; + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + return message; + }, + toAmino(message: Channel): ChannelAmino { + const obj: any = {}; + obj.state = stateToJSON(message.state); + obj.ordering = orderToJSON(message.ordering); + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + if (message.connectionHops) { + obj.connection_hops = message.connectionHops.map(e => e); + } else { + obj.connection_hops = []; + } + obj.version = message.version; + return obj; + }, + fromAminoMsg(object: ChannelAminoMsg): Channel { + return Channel.fromAmino(object.value); + }, + toAminoMsg(message: Channel): ChannelAminoMsg { + return { + type: "cosmos-sdk/Channel", + value: Channel.toAmino(message) + }; + }, + fromProtoMsg(message: ChannelProtoMsg): Channel { + return Channel.decode(message.value); + }, + toProto(message: Channel): Uint8Array { + return Channel.encode(message).finish(); + }, + toProtoMsg(message: Channel): ChannelProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Channel", + value: Channel.encode(message).finish() + }; } - }; - function createBaseIdentifiedChannel(): IdentifiedChannel { return { state: 0, ordering: 0, - counterparty: undefined, + counterparty: Counterparty.fromPartial({}), connectionHops: [], version: "", portId: "", channelId: "" }; } - export const IdentifiedChannel = { - encode(message: IdentifiedChannel, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", + encode(message: IdentifiedChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.state !== 0) { writer.uint32(8).int32(message.state); } - if (message.ordering !== 0) { writer.uint32(16).int32(message.ordering); } - if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); } - for (const v of message.connectionHops) { writer.uint32(34).string(v!); } - if (message.version !== "") { writer.uint32(42).string(message.version); } - if (message.portId !== "") { writer.uint32(50).string(message.portId); } - if (message.channelId !== "") { writer.uint32(58).string(message.channelId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IdentifiedChannel { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedChannel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseIdentifiedChannel(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.state = (reader.int32() as any); break; - case 2: message.ordering = (reader.int32() as any); break; - case 3: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; - case 4: message.connectionHops.push(reader.string()); break; - case 5: message.version = reader.string(); break; - case 6: message.portId = reader.string(); break; - case 7: message.channelId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): IdentifiedChannel { + fromPartial(object: Partial): IdentifiedChannel { const message = createBaseIdentifiedChannel(); message.state = object.state ?? 0; message.ordering = object.ordering ?? 0; @@ -620,306 +630,484 @@ export const IdentifiedChannel = { message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; return message; + }, + fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { + const message = createBaseIdentifiedChannel(); + if (object.state !== undefined && object.state !== null) { + message.state = stateFromJSON(object.state); + } + if (object.ordering !== undefined && object.ordering !== null) { + message.ordering = orderFromJSON(object.ordering); + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + message.connectionHops = object.connection_hops?.map(e => e) || []; + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { + const obj: any = {}; + obj.state = stateToJSON(message.state); + obj.ordering = orderToJSON(message.ordering); + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + if (message.connectionHops) { + obj.connection_hops = message.connectionHops.map(e => e); + } else { + obj.connection_hops = []; + } + obj.version = message.version; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + return obj; + }, + fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { + return IdentifiedChannel.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedChannel): IdentifiedChannelAminoMsg { + return { + type: "cosmos-sdk/IdentifiedChannel", + value: IdentifiedChannel.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedChannelProtoMsg): IdentifiedChannel { + return IdentifiedChannel.decode(message.value); + }, + toProto(message: IdentifiedChannel): Uint8Array { + return IdentifiedChannel.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedChannel): IdentifiedChannelProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", + value: IdentifiedChannel.encode(message).finish() + }; } - }; - function createBaseCounterparty(): Counterparty { return { portId: "", channelId: "" }; } - export const Counterparty = { - encode(message: Counterparty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.Counterparty", + encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Counterparty { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Counterparty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCounterparty(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Counterparty { + fromPartial(object: Partial): Counterparty { const message = createBaseCounterparty(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; return message; + }, + fromAmino(object: CounterpartyAmino): Counterparty { + const message = createBaseCounterparty(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: Counterparty): CounterpartyAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + return obj; + }, + fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { + return Counterparty.fromAmino(object.value); + }, + toAminoMsg(message: Counterparty): CounterpartyAminoMsg { + return { + type: "cosmos-sdk/Counterparty", + value: Counterparty.toAmino(message) + }; + }, + fromProtoMsg(message: CounterpartyProtoMsg): Counterparty { + return Counterparty.decode(message.value); + }, + toProto(message: Counterparty): Uint8Array { + return Counterparty.encode(message).finish(); + }, + toProtoMsg(message: Counterparty): CounterpartyProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Counterparty", + value: Counterparty.encode(message).finish() + }; } - }; - function createBasePacket(): Packet { return { - sequence: Long.UZERO, + sequence: BigInt(0), sourcePort: "", sourceChannel: "", destinationPort: "", destinationChannel: "", data: new Uint8Array(), - timeoutHeight: undefined, - timeoutTimestamp: Long.UZERO + timeoutHeight: Height.fromPartial({}), + timeoutTimestamp: BigInt(0) }; } - export const Packet = { - encode(message: Packet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.sequence.isZero()) { + typeUrl: "/ibc.core.channel.v1.Packet", + encode(message: Packet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.sourcePort !== "") { writer.uint32(18).string(message.sourcePort); } - if (message.sourceChannel !== "") { writer.uint32(26).string(message.sourceChannel); } - if (message.destinationPort !== "") { writer.uint32(34).string(message.destinationPort); } - if (message.destinationChannel !== "") { writer.uint32(42).string(message.destinationChannel); } - if (message.data.length !== 0) { writer.uint32(50).bytes(message.data); } - if (message.timeoutHeight !== undefined) { Height.encode(message.timeoutHeight, writer.uint32(58).fork()).ldelim(); } - - if (!message.timeoutTimestamp.isZero()) { + if (message.timeoutTimestamp !== BigInt(0)) { writer.uint32(64).uint64(message.timeoutTimestamp); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Packet { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Packet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacket(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 2: message.sourcePort = reader.string(); break; - case 3: message.sourceChannel = reader.string(); break; - case 4: message.destinationPort = reader.string(); break; - case 5: message.destinationChannel = reader.string(); break; - case 6: message.data = reader.bytes(); break; - case 7: message.timeoutHeight = Height.decode(reader, reader.uint32()); break; - case 8: - message.timeoutTimestamp = (reader.uint64() as Long); + message.timeoutTimestamp = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Packet { + fromPartial(object: Partial): Packet { const message = createBasePacket(); - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.sourcePort = object.sourcePort ?? ""; message.sourceChannel = object.sourceChannel ?? ""; message.destinationPort = object.destinationPort ?? ""; message.destinationChannel = object.destinationChannel ?? ""; message.data = object.data ?? new Uint8Array(); message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; - message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? Long.fromValue(object.timeoutTimestamp) : Long.UZERO; + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); return message; + }, + fromAmino(object: PacketAmino): Packet { + const message = createBasePacket(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.source_port !== undefined && object.source_port !== null) { + message.sourcePort = object.source_port; + } + if (object.source_channel !== undefined && object.source_channel !== null) { + message.sourceChannel = object.source_channel; + } + if (object.destination_port !== undefined && object.destination_port !== null) { + message.destinationPort = object.destination_port; + } + if (object.destination_channel !== undefined && object.destination_channel !== null) { + message.destinationChannel = object.destination_channel; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = Height.fromAmino(object.timeout_height); + } + if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeout_timestamp); + } + return message; + }, + toAmino(message: Packet): PacketAmino { + const obj: any = {}; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.source_port = message.sourcePort; + obj.source_channel = message.sourceChannel; + obj.destination_port = message.destinationPort; + obj.destination_channel = message.destinationChannel; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; + obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PacketAminoMsg): Packet { + return Packet.fromAmino(object.value); + }, + toAminoMsg(message: Packet): PacketAminoMsg { + return { + type: "cosmos-sdk/Packet", + value: Packet.toAmino(message) + }; + }, + fromProtoMsg(message: PacketProtoMsg): Packet { + return Packet.decode(message.value); + }, + toProto(message: Packet): Uint8Array { + return Packet.encode(message).finish(); + }, + toProtoMsg(message: Packet): PacketProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Packet", + value: Packet.encode(message).finish() + }; } - }; - function createBasePacketState(): PacketState { return { portId: "", channelId: "", - sequence: Long.UZERO, + sequence: BigInt(0), data: new Uint8Array() }; } - export const PacketState = { - encode(message: PacketState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.PacketState", + encode(message: PacketState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } - if (message.data.length !== 0) { writer.uint32(34).bytes(message.data); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PacketState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PacketState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacketState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 4: message.data = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PacketState { + fromPartial(object: Partial): PacketState { const message = createBasePacketState(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.data = object.data ?? new Uint8Array(); return message; + }, + fromAmino(object: PacketStateAmino): PacketState { + const message = createBasePacketState(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: PacketState): PacketStateAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: PacketStateAminoMsg): PacketState { + return PacketState.fromAmino(object.value); + }, + toAminoMsg(message: PacketState): PacketStateAminoMsg { + return { + type: "cosmos-sdk/PacketState", + value: PacketState.toAmino(message) + }; + }, + fromProtoMsg(message: PacketStateProtoMsg): PacketState { + return PacketState.decode(message.value); + }, + toProto(message: PacketState): Uint8Array { + return PacketState.encode(message).finish(); + }, + toProtoMsg(message: PacketState): PacketStateProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.PacketState", + value: PacketState.encode(message).finish() + }; } - }; - function createBaseAcknowledgement(): Acknowledgement { return { result: undefined, error: undefined }; } - export const Acknowledgement = { - encode(message: Acknowledgement, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.Acknowledgement", + encode(message: Acknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== undefined) { writer.uint32(170).bytes(message.result); } - if (message.error !== undefined) { writer.uint32(178).string(message.error); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Acknowledgement { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Acknowledgement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAcknowledgement(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 21: message.result = reader.bytes(); break; - case 22: message.error = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Acknowledgement { + fromPartial(object: Partial): Acknowledgement { const message = createBaseAcknowledgement(); message.result = object.result ?? undefined; message.error = object.error ?? undefined; return message; + }, + fromAmino(object: AcknowledgementAmino): Acknowledgement { + const message = createBaseAcknowledgement(); + if (object.result !== undefined && object.result !== null) { + message.result = bytesFromBase64(object.result); + } + if (object.error !== undefined && object.error !== null) { + message.error = object.error; + } + return message; + }, + toAmino(message: Acknowledgement): AcknowledgementAmino { + const obj: any = {}; + obj.result = message.result ? base64FromBytes(message.result) : undefined; + obj.error = message.error; + return obj; + }, + fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { + return Acknowledgement.fromAmino(object.value); + }, + toAminoMsg(message: Acknowledgement): AcknowledgementAminoMsg { + return { + type: "cosmos-sdk/Acknowledgement", + value: Acknowledgement.toAmino(message) + }; + }, + fromProtoMsg(message: AcknowledgementProtoMsg): Acknowledgement { + return Acknowledgement.decode(message.value); + }, + toProto(message: Acknowledgement): Uint8Array { + return Acknowledgement.encode(message).finish(); + }, + toProtoMsg(message: Acknowledgement): AcknowledgementProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Acknowledgement", + value: Acknowledgement.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/channel/v1/genesis.ts b/src/codegen/ibc/core/channel/v1/genesis.ts index 9fcd674..f7b5503 100644 --- a/src/codegen/ibc/core/channel/v1/genesis.ts +++ b/src/codegen/ibc/core/channel/v1/genesis.ts @@ -1,8 +1,6 @@ -import { IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** GenesisState defines the ibc channel submodule's genesis state. */ - export interface GenesisState { channels: IdentifiedChannel[]; acknowledgements: PacketState[]; @@ -12,11 +10,29 @@ export interface GenesisState { recvSequences: PacketSequence[]; ackSequences: PacketSequence[]; /** the sequence for the next generated channel identifier */ - - nextChannelSequence: Long; + nextChannelSequence: bigint; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.core.channel.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the ibc channel submodule's genesis state. */ +export interface GenesisStateAmino { + channels?: IdentifiedChannelAmino[]; + acknowledgements?: PacketStateAmino[]; + commitments?: PacketStateAmino[]; + receipts?: PacketStateAmino[]; + send_sequences?: PacketSequenceAmino[]; + recv_sequences?: PacketSequenceAmino[]; + ack_sequences?: PacketSequenceAmino[]; + /** the sequence for the next generated channel identifier */ + next_channel_sequence?: string; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; } /** GenesisState defines the ibc channel submodule's genesis state. */ - export interface GenesisStateSDKType { channels: IdentifiedChannelSDKType[]; acknowledgements: PacketStateSDKType[]; @@ -25,31 +41,43 @@ export interface GenesisStateSDKType { send_sequences: PacketSequenceSDKType[]; recv_sequences: PacketSequenceSDKType[]; ack_sequences: PacketSequenceSDKType[]; - /** the sequence for the next generated channel identifier */ - - next_channel_sequence: Long; + next_channel_sequence: bigint; } /** * PacketSequence defines the genesis type necessary to retrieve and store * next send and receive sequences. */ - export interface PacketSequence { portId: string; channelId: string; - sequence: Long; + sequence: bigint; +} +export interface PacketSequenceProtoMsg { + typeUrl: "/ibc.core.channel.v1.PacketSequence"; + value: Uint8Array; +} +/** + * PacketSequence defines the genesis type necessary to retrieve and store + * next send and receive sequences. + */ +export interface PacketSequenceAmino { + port_id?: string; + channel_id?: string; + sequence?: string; +} +export interface PacketSequenceAminoMsg { + type: "cosmos-sdk/PacketSequence"; + value: PacketSequenceAmino; } /** * PacketSequence defines the genesis type necessary to retrieve and store * next send and receive sequences. */ - export interface PacketSequenceSDKType { port_id: string; channel_id: string; - sequence: Long; + sequence: bigint; } - function createBaseGenesisState(): GenesisState { return { channels: [], @@ -59,98 +87,77 @@ function createBaseGenesisState(): GenesisState { sendSequences: [], recvSequences: [], ackSequences: [], - nextChannelSequence: Long.UZERO + nextChannelSequence: BigInt(0) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.acknowledgements) { PacketState.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.commitments) { PacketState.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.receipts) { PacketState.encode(v!, writer.uint32(34).fork()).ldelim(); } - for (const v of message.sendSequences) { PacketSequence.encode(v!, writer.uint32(42).fork()).ldelim(); } - for (const v of message.recvSequences) { PacketSequence.encode(v!, writer.uint32(50).fork()).ldelim(); } - for (const v of message.ackSequences) { PacketSequence.encode(v!, writer.uint32(58).fork()).ldelim(); } - - if (!message.nextChannelSequence.isZero()) { + if (message.nextChannelSequence !== BigInt(0)) { writer.uint32(64).uint64(message.nextChannelSequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.channels.push(IdentifiedChannel.decode(reader, reader.uint32())); break; - case 2: message.acknowledgements.push(PacketState.decode(reader, reader.uint32())); break; - case 3: message.commitments.push(PacketState.decode(reader, reader.uint32())); break; - case 4: message.receipts.push(PacketState.decode(reader, reader.uint32())); break; - case 5: message.sendSequences.push(PacketSequence.decode(reader, reader.uint32())); break; - case 6: message.recvSequences.push(PacketSequence.decode(reader, reader.uint32())); break; - case 7: message.ackSequences.push(PacketSequence.decode(reader, reader.uint32())); break; - case 8: - message.nextChannelSequence = (reader.uint64() as Long); + message.nextChannelSequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromPartial(e)) || []; @@ -159,73 +166,175 @@ export const GenesisState = { message.sendSequences = object.sendSequences?.map(e => PacketSequence.fromPartial(e)) || []; message.recvSequences = object.recvSequences?.map(e => PacketSequence.fromPartial(e)) || []; message.ackSequences = object.ackSequences?.map(e => PacketSequence.fromPartial(e)) || []; - message.nextChannelSequence = object.nextChannelSequence !== undefined && object.nextChannelSequence !== null ? Long.fromValue(object.nextChannelSequence) : Long.UZERO; + message.nextChannelSequence = object.nextChannelSequence !== undefined && object.nextChannelSequence !== null ? BigInt(object.nextChannelSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromAmino(e)) || []; + message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromAmino(e)) || []; + message.commitments = object.commitments?.map(e => PacketState.fromAmino(e)) || []; + message.receipts = object.receipts?.map(e => PacketState.fromAmino(e)) || []; + message.sendSequences = object.send_sequences?.map(e => PacketSequence.fromAmino(e)) || []; + message.recvSequences = object.recv_sequences?.map(e => PacketSequence.fromAmino(e)) || []; + message.ackSequences = object.ack_sequences?.map(e => PacketSequence.fromAmino(e)) || []; + if (object.next_channel_sequence !== undefined && object.next_channel_sequence !== null) { + message.nextChannelSequence = BigInt(object.next_channel_sequence); + } return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); + } else { + obj.channels = []; + } + if (message.acknowledgements) { + obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.acknowledgements = []; + } + if (message.commitments) { + obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.commitments = []; + } + if (message.receipts) { + obj.receipts = message.receipts.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.receipts = []; + } + if (message.sendSequences) { + obj.send_sequences = message.sendSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); + } else { + obj.send_sequences = []; + } + if (message.recvSequences) { + obj.recv_sequences = message.recvSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); + } else { + obj.recv_sequences = []; + } + if (message.ackSequences) { + obj.ack_sequences = message.ackSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); + } else { + obj.ack_sequences = []; + } + obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; - function createBasePacketSequence(): PacketSequence { return { portId: "", channelId: "", - sequence: Long.UZERO + sequence: BigInt(0) }; } - export const PacketSequence = { - encode(message: PacketSequence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.PacketSequence", + encode(message: PacketSequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PacketSequence { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PacketSequence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacketSequence(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PacketSequence { + fromPartial(object: Partial): PacketSequence { const message = createBasePacketSequence(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; + }, + fromAmino(object: PacketSequenceAmino): PacketSequence { + const message = createBasePacketSequence(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: PacketSequence): PacketSequenceAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { + return PacketSequence.fromAmino(object.value); + }, + toAminoMsg(message: PacketSequence): PacketSequenceAminoMsg { + return { + type: "cosmos-sdk/PacketSequence", + value: PacketSequence.toAmino(message) + }; + }, + fromProtoMsg(message: PacketSequenceProtoMsg): PacketSequence { + return PacketSequence.decode(message.value); + }, + toProto(message: PacketSequence): Uint8Array { + return PacketSequence.encode(message).finish(); + }, + toProtoMsg(message: PacketSequence): PacketSequenceProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.PacketSequence", + value: PacketSequence.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/channel/v1/query.lcd.ts b/src/codegen/ibc/core/channel/v1/query.lcd.ts index dad6252..758cdbf 100644 --- a/src/codegen/ibc/core/channel/v1/query.lcd.ts +++ b/src/codegen/ibc/core/channel/v1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryChannelRequest, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -25,141 +24,105 @@ export class LCDQueryClient { this.nextSequenceReceive = this.nextSequenceReceive.bind(this); } /* Channel queries an IBC Channel. */ - - async channel(params: QueryChannelRequest): Promise { - const endpoint = `ibc/core/channel/v1/channels/${params.channelId}ports/${params.portId}`; + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}`; return await this.req.get(endpoint); } /* Channels queries all the IBC channels of a chain. */ - - async channels(params: QueryChannelsRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `ibc/core/channel/v1/channels`; return await this.req.get(endpoint, options); } /* ConnectionChannels queries all the channels associated with a connection end. */ - - async connectionChannels(params: QueryConnectionChannelsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `ibc/core/channel/v1/connections/${params.connection}/channels`; return await this.req.get(endpoint, options); } /* ChannelClientState queries for the client state for the channel associated with the provided channel identifiers. */ - - async channelClientState(params: QueryChannelClientStateRequest): Promise { const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/client_state`; return await this.req.get(endpoint); } /* ChannelConsensusState queries for the consensus state for the channel associated with the provided channel identifiers. */ - - async channelConsensusState(params: QueryChannelConsensusStateRequest): Promise { - const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/consensus_state/revision/${params.revisionNumber}height/${params.revisionHeight}`; + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/consensus_state/revision/${params.revisionNumber}/height/${params.revisionHeight}`; return await this.req.get(endpoint); } /* PacketCommitment queries a stored packet commitment hash. */ - - async packetCommitment(params: QueryPacketCommitmentRequest): Promise { - const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}packet_commitments/${params.sequence}`; + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_commitments/${params.sequence}`; return await this.req.get(endpoint); } /* PacketCommitments returns all the packet commitments hashes associated with a channel. */ - - async packetCommitments(params: QueryPacketCommitmentsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_commitments`; return await this.req.get(endpoint, options); } /* PacketReceipt queries if a given packet sequence has been received on the queried chain */ - - async packetReceipt(params: QueryPacketReceiptRequest): Promise { - const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}packet_receipts/${params.sequence}`; + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_receipts/${params.sequence}`; return await this.req.get(endpoint); } /* PacketAcknowledgement queries a stored packet acknowledgement hash. */ - - async packetAcknowledgement(params: QueryPacketAcknowledgementRequest): Promise { - const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}packet_acks/${params.sequence}`; + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_acks/${params.sequence}`; return await this.req.get(endpoint); } /* PacketAcknowledgements returns all the packet acknowledgements associated with a channel. */ - - async packetAcknowledgements(params: QueryPacketAcknowledgementsRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - if (typeof params?.packetCommitmentSequences !== "undefined") { options.params.packet_commitment_sequences = params.packetCommitmentSequences; } - const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_acknowledgements`; return await this.req.get(endpoint, options); } /* UnreceivedPackets returns all the unreceived IBC packets associated with a channel and sequences. */ - - async unreceivedPackets(params: QueryUnreceivedPacketsRequest): Promise { const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_commitments/${params.packetCommitmentSequences}/unreceived_packets`; return await this.req.get(endpoint); } /* UnreceivedAcks returns all the unreceived IBC acknowledgements associated with a channel and sequences. */ - - async unreceivedAcks(params: QueryUnreceivedAcksRequest): Promise { const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_commitments/${params.packetAckSequences}/unreceived_acks`; return await this.req.get(endpoint); } /* NextSequenceReceive returns the next receive sequence for a given channel. */ - - async nextSequenceReceive(params: QueryNextSequenceReceiveRequest): Promise { const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/next_sequence`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/ibc/core/channel/v1/query.rpc.Query.ts b/src/codegen/ibc/core/channel/v1/query.rpc.Query.ts index 4fbeb5b..72075c5 100644 --- a/src/codegen/ibc/core/channel/v1/query.rpc.Query.ts +++ b/src/codegen/ibc/core/channel/v1/query.rpc.Query.ts @@ -1,76 +1,62 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryChannelRequest, QueryChannelResponse, QueryChannelsRequest, QueryChannelsResponse, QueryConnectionChannelsRequest, QueryConnectionChannelsResponse, QueryChannelClientStateRequest, QueryChannelClientStateResponse, QueryChannelConsensusStateRequest, QueryChannelConsensusStateResponse, QueryPacketCommitmentRequest, QueryPacketCommitmentResponse, QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponse, QueryPacketReceiptRequest, QueryPacketReceiptResponse, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponse, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponse, QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponse, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponse } from "./query"; /** Query provides defines the gRPC querier service */ - export interface Query { /** Channel queries an IBC Channel. */ channel(request: QueryChannelRequest): Promise; /** Channels queries all the IBC channels of a chain. */ - channels(request?: QueryChannelsRequest): Promise; /** * ConnectionChannels queries all the channels associated with a connection * end. */ - connectionChannels(request: QueryConnectionChannelsRequest): Promise; /** * ChannelClientState queries for the client state for the channel associated * with the provided channel identifiers. */ - channelClientState(request: QueryChannelClientStateRequest): Promise; /** * ChannelConsensusState queries for the consensus state for the channel * associated with the provided channel identifiers. */ - channelConsensusState(request: QueryChannelConsensusStateRequest): Promise; /** PacketCommitment queries a stored packet commitment hash. */ - packetCommitment(request: QueryPacketCommitmentRequest): Promise; /** * PacketCommitments returns all the packet commitments hashes associated * with a channel. */ - packetCommitments(request: QueryPacketCommitmentsRequest): Promise; /** * PacketReceipt queries if a given packet sequence has been received on the * queried chain */ - packetReceipt(request: QueryPacketReceiptRequest): Promise; /** PacketAcknowledgement queries a stored packet acknowledgement hash. */ - packetAcknowledgement(request: QueryPacketAcknowledgementRequest): Promise; /** * PacketAcknowledgements returns all the packet acknowledgements associated * with a channel. */ - packetAcknowledgements(request: QueryPacketAcknowledgementsRequest): Promise; /** * UnreceivedPackets returns all the unreceived IBC packets associated with a * channel and sequences. */ - unreceivedPackets(request: QueryUnreceivedPacketsRequest): Promise; /** * UnreceivedAcks returns all the unreceived IBC acknowledgements associated * with a channel and sequences. */ - unreceivedAcks(request: QueryUnreceivedAcksRequest): Promise; /** NextSequenceReceive returns the next receive sequence for a given channel. */ - nextSequenceReceive(request: QueryNextSequenceReceiveRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.channel = this.channel.bind(this); @@ -87,87 +73,73 @@ export class QueryClientImpl implements Query { this.unreceivedAcks = this.unreceivedAcks.bind(this); this.nextSequenceReceive = this.nextSequenceReceive.bind(this); } - channel(request: QueryChannelRequest): Promise { const data = QueryChannelRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "Channel", data); - return promise.then(data => QueryChannelResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryChannelResponse.decode(new BinaryReader(data))); } - channels(request: QueryChannelsRequest = { pagination: undefined }): Promise { const data = QueryChannelsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "Channels", data); - return promise.then(data => QueryChannelsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryChannelsResponse.decode(new BinaryReader(data))); } - connectionChannels(request: QueryConnectionChannelsRequest): Promise { const data = QueryConnectionChannelsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "ConnectionChannels", data); - return promise.then(data => QueryConnectionChannelsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryConnectionChannelsResponse.decode(new BinaryReader(data))); } - channelClientState(request: QueryChannelClientStateRequest): Promise { const data = QueryChannelClientStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "ChannelClientState", data); - return promise.then(data => QueryChannelClientStateResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryChannelClientStateResponse.decode(new BinaryReader(data))); } - channelConsensusState(request: QueryChannelConsensusStateRequest): Promise { const data = QueryChannelConsensusStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "ChannelConsensusState", data); - return promise.then(data => QueryChannelConsensusStateResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryChannelConsensusStateResponse.decode(new BinaryReader(data))); } - packetCommitment(request: QueryPacketCommitmentRequest): Promise { const data = QueryPacketCommitmentRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketCommitment", data); - return promise.then(data => QueryPacketCommitmentResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryPacketCommitmentResponse.decode(new BinaryReader(data))); } - packetCommitments(request: QueryPacketCommitmentsRequest): Promise { const data = QueryPacketCommitmentsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketCommitments", data); - return promise.then(data => QueryPacketCommitmentsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryPacketCommitmentsResponse.decode(new BinaryReader(data))); } - packetReceipt(request: QueryPacketReceiptRequest): Promise { const data = QueryPacketReceiptRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketReceipt", data); - return promise.then(data => QueryPacketReceiptResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryPacketReceiptResponse.decode(new BinaryReader(data))); } - packetAcknowledgement(request: QueryPacketAcknowledgementRequest): Promise { const data = QueryPacketAcknowledgementRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketAcknowledgement", data); - return promise.then(data => QueryPacketAcknowledgementResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryPacketAcknowledgementResponse.decode(new BinaryReader(data))); } - packetAcknowledgements(request: QueryPacketAcknowledgementsRequest): Promise { const data = QueryPacketAcknowledgementsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketAcknowledgements", data); - return promise.then(data => QueryPacketAcknowledgementsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryPacketAcknowledgementsResponse.decode(new BinaryReader(data))); } - unreceivedPackets(request: QueryUnreceivedPacketsRequest): Promise { const data = QueryUnreceivedPacketsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "UnreceivedPackets", data); - return promise.then(data => QueryUnreceivedPacketsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryUnreceivedPacketsResponse.decode(new BinaryReader(data))); } - unreceivedAcks(request: QueryUnreceivedAcksRequest): Promise { const data = QueryUnreceivedAcksRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "UnreceivedAcks", data); - return promise.then(data => QueryUnreceivedAcksResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryUnreceivedAcksResponse.decode(new BinaryReader(data))); } - nextSequenceReceive(request: QueryNextSequenceReceiveRequest): Promise { const data = QueryNextSequenceReceiveRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "NextSequenceReceive", data); - return promise.then(data => QueryNextSequenceReceiveResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryNextSequenceReceiveResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -176,54 +148,41 @@ export const createRpcQueryExtension = (base: QueryClient) => { channel(request: QueryChannelRequest): Promise { return queryService.channel(request); }, - channels(request?: QueryChannelsRequest): Promise { return queryService.channels(request); }, - connectionChannels(request: QueryConnectionChannelsRequest): Promise { return queryService.connectionChannels(request); }, - channelClientState(request: QueryChannelClientStateRequest): Promise { return queryService.channelClientState(request); }, - channelConsensusState(request: QueryChannelConsensusStateRequest): Promise { return queryService.channelConsensusState(request); }, - packetCommitment(request: QueryPacketCommitmentRequest): Promise { return queryService.packetCommitment(request); }, - packetCommitments(request: QueryPacketCommitmentsRequest): Promise { return queryService.packetCommitments(request); }, - packetReceipt(request: QueryPacketReceiptRequest): Promise { return queryService.packetReceipt(request); }, - packetAcknowledgement(request: QueryPacketAcknowledgementRequest): Promise { return queryService.packetAcknowledgement(request); }, - packetAcknowledgements(request: QueryPacketAcknowledgementsRequest): Promise { return queryService.packetAcknowledgements(request); }, - unreceivedPackets(request: QueryUnreceivedPacketsRequest): Promise { return queryService.unreceivedPackets(request); }, - unreceivedAcks(request: QueryUnreceivedAcksRequest): Promise { return queryService.unreceivedAcks(request); }, - nextSequenceReceive(request: QueryNextSequenceReceiveRequest): Promise { return queryService.nextSequenceReceive(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/ibc/core/channel/v1/query.ts b/src/codegen/ibc/core/channel/v1/query.ts index 149f093..f026b34 100644 --- a/src/codegen/ibc/core/channel/v1/query.ts +++ b/src/codegen/ibc/core/channel/v1/query.ts @@ -1,25 +1,34 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelAmino, ChannelSDKType, IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; +import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** QueryChannelRequest is the request type for the Query/Channel RPC method */ - export interface QueryChannelRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; } +export interface QueryChannelRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelRequest"; + value: Uint8Array; +} /** QueryChannelRequest is the request type for the Query/Channel RPC method */ - -export interface QueryChannelRequestSDKType { +export interface QueryChannelRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - + channel_id?: string; +} +export interface QueryChannelRequestAminoMsg { + type: "cosmos-sdk/QueryChannelRequest"; + value: QueryChannelRequestAmino; +} +/** QueryChannelRequest is the request type for the Query/Channel RPC method */ +export interface QueryChannelRequestSDKType { + port_id: string; channel_id: string; } /** @@ -27,1470 +36,2080 @@ export interface QueryChannelRequestSDKType { * Besides the Channel end, it includes a proof and the height from which the * proof was retrieved. */ - export interface QueryChannelResponse { /** channel associated with the request identifiers */ channel?: Channel; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryChannelResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelResponse"; + value: Uint8Array; } /** * QueryChannelResponse is the response type for the Query/Channel RPC method. * Besides the Channel end, it includes a proof and the height from which the * proof was retrieved. */ - -export interface QueryChannelResponseSDKType { +export interface QueryChannelResponseAmino { /** channel associated with the request identifiers */ - channel?: ChannelSDKType; + channel?: ChannelAmino; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryChannelResponseAminoMsg { + type: "cosmos-sdk/QueryChannelResponse"; + value: QueryChannelResponseAmino; +} +/** + * QueryChannelResponse is the response type for the Query/Channel RPC method. + * Besides the Channel end, it includes a proof and the height from which the + * proof was retrieved. + */ +export interface QueryChannelResponseSDKType { + channel?: ChannelSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; } /** QueryChannelsRequest is the request type for the Query/Channels RPC method */ - export interface QueryChannelsRequest { /** pagination request */ pagination?: PageRequest; } +export interface QueryChannelsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest"; + value: Uint8Array; +} /** QueryChannelsRequest is the request type for the Query/Channels RPC method */ - -export interface QueryChannelsRequestSDKType { +export interface QueryChannelsRequestAmino { /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryChannelsRequestAminoMsg { + type: "cosmos-sdk/QueryChannelsRequest"; + value: QueryChannelsRequestAmino; +} +/** QueryChannelsRequest is the request type for the Query/Channels RPC method */ +export interface QueryChannelsRequestSDKType { pagination?: PageRequestSDKType; } /** QueryChannelsResponse is the response type for the Query/Channels RPC method. */ - export interface QueryChannelsResponse { /** list of stored channels of the chain. */ channels: IdentifiedChannel[]; /** pagination response */ - pagination?: PageResponse; /** query block height */ - - height?: Height; + height: Height; +} +export interface QueryChannelsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse"; + value: Uint8Array; } /** QueryChannelsResponse is the response type for the Query/Channels RPC method. */ - -export interface QueryChannelsResponseSDKType { +export interface QueryChannelsResponseAmino { /** list of stored channels of the chain. */ - channels: IdentifiedChannelSDKType[]; + channels?: IdentifiedChannelAmino[]; /** pagination response */ - - pagination?: PageResponseSDKType; + pagination?: PageResponseAmino; /** query block height */ - - height?: HeightSDKType; + height?: HeightAmino; +} +export interface QueryChannelsResponseAminoMsg { + type: "cosmos-sdk/QueryChannelsResponse"; + value: QueryChannelsResponseAmino; +} +/** QueryChannelsResponse is the response type for the Query/Channels RPC method. */ +export interface QueryChannelsResponseSDKType { + channels: IdentifiedChannelSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; } /** * QueryConnectionChannelsRequest is the request type for the * Query/QueryConnectionChannels RPC method */ - export interface QueryConnectionChannelsRequest { /** connection unique identifier */ connection: string; /** pagination request */ - pagination?: PageRequest; } +export interface QueryConnectionChannelsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest"; + value: Uint8Array; +} /** * QueryConnectionChannelsRequest is the request type for the * Query/QueryConnectionChannels RPC method */ - -export interface QueryConnectionChannelsRequestSDKType { +export interface QueryConnectionChannelsRequestAmino { /** connection unique identifier */ - connection: string; + connection?: string; /** pagination request */ - + pagination?: PageRequestAmino; +} +export interface QueryConnectionChannelsRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionChannelsRequest"; + value: QueryConnectionChannelsRequestAmino; +} +/** + * QueryConnectionChannelsRequest is the request type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsRequestSDKType { + connection: string; pagination?: PageRequestSDKType; } /** * QueryConnectionChannelsResponse is the Response type for the * Query/QueryConnectionChannels RPC method */ - export interface QueryConnectionChannelsResponse { /** list of channels associated with a connection. */ channels: IdentifiedChannel[]; /** pagination response */ - pagination?: PageResponse; /** query block height */ - - height?: Height; + height: Height; +} +export interface QueryConnectionChannelsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse"; + value: Uint8Array; } /** * QueryConnectionChannelsResponse is the Response type for the * Query/QueryConnectionChannels RPC method */ - -export interface QueryConnectionChannelsResponseSDKType { +export interface QueryConnectionChannelsResponseAmino { /** list of channels associated with a connection. */ - channels: IdentifiedChannelSDKType[]; + channels?: IdentifiedChannelAmino[]; /** pagination response */ - - pagination?: PageResponseSDKType; + pagination?: PageResponseAmino; /** query block height */ - - height?: HeightSDKType; + height?: HeightAmino; +} +export interface QueryConnectionChannelsResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionChannelsResponse"; + value: QueryConnectionChannelsResponseAmino; +} +/** + * QueryConnectionChannelsResponse is the Response type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsResponseSDKType { + channels: IdentifiedChannelSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; } /** * QueryChannelClientStateRequest is the request type for the Query/ClientState * RPC method */ - export interface QueryChannelClientStateRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; } +export interface QueryChannelClientStateRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest"; + value: Uint8Array; +} /** * QueryChannelClientStateRequest is the request type for the Query/ClientState * RPC method */ - -export interface QueryChannelClientStateRequestSDKType { +export interface QueryChannelClientStateRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - + channel_id?: string; +} +export interface QueryChannelClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryChannelClientStateRequest"; + value: QueryChannelClientStateRequestAmino; +} +/** + * QueryChannelClientStateRequest is the request type for the Query/ClientState + * RPC method + */ +export interface QueryChannelClientStateRequestSDKType { + port_id: string; channel_id: string; } /** * QueryChannelClientStateResponse is the Response type for the * Query/QueryChannelClientState RPC method */ - export interface QueryChannelClientStateResponse { /** client state associated with the channel */ identifiedClientState?: IdentifiedClientState; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryChannelClientStateResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse"; + value: Uint8Array; } /** * QueryChannelClientStateResponse is the Response type for the * Query/QueryChannelClientState RPC method */ - -export interface QueryChannelClientStateResponseSDKType { +export interface QueryChannelClientStateResponseAmino { /** client state associated with the channel */ - identified_client_state?: IdentifiedClientStateSDKType; + identified_client_state?: IdentifiedClientStateAmino; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryChannelClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryChannelClientStateResponse"; + value: QueryChannelClientStateResponseAmino; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelClientStateResponseSDKType { + identified_client_state?: IdentifiedClientStateSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryChannelConsensusStateRequest is the request type for the * Query/ConsensusState RPC method */ - export interface QueryChannelConsensusStateRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; /** revision number of the consensus state */ - - revisionNumber: Long; + revisionNumber: bigint; /** revision height of the consensus state */ - - revisionHeight: Long; + revisionHeight: bigint; +} +export interface QueryChannelConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest"; + value: Uint8Array; } /** * QueryChannelConsensusStateRequest is the request type for the * Query/ConsensusState RPC method */ - -export interface QueryChannelConsensusStateRequestSDKType { +export interface QueryChannelConsensusStateRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - - channel_id: string; + channel_id?: string; /** revision number of the consensus state */ - - revision_number: Long; + revision_number?: string; /** revision height of the consensus state */ - - revision_height: Long; + revision_height?: string; +} +export interface QueryChannelConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryChannelConsensusStateRequest"; + value: QueryChannelConsensusStateRequestAmino; +} +/** + * QueryChannelConsensusStateRequest is the request type for the + * Query/ConsensusState RPC method + */ +export interface QueryChannelConsensusStateRequestSDKType { + port_id: string; + channel_id: string; + revision_number: bigint; + revision_height: bigint; } /** * QueryChannelClientStateResponse is the Response type for the * Query/QueryChannelClientState RPC method */ - export interface QueryChannelConsensusStateResponse { /** consensus state associated with the channel */ consensusState?: Any; /** client ID associated with the consensus state */ - clientId: string; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryChannelConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse"; + value: Uint8Array; } /** * QueryChannelClientStateResponse is the Response type for the * Query/QueryChannelClientState RPC method */ - -export interface QueryChannelConsensusStateResponseSDKType { +export interface QueryChannelConsensusStateResponseAmino { /** consensus state associated with the channel */ - consensus_state?: AnySDKType; + consensus_state?: AnyAmino; /** client ID associated with the consensus state */ - - client_id: string; + client_id?: string; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryChannelConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryChannelConsensusStateResponse"; + value: QueryChannelConsensusStateResponseAmino; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + client_id: string; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryPacketCommitmentRequest is the request type for the * Query/PacketCommitment RPC method */ - export interface QueryPacketCommitmentRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; /** packet sequence */ - - sequence: Long; + sequence: bigint; +} +export interface QueryPacketCommitmentRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest"; + value: Uint8Array; } /** * QueryPacketCommitmentRequest is the request type for the * Query/PacketCommitment RPC method */ - -export interface QueryPacketCommitmentRequestSDKType { +export interface QueryPacketCommitmentRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - - channel_id: string; + channel_id?: string; /** packet sequence */ - - sequence: Long; + sequence?: string; +} +export interface QueryPacketCommitmentRequestAminoMsg { + type: "cosmos-sdk/QueryPacketCommitmentRequest"; + value: QueryPacketCommitmentRequestAmino; +} +/** + * QueryPacketCommitmentRequest is the request type for the + * Query/PacketCommitment RPC method + */ +export interface QueryPacketCommitmentRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; } /** * QueryPacketCommitmentResponse defines the client query response for a packet * which also includes a proof and the height from which the proof was * retrieved */ - export interface QueryPacketCommitmentResponse { /** packet associated with the request fields */ commitment: Uint8Array; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryPacketCommitmentResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse"; + value: Uint8Array; } /** * QueryPacketCommitmentResponse defines the client query response for a packet * which also includes a proof and the height from which the proof was * retrieved */ - -export interface QueryPacketCommitmentResponseSDKType { +export interface QueryPacketCommitmentResponseAmino { /** packet associated with the request fields */ - commitment: Uint8Array; + commitment?: string; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryPacketCommitmentResponseAminoMsg { + type: "cosmos-sdk/QueryPacketCommitmentResponse"; + value: QueryPacketCommitmentResponseAmino; +} +/** + * QueryPacketCommitmentResponse defines the client query response for a packet + * which also includes a proof and the height from which the proof was + * retrieved + */ +export interface QueryPacketCommitmentResponseSDKType { + commitment: Uint8Array; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryPacketCommitmentsRequest is the request type for the * Query/QueryPacketCommitments RPC method */ - export interface QueryPacketCommitmentsRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; /** pagination request */ - pagination?: PageRequest; } +export interface QueryPacketCommitmentsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest"; + value: Uint8Array; +} /** * QueryPacketCommitmentsRequest is the request type for the * Query/QueryPacketCommitments RPC method */ - -export interface QueryPacketCommitmentsRequestSDKType { +export interface QueryPacketCommitmentsRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - - channel_id: string; + channel_id?: string; /** pagination request */ - + pagination?: PageRequestAmino; +} +export interface QueryPacketCommitmentsRequestAminoMsg { + type: "cosmos-sdk/QueryPacketCommitmentsRequest"; + value: QueryPacketCommitmentsRequestAmino; +} +/** + * QueryPacketCommitmentsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsRequestSDKType { + port_id: string; + channel_id: string; pagination?: PageRequestSDKType; } /** * QueryPacketCommitmentsResponse is the request type for the * Query/QueryPacketCommitments RPC method */ - export interface QueryPacketCommitmentsResponse { commitments: PacketState[]; /** pagination response */ - pagination?: PageResponse; /** query block height */ - - height?: Height; + height: Height; +} +export interface QueryPacketCommitmentsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse"; + value: Uint8Array; +} +/** + * QueryPacketCommitmentsResponse is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsResponseAmino { + commitments?: PacketStateAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; + /** query block height */ + height?: HeightAmino; +} +export interface QueryPacketCommitmentsResponseAminoMsg { + type: "cosmos-sdk/QueryPacketCommitmentsResponse"; + value: QueryPacketCommitmentsResponseAmino; } /** * QueryPacketCommitmentsResponse is the request type for the * Query/QueryPacketCommitments RPC method */ - export interface QueryPacketCommitmentsResponseSDKType { commitments: PacketStateSDKType[]; - /** pagination response */ - pagination?: PageResponseSDKType; - /** query block height */ - - height?: HeightSDKType; + height: HeightSDKType; } /** * QueryPacketReceiptRequest is the request type for the * Query/PacketReceipt RPC method */ - export interface QueryPacketReceiptRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; /** packet sequence */ - - sequence: Long; + sequence: bigint; +} +export interface QueryPacketReceiptRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest"; + value: Uint8Array; } /** * QueryPacketReceiptRequest is the request type for the * Query/PacketReceipt RPC method */ - -export interface QueryPacketReceiptRequestSDKType { +export interface QueryPacketReceiptRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - - channel_id: string; + channel_id?: string; /** packet sequence */ - - sequence: Long; + sequence?: string; +} +export interface QueryPacketReceiptRequestAminoMsg { + type: "cosmos-sdk/QueryPacketReceiptRequest"; + value: QueryPacketReceiptRequestAmino; +} +/** + * QueryPacketReceiptRequest is the request type for the + * Query/PacketReceipt RPC method + */ +export interface QueryPacketReceiptRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; } /** * QueryPacketReceiptResponse defines the client query response for a packet * receipt which also includes a proof, and the height from which the proof was * retrieved */ - export interface QueryPacketReceiptResponse { /** success flag for if receipt exists */ received: boolean; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryPacketReceiptResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse"; + value: Uint8Array; } /** * QueryPacketReceiptResponse defines the client query response for a packet * receipt which also includes a proof, and the height from which the proof was * retrieved */ - -export interface QueryPacketReceiptResponseSDKType { +export interface QueryPacketReceiptResponseAmino { /** success flag for if receipt exists */ - received: boolean; + received?: boolean; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryPacketReceiptResponseAminoMsg { + type: "cosmos-sdk/QueryPacketReceiptResponse"; + value: QueryPacketReceiptResponseAmino; +} +/** + * QueryPacketReceiptResponse defines the client query response for a packet + * receipt which also includes a proof, and the height from which the proof was + * retrieved + */ +export interface QueryPacketReceiptResponseSDKType { + received: boolean; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryPacketAcknowledgementRequest is the request type for the * Query/PacketAcknowledgement RPC method */ - export interface QueryPacketAcknowledgementRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; /** packet sequence */ - - sequence: Long; + sequence: bigint; +} +export interface QueryPacketAcknowledgementRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest"; + value: Uint8Array; } /** * QueryPacketAcknowledgementRequest is the request type for the * Query/PacketAcknowledgement RPC method */ - -export interface QueryPacketAcknowledgementRequestSDKType { +export interface QueryPacketAcknowledgementRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - - channel_id: string; + channel_id?: string; /** packet sequence */ - - sequence: Long; + sequence?: string; +} +export interface QueryPacketAcknowledgementRequestAminoMsg { + type: "cosmos-sdk/QueryPacketAcknowledgementRequest"; + value: QueryPacketAcknowledgementRequestAmino; +} +/** + * QueryPacketAcknowledgementRequest is the request type for the + * Query/PacketAcknowledgement RPC method + */ +export interface QueryPacketAcknowledgementRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; } /** * QueryPacketAcknowledgementResponse defines the client query response for a * packet which also includes a proof and the height from which the * proof was retrieved */ - export interface QueryPacketAcknowledgementResponse { /** packet associated with the request fields */ acknowledgement: Uint8Array; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryPacketAcknowledgementResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse"; + value: Uint8Array; } /** * QueryPacketAcknowledgementResponse defines the client query response for a * packet which also includes a proof and the height from which the * proof was retrieved */ - -export interface QueryPacketAcknowledgementResponseSDKType { +export interface QueryPacketAcknowledgementResponseAmino { /** packet associated with the request fields */ - acknowledgement: Uint8Array; + acknowledgement?: string; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryPacketAcknowledgementResponseAminoMsg { + type: "cosmos-sdk/QueryPacketAcknowledgementResponse"; + value: QueryPacketAcknowledgementResponseAmino; +} +/** + * QueryPacketAcknowledgementResponse defines the client query response for a + * packet which also includes a proof and the height from which the + * proof was retrieved + */ +export interface QueryPacketAcknowledgementResponseSDKType { + acknowledgement: Uint8Array; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryPacketAcknowledgementsRequest is the request type for the * Query/QueryPacketCommitments RPC method */ - export interface QueryPacketAcknowledgementsRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; /** pagination request */ - pagination?: PageRequest; /** list of packet sequences */ - - packetCommitmentSequences: Long[]; + packetCommitmentSequences: bigint[]; +} +export interface QueryPacketAcknowledgementsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest"; + value: Uint8Array; } /** * QueryPacketAcknowledgementsRequest is the request type for the * Query/QueryPacketCommitments RPC method */ - -export interface QueryPacketAcknowledgementsRequestSDKType { +export interface QueryPacketAcknowledgementsRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - - channel_id: string; + channel_id?: string; /** pagination request */ - - pagination?: PageRequestSDKType; + pagination?: PageRequestAmino; /** list of packet sequences */ - - packet_commitment_sequences: Long[]; + packet_commitment_sequences?: string[]; +} +export interface QueryPacketAcknowledgementsRequestAminoMsg { + type: "cosmos-sdk/QueryPacketAcknowledgementsRequest"; + value: QueryPacketAcknowledgementsRequestAmino; +} +/** + * QueryPacketAcknowledgementsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketAcknowledgementsRequestSDKType { + port_id: string; + channel_id: string; + pagination?: PageRequestSDKType; + packet_commitment_sequences: bigint[]; } /** * QueryPacketAcknowledgemetsResponse is the request type for the * Query/QueryPacketAcknowledgements RPC method */ - export interface QueryPacketAcknowledgementsResponse { acknowledgements: PacketState[]; /** pagination response */ - pagination?: PageResponse; /** query block height */ - - height?: Height; + height: Height; +} +export interface QueryPacketAcknowledgementsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse"; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgemetsResponse is the request type for the + * Query/QueryPacketAcknowledgements RPC method + */ +export interface QueryPacketAcknowledgementsResponseAmino { + acknowledgements?: PacketStateAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; + /** query block height */ + height?: HeightAmino; +} +export interface QueryPacketAcknowledgementsResponseAminoMsg { + type: "cosmos-sdk/QueryPacketAcknowledgementsResponse"; + value: QueryPacketAcknowledgementsResponseAmino; } /** * QueryPacketAcknowledgemetsResponse is the request type for the * Query/QueryPacketAcknowledgements RPC method */ - export interface QueryPacketAcknowledgementsResponseSDKType { acknowledgements: PacketStateSDKType[]; - /** pagination response */ - pagination?: PageResponseSDKType; - /** query block height */ - - height?: HeightSDKType; + height: HeightSDKType; } /** * QueryUnreceivedPacketsRequest is the request type for the * Query/UnreceivedPackets RPC method */ - export interface QueryUnreceivedPacketsRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; /** list of packet sequences */ - - packetCommitmentSequences: Long[]; + packetCommitmentSequences: bigint[]; +} +export interface QueryUnreceivedPacketsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest"; + value: Uint8Array; } /** * QueryUnreceivedPacketsRequest is the request type for the * Query/UnreceivedPackets RPC method */ - -export interface QueryUnreceivedPacketsRequestSDKType { +export interface QueryUnreceivedPacketsRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - - channel_id: string; + channel_id?: string; /** list of packet sequences */ - - packet_commitment_sequences: Long[]; + packet_commitment_sequences?: string[]; +} +export interface QueryUnreceivedPacketsRequestAminoMsg { + type: "cosmos-sdk/QueryUnreceivedPacketsRequest"; + value: QueryUnreceivedPacketsRequestAmino; +} +/** + * QueryUnreceivedPacketsRequest is the request type for the + * Query/UnreceivedPackets RPC method + */ +export interface QueryUnreceivedPacketsRequestSDKType { + port_id: string; + channel_id: string; + packet_commitment_sequences: bigint[]; } /** * QueryUnreceivedPacketsResponse is the response type for the * Query/UnreceivedPacketCommitments RPC method */ - export interface QueryUnreceivedPacketsResponse { /** list of unreceived packet sequences */ - sequences: Long[]; + sequences: bigint[]; /** query block height */ - - height?: Height; + height: Height; +} +export interface QueryUnreceivedPacketsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse"; + value: Uint8Array; } /** * QueryUnreceivedPacketsResponse is the response type for the * Query/UnreceivedPacketCommitments RPC method */ - -export interface QueryUnreceivedPacketsResponseSDKType { +export interface QueryUnreceivedPacketsResponseAmino { /** list of unreceived packet sequences */ - sequences: Long[]; + sequences?: string[]; /** query block height */ - - height?: HeightSDKType; + height?: HeightAmino; +} +export interface QueryUnreceivedPacketsResponseAminoMsg { + type: "cosmos-sdk/QueryUnreceivedPacketsResponse"; + value: QueryUnreceivedPacketsResponseAmino; +} +/** + * QueryUnreceivedPacketsResponse is the response type for the + * Query/UnreceivedPacketCommitments RPC method + */ +export interface QueryUnreceivedPacketsResponseSDKType { + sequences: bigint[]; + height: HeightSDKType; } /** * QueryUnreceivedAcks is the request type for the * Query/UnreceivedAcks RPC method */ - export interface QueryUnreceivedAcksRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; /** list of acknowledgement sequences */ - - packetAckSequences: Long[]; + packetAckSequences: bigint[]; +} +export interface QueryUnreceivedAcksRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest"; + value: Uint8Array; } /** * QueryUnreceivedAcks is the request type for the * Query/UnreceivedAcks RPC method */ - -export interface QueryUnreceivedAcksRequestSDKType { +export interface QueryUnreceivedAcksRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - - channel_id: string; + channel_id?: string; /** list of acknowledgement sequences */ - - packet_ack_sequences: Long[]; + packet_ack_sequences?: string[]; +} +export interface QueryUnreceivedAcksRequestAminoMsg { + type: "cosmos-sdk/QueryUnreceivedAcksRequest"; + value: QueryUnreceivedAcksRequestAmino; +} +/** + * QueryUnreceivedAcks is the request type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksRequestSDKType { + port_id: string; + channel_id: string; + packet_ack_sequences: bigint[]; } /** * QueryUnreceivedAcksResponse is the response type for the * Query/UnreceivedAcks RPC method */ - export interface QueryUnreceivedAcksResponse { /** list of unreceived acknowledgement sequences */ - sequences: Long[]; + sequences: bigint[]; /** query block height */ - - height?: Height; + height: Height; +} +export interface QueryUnreceivedAcksResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse"; + value: Uint8Array; } /** * QueryUnreceivedAcksResponse is the response type for the * Query/UnreceivedAcks RPC method */ - -export interface QueryUnreceivedAcksResponseSDKType { +export interface QueryUnreceivedAcksResponseAmino { /** list of unreceived acknowledgement sequences */ - sequences: Long[]; + sequences?: string[]; /** query block height */ - - height?: HeightSDKType; + height?: HeightAmino; +} +export interface QueryUnreceivedAcksResponseAminoMsg { + type: "cosmos-sdk/QueryUnreceivedAcksResponse"; + value: QueryUnreceivedAcksResponseAmino; +} +/** + * QueryUnreceivedAcksResponse is the response type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksResponseSDKType { + sequences: bigint[]; + height: HeightSDKType; } /** * QueryNextSequenceReceiveRequest is the request type for the * Query/QueryNextSequenceReceiveRequest RPC method */ - export interface QueryNextSequenceReceiveRequest { /** port unique identifier */ portId: string; /** channel unique identifier */ - channelId: string; } +export interface QueryNextSequenceReceiveRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest"; + value: Uint8Array; +} /** * QueryNextSequenceReceiveRequest is the request type for the * Query/QueryNextSequenceReceiveRequest RPC method */ - -export interface QueryNextSequenceReceiveRequestSDKType { +export interface QueryNextSequenceReceiveRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** channel unique identifier */ - + channel_id?: string; +} +export interface QueryNextSequenceReceiveRequestAminoMsg { + type: "cosmos-sdk/QueryNextSequenceReceiveRequest"; + value: QueryNextSequenceReceiveRequestAmino; +} +/** + * QueryNextSequenceReceiveRequest is the request type for the + * Query/QueryNextSequenceReceiveRequest RPC method + */ +export interface QueryNextSequenceReceiveRequestSDKType { + port_id: string; channel_id: string; } /** * QuerySequenceResponse is the request type for the * Query/QueryNextSequenceReceiveResponse RPC method */ - export interface QueryNextSequenceReceiveResponse { /** next sequence receive number */ - nextSequenceReceive: Long; + nextSequenceReceive: bigint; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryNextSequenceReceiveResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse"; + value: Uint8Array; } /** * QuerySequenceResponse is the request type for the * Query/QueryNextSequenceReceiveResponse RPC method */ - -export interface QueryNextSequenceReceiveResponseSDKType { +export interface QueryNextSequenceReceiveResponseAmino { /** next sequence receive number */ - next_sequence_receive: Long; + next_sequence_receive?: string; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryNextSequenceReceiveResponseAminoMsg { + type: "cosmos-sdk/QueryNextSequenceReceiveResponse"; + value: QueryNextSequenceReceiveResponseAmino; +} +/** + * QuerySequenceResponse is the request type for the + * Query/QueryNextSequenceReceiveResponse RPC method + */ +export interface QueryNextSequenceReceiveResponseSDKType { + next_sequence_receive: bigint; + proof: Uint8Array; + proof_height: HeightSDKType; } - function createBaseQueryChannelRequest(): QueryChannelRequest { return { portId: "", channelId: "" }; } - export const QueryChannelRequest = { - encode(message: QueryChannelRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", + encode(message: QueryChannelRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryChannelRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryChannelRequest { + fromPartial(object: Partial): QueryChannelRequest { const message = createBaseQueryChannelRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; return message; + }, + fromAmino(object: QueryChannelRequestAmino): QueryChannelRequest { + const message = createBaseQueryChannelRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + return obj; + }, + fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { + return QueryChannelRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelRequest): QueryChannelRequestAminoMsg { + return { + type: "cosmos-sdk/QueryChannelRequest", + value: QueryChannelRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelRequestProtoMsg): QueryChannelRequest { + return QueryChannelRequest.decode(message.value); + }, + toProto(message: QueryChannelRequest): Uint8Array { + return QueryChannelRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelRequest): QueryChannelRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", + value: QueryChannelRequest.encode(message).finish() + }; } - }; - function createBaseQueryChannelResponse(): QueryChannelResponse { return { channel: undefined, proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryChannelResponse = { - encode(message: QueryChannelResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", + encode(message: QueryChannelResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(10).fork()).ldelim(); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryChannelResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.channel = Channel.decode(reader, reader.uint32()); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryChannelResponse { + fromPartial(object: Partial): QueryChannelResponse { const message = createBaseQueryChannelResponse(); message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryChannelResponseAmino): QueryChannelResponse { + const message = createBaseQueryChannelResponse(); + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryChannelResponse): QueryChannelResponseAmino { + const obj: any = {}; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryChannelResponseAminoMsg): QueryChannelResponse { + return QueryChannelResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelResponse): QueryChannelResponseAminoMsg { + return { + type: "cosmos-sdk/QueryChannelResponse", + value: QueryChannelResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelResponseProtoMsg): QueryChannelResponse { + return QueryChannelResponse.decode(message.value); + }, + toProto(message: QueryChannelResponse): Uint8Array { + return QueryChannelResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelResponse): QueryChannelResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", + value: QueryChannelResponse.encode(message).finish() + }; } - }; - function createBaseQueryChannelsRequest(): QueryChannelsRequest { return { pagination: undefined }; } - export const QueryChannelsRequest = { - encode(message: QueryChannelsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", + encode(message: QueryChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryChannelsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryChannelsRequest { + fromPartial(object: Partial): QueryChannelsRequest { const message = createBaseQueryChannelsRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryChannelsRequestAmino): QueryChannelsRequest { + const message = createBaseQueryChannelsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryChannelsRequest): QueryChannelsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryChannelsRequestAminoMsg): QueryChannelsRequest { + return QueryChannelsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelsRequest): QueryChannelsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryChannelsRequest", + value: QueryChannelsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelsRequestProtoMsg): QueryChannelsRequest { + return QueryChannelsRequest.decode(message.value); + }, + toProto(message: QueryChannelsRequest): Uint8Array { + return QueryChannelsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelsRequest): QueryChannelsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", + value: QueryChannelsRequest.encode(message).finish() + }; } - }; - function createBaseQueryChannelsResponse(): QueryChannelsResponse { return { channels: [], pagination: undefined, - height: undefined + height: Height.fromPartial({}) }; } - export const QueryChannelsResponse = { - encode(message: QueryChannelsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", + encode(message: QueryChannelsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - if (message.height !== undefined) { Height.encode(message.height, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryChannelsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.channels.push(IdentifiedChannel.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - case 3: message.height = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryChannelsResponse { + fromPartial(object: Partial): QueryChannelsResponse { const message = createBaseQueryChannelsResponse(); message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; + }, + fromAmino(object: QueryChannelsResponseAmino): QueryChannelsResponse { + const message = createBaseQueryChannelsResponse(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryChannelsResponse): QueryChannelsResponseAmino { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); + } else { + obj.channels = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryChannelsResponseAminoMsg): QueryChannelsResponse { + return QueryChannelsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelsResponse): QueryChannelsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryChannelsResponse", + value: QueryChannelsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelsResponseProtoMsg): QueryChannelsResponse { + return QueryChannelsResponse.decode(message.value); + }, + toProto(message: QueryChannelsResponse): Uint8Array { + return QueryChannelsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelsResponse): QueryChannelsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", + value: QueryChannelsResponse.encode(message).finish() + }; } - }; - function createBaseQueryConnectionChannelsRequest(): QueryConnectionChannelsRequest { return { connection: "", pagination: undefined }; } - export const QueryConnectionChannelsRequest = { - encode(message: QueryConnectionChannelsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", + encode(message: QueryConnectionChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connection !== "") { writer.uint32(10).string(message.connection); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionChannelsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionChannelsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionChannelsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connection = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionChannelsRequest { + fromPartial(object: Partial): QueryConnectionChannelsRequest { const message = createBaseQueryConnectionChannelsRequest(); message.connection = object.connection ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryConnectionChannelsRequestAmino): QueryConnectionChannelsRequest { + const message = createBaseQueryConnectionChannelsRequest(); + if (object.connection !== undefined && object.connection !== null) { + message.connection = object.connection; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { + const obj: any = {}; + obj.connection = message.connection; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConnectionChannelsRequestAminoMsg): QueryConnectionChannelsRequest { + return QueryConnectionChannelsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionChannelsRequest", + value: QueryConnectionChannelsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionChannelsRequestProtoMsg): QueryConnectionChannelsRequest { + return QueryConnectionChannelsRequest.decode(message.value); + }, + toProto(message: QueryConnectionChannelsRequest): Uint8Array { + return QueryConnectionChannelsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", + value: QueryConnectionChannelsRequest.encode(message).finish() + }; } - }; - function createBaseQueryConnectionChannelsResponse(): QueryConnectionChannelsResponse { return { channels: [], pagination: undefined, - height: undefined + height: Height.fromPartial({}) }; } - export const QueryConnectionChannelsResponse = { - encode(message: QueryConnectionChannelsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", + encode(message: QueryConnectionChannelsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - if (message.height !== undefined) { Height.encode(message.height, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionChannelsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionChannelsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionChannelsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.channels.push(IdentifiedChannel.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - case 3: message.height = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionChannelsResponse { + fromPartial(object: Partial): QueryConnectionChannelsResponse { const message = createBaseQueryConnectionChannelsResponse(); message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; + }, + fromAmino(object: QueryConnectionChannelsResponseAmino): QueryConnectionChannelsResponse { + const message = createBaseQueryConnectionChannelsResponse(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryConnectionChannelsResponse): QueryConnectionChannelsResponseAmino { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); + } else { + obj.channels = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionChannelsResponseAminoMsg): QueryConnectionChannelsResponse { + return QueryConnectionChannelsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionChannelsResponse): QueryConnectionChannelsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionChannelsResponse", + value: QueryConnectionChannelsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionChannelsResponseProtoMsg): QueryConnectionChannelsResponse { + return QueryConnectionChannelsResponse.decode(message.value); + }, + toProto(message: QueryConnectionChannelsResponse): Uint8Array { + return QueryConnectionChannelsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionChannelsResponse): QueryConnectionChannelsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", + value: QueryConnectionChannelsResponse.encode(message).finish() + }; } - }; - function createBaseQueryChannelClientStateRequest(): QueryChannelClientStateRequest { return { portId: "", channelId: "" }; } - export const QueryChannelClientStateRequest = { - encode(message: QueryChannelClientStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", + encode(message: QueryChannelClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelClientStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelClientStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryChannelClientStateRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryChannelClientStateRequest { + fromPartial(object: Partial): QueryChannelClientStateRequest { const message = createBaseQueryChannelClientStateRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; return message; + }, + fromAmino(object: QueryChannelClientStateRequestAmino): QueryChannelClientStateRequest { + const message = createBaseQueryChannelClientStateRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + return obj; + }, + fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { + return QueryChannelClientStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryChannelClientStateRequest", + value: QueryChannelClientStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelClientStateRequestProtoMsg): QueryChannelClientStateRequest { + return QueryChannelClientStateRequest.decode(message.value); + }, + toProto(message: QueryChannelClientStateRequest): Uint8Array { + return QueryChannelClientStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", + value: QueryChannelClientStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryChannelClientStateResponse(): QueryChannelClientStateResponse { return { identifiedClientState: undefined, proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryChannelClientStateResponse = { - encode(message: QueryChannelClientStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", + encode(message: QueryChannelClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifiedClientState !== undefined) { IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelClientStateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelClientStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryChannelClientStateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.identifiedClientState = IdentifiedClientState.decode(reader, reader.uint32()); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryChannelClientStateResponse { + fromPartial(object: Partial): QueryChannelClientStateResponse { const message = createBaseQueryChannelClientStateResponse(); message.identifiedClientState = object.identifiedClientState !== undefined && object.identifiedClientState !== null ? IdentifiedClientState.fromPartial(object.identifiedClientState) : undefined; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryChannelClientStateResponseAmino): QueryChannelClientStateResponse { + const message = createBaseQueryChannelClientStateResponse(); + if (object.identified_client_state !== undefined && object.identified_client_state !== null) { + message.identifiedClientState = IdentifiedClientState.fromAmino(object.identified_client_state); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryChannelClientStateResponse): QueryChannelClientStateResponseAmino { + const obj: any = {}; + obj.identified_client_state = message.identifiedClientState ? IdentifiedClientState.toAmino(message.identifiedClientState) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryChannelClientStateResponseAminoMsg): QueryChannelClientStateResponse { + return QueryChannelClientStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelClientStateResponse): QueryChannelClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryChannelClientStateResponse", + value: QueryChannelClientStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelClientStateResponseProtoMsg): QueryChannelClientStateResponse { + return QueryChannelClientStateResponse.decode(message.value); + }, + toProto(message: QueryChannelClientStateResponse): Uint8Array { + return QueryChannelClientStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelClientStateResponse): QueryChannelClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", + value: QueryChannelClientStateResponse.encode(message).finish() + }; } - }; - function createBaseQueryChannelConsensusStateRequest(): QueryChannelConsensusStateRequest { return { portId: "", channelId: "", - revisionNumber: Long.UZERO, - revisionHeight: Long.UZERO + revisionNumber: BigInt(0), + revisionHeight: BigInt(0) }; } - export const QueryChannelConsensusStateRequest = { - encode(message: QueryChannelConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", + encode(message: QueryChannelConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - - if (!message.revisionNumber.isZero()) { + if (message.revisionNumber !== BigInt(0)) { writer.uint32(24).uint64(message.revisionNumber); } - - if (!message.revisionHeight.isZero()) { + if (message.revisionHeight !== BigInt(0)) { writer.uint32(32).uint64(message.revisionHeight); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelConsensusStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryChannelConsensusStateRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: - message.revisionNumber = (reader.uint64() as Long); + message.revisionNumber = reader.uint64(); break; - case 4: - message.revisionHeight = (reader.uint64() as Long); + message.revisionHeight = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryChannelConsensusStateRequest { + fromPartial(object: Partial): QueryChannelConsensusStateRequest { const message = createBaseQueryChannelConsensusStateRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? Long.fromValue(object.revisionNumber) : Long.UZERO; - message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? Long.fromValue(object.revisionHeight) : Long.UZERO; + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryChannelConsensusStateRequestAmino): QueryChannelConsensusStateRequest { + const message = createBaseQueryChannelConsensusStateRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.revision_number !== undefined && object.revision_number !== null) { + message.revisionNumber = BigInt(object.revision_number); + } + if (object.revision_height !== undefined && object.revision_height !== null) { + message.revisionHeight = BigInt(object.revision_height); + } return message; + }, + toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { + return QueryChannelConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryChannelConsensusStateRequest", + value: QueryChannelConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelConsensusStateRequestProtoMsg): QueryChannelConsensusStateRequest { + return QueryChannelConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryChannelConsensusStateRequest): Uint8Array { + return QueryChannelConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", + value: QueryChannelConsensusStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryChannelConsensusStateResponse(): QueryChannelConsensusStateResponse { return { consensusState: undefined, clientId: "", proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryChannelConsensusStateResponse = { - encode(message: QueryChannelConsensusStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", + encode(message: QueryChannelConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); } - if (message.clientId !== "") { writer.uint32(18).string(message.clientId); } - if (message.proof.length !== 0) { writer.uint32(26).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelConsensusStateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryChannelConsensusStateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.consensusState = Any.decode(reader, reader.uint32()); break; - case 2: message.clientId = reader.string(); break; - case 3: message.proof = reader.bytes(); break; - case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryChannelConsensusStateResponse { + fromPartial(object: Partial): QueryChannelConsensusStateResponse { const message = createBaseQueryChannelConsensusStateResponse(); message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.clientId = object.clientId ?? ""; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryChannelConsensusStateResponseAmino): QueryChannelConsensusStateResponse { + const message = createBaseQueryChannelConsensusStateResponse(); + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { + const obj: any = {}; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.client_id = message.clientId; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryChannelConsensusStateResponseAminoMsg): QueryChannelConsensusStateResponse { + return QueryChannelConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryChannelConsensusStateResponse", + value: QueryChannelConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelConsensusStateResponseProtoMsg): QueryChannelConsensusStateResponse { + return QueryChannelConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryChannelConsensusStateResponse): Uint8Array { + return QueryChannelConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", + value: QueryChannelConsensusStateResponse.encode(message).finish() + }; } - }; - function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest { return { portId: "", channelId: "", - sequence: Long.UZERO + sequence: BigInt(0) }; } - export const QueryPacketCommitmentRequest = { - encode(message: QueryPacketCommitmentRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", + encode(message: QueryPacketCommitmentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketCommitmentRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketCommitmentRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketCommitmentRequest { + fromPartial(object: Partial): QueryPacketCommitmentRequest { const message = createBaseQueryPacketCommitmentRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryPacketCommitmentRequestAmino): QueryPacketCommitmentRequest { + const message = createBaseQueryPacketCommitmentRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } return message; + }, + toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { + return QueryPacketCommitmentRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketCommitmentRequest", + value: QueryPacketCommitmentRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketCommitmentRequestProtoMsg): QueryPacketCommitmentRequest { + return QueryPacketCommitmentRequest.decode(message.value); + }, + toProto(message: QueryPacketCommitmentRequest): Uint8Array { + return QueryPacketCommitmentRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", + value: QueryPacketCommitmentRequest.encode(message).finish() + }; } - }; - function createBaseQueryPacketCommitmentResponse(): QueryPacketCommitmentResponse { return { commitment: new Uint8Array(), proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryPacketCommitmentResponse = { - encode(message: QueryPacketCommitmentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", + encode(message: QueryPacketCommitmentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commitment.length !== 0) { writer.uint32(10).bytes(message.commitment); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketCommitmentResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketCommitmentResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.commitment = reader.bytes(); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketCommitmentResponse { + fromPartial(object: Partial): QueryPacketCommitmentResponse { const message = createBaseQueryPacketCommitmentResponse(); message.commitment = object.commitment ?? new Uint8Array(); message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryPacketCommitmentResponseAmino): QueryPacketCommitmentResponse { + const message = createBaseQueryPacketCommitmentResponse(); + if (object.commitment !== undefined && object.commitment !== null) { + message.commitment = bytesFromBase64(object.commitment); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryPacketCommitmentResponse): QueryPacketCommitmentResponseAmino { + const obj: any = {}; + obj.commitment = message.commitment ? base64FromBytes(message.commitment) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketCommitmentResponseAminoMsg): QueryPacketCommitmentResponse { + return QueryPacketCommitmentResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketCommitmentResponse): QueryPacketCommitmentResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketCommitmentResponse", + value: QueryPacketCommitmentResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketCommitmentResponseProtoMsg): QueryPacketCommitmentResponse { + return QueryPacketCommitmentResponse.decode(message.value); + }, + toProto(message: QueryPacketCommitmentResponse): Uint8Array { + return QueryPacketCommitmentResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketCommitmentResponse): QueryPacketCommitmentResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", + value: QueryPacketCommitmentResponse.encode(message).finish() + }; } - }; - function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsRequest { return { portId: "", @@ -1498,389 +2117,559 @@ function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsReques pagination: undefined }; } - export const QueryPacketCommitmentsRequest = { - encode(message: QueryPacketCommitmentsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", + encode(message: QueryPacketCommitmentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketCommitmentsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketCommitmentsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketCommitmentsRequest { + fromPartial(object: Partial): QueryPacketCommitmentsRequest { const message = createBaseQueryPacketCommitmentsRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryPacketCommitmentsRequestAmino): QueryPacketCommitmentsRequest { + const message = createBaseQueryPacketCommitmentsRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryPacketCommitmentsRequestAminoMsg): QueryPacketCommitmentsRequest { + return QueryPacketCommitmentsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketCommitmentsRequest", + value: QueryPacketCommitmentsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketCommitmentsRequestProtoMsg): QueryPacketCommitmentsRequest { + return QueryPacketCommitmentsRequest.decode(message.value); + }, + toProto(message: QueryPacketCommitmentsRequest): Uint8Array { + return QueryPacketCommitmentsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", + value: QueryPacketCommitmentsRequest.encode(message).finish() + }; } - }; - function createBaseQueryPacketCommitmentsResponse(): QueryPacketCommitmentsResponse { return { commitments: [], pagination: undefined, - height: undefined + height: Height.fromPartial({}) }; } - export const QueryPacketCommitmentsResponse = { - encode(message: QueryPacketCommitmentsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", + encode(message: QueryPacketCommitmentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.commitments) { PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - if (message.height !== undefined) { Height.encode(message.height, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketCommitmentsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketCommitmentsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.commitments.push(PacketState.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - case 3: message.height = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketCommitmentsResponse { + fromPartial(object: Partial): QueryPacketCommitmentsResponse { const message = createBaseQueryPacketCommitmentsResponse(); message.commitments = object.commitments?.map(e => PacketState.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; + }, + fromAmino(object: QueryPacketCommitmentsResponseAmino): QueryPacketCommitmentsResponse { + const message = createBaseQueryPacketCommitmentsResponse(); + message.commitments = object.commitments?.map(e => PacketState.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryPacketCommitmentsResponse): QueryPacketCommitmentsResponseAmino { + const obj: any = {}; + if (message.commitments) { + obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.commitments = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketCommitmentsResponseAminoMsg): QueryPacketCommitmentsResponse { + return QueryPacketCommitmentsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketCommitmentsResponse): QueryPacketCommitmentsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketCommitmentsResponse", + value: QueryPacketCommitmentsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketCommitmentsResponseProtoMsg): QueryPacketCommitmentsResponse { + return QueryPacketCommitmentsResponse.decode(message.value); + }, + toProto(message: QueryPacketCommitmentsResponse): Uint8Array { + return QueryPacketCommitmentsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketCommitmentsResponse): QueryPacketCommitmentsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", + value: QueryPacketCommitmentsResponse.encode(message).finish() + }; } - }; - function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { return { portId: "", channelId: "", - sequence: Long.UZERO + sequence: BigInt(0) }; } - export const QueryPacketReceiptRequest = { - encode(message: QueryPacketReceiptRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", + encode(message: QueryPacketReceiptRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketReceiptRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketReceiptRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketReceiptRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketReceiptRequest { + fromPartial(object: Partial): QueryPacketReceiptRequest { const message = createBaseQueryPacketReceiptRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryPacketReceiptRequestAmino): QueryPacketReceiptRequest { + const message = createBaseQueryPacketReceiptRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { + return QueryPacketReceiptRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketReceiptRequest", + value: QueryPacketReceiptRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketReceiptRequestProtoMsg): QueryPacketReceiptRequest { + return QueryPacketReceiptRequest.decode(message.value); + }, + toProto(message: QueryPacketReceiptRequest): Uint8Array { + return QueryPacketReceiptRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", + value: QueryPacketReceiptRequest.encode(message).finish() + }; } - }; - function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { return { received: false, proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryPacketReceiptResponse = { - encode(message: QueryPacketReceiptResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", + encode(message: QueryPacketReceiptResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.received === true) { writer.uint32(16).bool(message.received); } - if (message.proof.length !== 0) { writer.uint32(26).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketReceiptResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketReceiptResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketReceiptResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 2: message.received = reader.bool(); break; - case 3: message.proof = reader.bytes(); break; - case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketReceiptResponse { + fromPartial(object: Partial): QueryPacketReceiptResponse { const message = createBaseQueryPacketReceiptResponse(); message.received = object.received ?? false; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryPacketReceiptResponseAmino): QueryPacketReceiptResponse { + const message = createBaseQueryPacketReceiptResponse(); + if (object.received !== undefined && object.received !== null) { + message.received = object.received; + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { + const obj: any = {}; + obj.received = message.received; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketReceiptResponseAminoMsg): QueryPacketReceiptResponse { + return QueryPacketReceiptResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketReceiptResponse", + value: QueryPacketReceiptResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketReceiptResponseProtoMsg): QueryPacketReceiptResponse { + return QueryPacketReceiptResponse.decode(message.value); + }, + toProto(message: QueryPacketReceiptResponse): Uint8Array { + return QueryPacketReceiptResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", + value: QueryPacketReceiptResponse.encode(message).finish() + }; } - }; - function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgementRequest { return { portId: "", channelId: "", - sequence: Long.UZERO + sequence: BigInt(0) }; } - export const QueryPacketAcknowledgementRequest = { - encode(message: QueryPacketAcknowledgementRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", + encode(message: QueryPacketAcknowledgementRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketAcknowledgementRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketAcknowledgementRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketAcknowledgementRequest { + fromPartial(object: Partial): QueryPacketAcknowledgementRequest { const message = createBaseQueryPacketAcknowledgementRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryPacketAcknowledgementRequestAmino): QueryPacketAcknowledgementRequest { + const message = createBaseQueryPacketAcknowledgementRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { + return QueryPacketAcknowledgementRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketAcknowledgementRequest", + value: QueryPacketAcknowledgementRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketAcknowledgementRequestProtoMsg): QueryPacketAcknowledgementRequest { + return QueryPacketAcknowledgementRequest.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementRequest): Uint8Array { + return QueryPacketAcknowledgementRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", + value: QueryPacketAcknowledgementRequest.encode(message).finish() + }; } - }; - function createBaseQueryPacketAcknowledgementResponse(): QueryPacketAcknowledgementResponse { return { acknowledgement: new Uint8Array(), proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryPacketAcknowledgementResponse = { - encode(message: QueryPacketAcknowledgementResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", + encode(message: QueryPacketAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.acknowledgement.length !== 0) { writer.uint32(10).bytes(message.acknowledgement); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketAcknowledgementResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketAcknowledgementResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.acknowledgement = reader.bytes(); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketAcknowledgementResponse { + fromPartial(object: Partial): QueryPacketAcknowledgementResponse { const message = createBaseQueryPacketAcknowledgementResponse(); message.acknowledgement = object.acknowledgement ?? new Uint8Array(); message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryPacketAcknowledgementResponseAmino): QueryPacketAcknowledgementResponse { + const message = createBaseQueryPacketAcknowledgementResponse(); + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = bytesFromBase64(object.acknowledgement); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryPacketAcknowledgementResponse): QueryPacketAcknowledgementResponseAmino { + const obj: any = {}; + obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketAcknowledgementResponseAminoMsg): QueryPacketAcknowledgementResponse { + return QueryPacketAcknowledgementResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketAcknowledgementResponse): QueryPacketAcknowledgementResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketAcknowledgementResponse", + value: QueryPacketAcknowledgementResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketAcknowledgementResponseProtoMsg): QueryPacketAcknowledgementResponse { + return QueryPacketAcknowledgementResponse.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementResponse): Uint8Array { + return QueryPacketAcknowledgementResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketAcknowledgementResponse): QueryPacketAcknowledgementResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", + value: QueryPacketAcknowledgementResponse.encode(message).finish() + }; } - }; - function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgementsRequest { return { portId: "", @@ -1889,150 +2678,209 @@ function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgem packetCommitmentSequences: [] }; } - export const QueryPacketAcknowledgementsRequest = { - encode(message: QueryPacketAcknowledgementsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", + encode(message: QueryPacketAcknowledgementsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); } - writer.uint32(34).fork(); - for (const v of message.packetCommitmentSequences) { writer.uint64(v); } - writer.ldelim(); return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketAcknowledgementsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketAcknowledgementsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - case 4: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.packetCommitmentSequences.push((reader.uint64() as Long)); + message.packetCommitmentSequences.push(reader.uint64()); } } else { - message.packetCommitmentSequences.push((reader.uint64() as Long)); + message.packetCommitmentSequences.push(reader.uint64()); } - break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketAcknowledgementsRequest { + fromPartial(object: Partial): QueryPacketAcknowledgementsRequest { const message = createBaseQueryPacketAcknowledgementsRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; - message.packetCommitmentSequences = object.packetCommitmentSequences?.map(e => Long.fromValue(e)) || []; + message.packetCommitmentSequences = object.packetCommitmentSequences?.map(e => BigInt(e.toString())) || []; return message; + }, + fromAmino(object: QueryPacketAcknowledgementsRequestAmino): QueryPacketAcknowledgementsRequest { + const message = createBaseQueryPacketAcknowledgementsRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + message.packetCommitmentSequences = object.packet_commitment_sequences?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + if (message.packetCommitmentSequences) { + obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); + } else { + obj.packet_commitment_sequences = []; + } + return obj; + }, + fromAminoMsg(object: QueryPacketAcknowledgementsRequestAminoMsg): QueryPacketAcknowledgementsRequest { + return QueryPacketAcknowledgementsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketAcknowledgementsRequest", + value: QueryPacketAcknowledgementsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketAcknowledgementsRequestProtoMsg): QueryPacketAcknowledgementsRequest { + return QueryPacketAcknowledgementsRequest.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementsRequest): Uint8Array { + return QueryPacketAcknowledgementsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", + value: QueryPacketAcknowledgementsRequest.encode(message).finish() + }; } - }; - function createBaseQueryPacketAcknowledgementsResponse(): QueryPacketAcknowledgementsResponse { return { acknowledgements: [], pagination: undefined, - height: undefined + height: Height.fromPartial({}) }; } - export const QueryPacketAcknowledgementsResponse = { - encode(message: QueryPacketAcknowledgementsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", + encode(message: QueryPacketAcknowledgementsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.acknowledgements) { PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - if (message.height !== undefined) { Height.encode(message.height, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketAcknowledgementsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryPacketAcknowledgementsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.acknowledgements.push(PacketState.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - case 3: message.height = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryPacketAcknowledgementsResponse { + fromPartial(object: Partial): QueryPacketAcknowledgementsResponse { const message = createBaseQueryPacketAcknowledgementsResponse(); message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; + }, + fromAmino(object: QueryPacketAcknowledgementsResponseAmino): QueryPacketAcknowledgementsResponse { + const message = createBaseQueryPacketAcknowledgementsResponse(); + message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryPacketAcknowledgementsResponse): QueryPacketAcknowledgementsResponseAmino { + const obj: any = {}; + if (message.acknowledgements) { + obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.acknowledgements = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketAcknowledgementsResponseAminoMsg): QueryPacketAcknowledgementsResponse { + return QueryPacketAcknowledgementsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketAcknowledgementsResponse): QueryPacketAcknowledgementsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketAcknowledgementsResponse", + value: QueryPacketAcknowledgementsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketAcknowledgementsResponseProtoMsg): QueryPacketAcknowledgementsResponse { + return QueryPacketAcknowledgementsResponse.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementsResponse): Uint8Array { + return QueryPacketAcknowledgementsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketAcknowledgementsResponse): QueryPacketAcknowledgementsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", + value: QueryPacketAcknowledgementsResponse.encode(message).finish() + }; } - }; - function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsRequest { return { portId: "", @@ -2040,144 +2888,195 @@ function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsReques packetCommitmentSequences: [] }; } - export const QueryUnreceivedPacketsRequest = { - encode(message: QueryUnreceivedPacketsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", + encode(message: QueryUnreceivedPacketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - writer.uint32(26).fork(); - for (const v of message.packetCommitmentSequences) { writer.uint64(v); } - writer.ldelim(); return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnreceivedPacketsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedPacketsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUnreceivedPacketsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.packetCommitmentSequences.push((reader.uint64() as Long)); + message.packetCommitmentSequences.push(reader.uint64()); } } else { - message.packetCommitmentSequences.push((reader.uint64() as Long)); + message.packetCommitmentSequences.push(reader.uint64()); } - break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUnreceivedPacketsRequest { + fromPartial(object: Partial): QueryUnreceivedPacketsRequest { const message = createBaseQueryUnreceivedPacketsRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - message.packetCommitmentSequences = object.packetCommitmentSequences?.map(e => Long.fromValue(e)) || []; + message.packetCommitmentSequences = object.packetCommitmentSequences?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: QueryUnreceivedPacketsRequestAmino): QueryUnreceivedPacketsRequest { + const message = createBaseQueryUnreceivedPacketsRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + message.packetCommitmentSequences = object.packet_commitment_sequences?.map(e => BigInt(e)) || []; return message; + }, + toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + if (message.packetCommitmentSequences) { + obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); + } else { + obj.packet_commitment_sequences = []; + } + return obj; + }, + fromAminoMsg(object: QueryUnreceivedPacketsRequestAminoMsg): QueryUnreceivedPacketsRequest { + return QueryUnreceivedPacketsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUnreceivedPacketsRequest", + value: QueryUnreceivedPacketsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnreceivedPacketsRequestProtoMsg): QueryUnreceivedPacketsRequest { + return QueryUnreceivedPacketsRequest.decode(message.value); + }, + toProto(message: QueryUnreceivedPacketsRequest): Uint8Array { + return QueryUnreceivedPacketsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", + value: QueryUnreceivedPacketsRequest.encode(message).finish() + }; } - }; - function createBaseQueryUnreceivedPacketsResponse(): QueryUnreceivedPacketsResponse { return { sequences: [], - height: undefined + height: Height.fromPartial({}) }; } - export const QueryUnreceivedPacketsResponse = { - encode(message: QueryUnreceivedPacketsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", + encode(message: QueryUnreceivedPacketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); - for (const v of message.sequences) { writer.uint64(v); } - writer.ldelim(); - if (message.height !== undefined) { Height.encode(message.height, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnreceivedPacketsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedPacketsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUnreceivedPacketsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.sequences.push((reader.uint64() as Long)); + message.sequences.push(reader.uint64()); } } else { - message.sequences.push((reader.uint64() as Long)); + message.sequences.push(reader.uint64()); } - break; - case 2: message.height = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUnreceivedPacketsResponse { + fromPartial(object: Partial): QueryUnreceivedPacketsResponse { const message = createBaseQueryUnreceivedPacketsResponse(); - message.sequences = object.sequences?.map(e => Long.fromValue(e)) || []; + message.sequences = object.sequences?.map(e => BigInt(e.toString())) || []; message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; + }, + fromAmino(object: QueryUnreceivedPacketsResponseAmino): QueryUnreceivedPacketsResponse { + const message = createBaseQueryUnreceivedPacketsResponse(); + message.sequences = object.sequences?.map(e => BigInt(e)) || []; + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryUnreceivedPacketsResponse): QueryUnreceivedPacketsResponseAmino { + const obj: any = {}; + if (message.sequences) { + obj.sequences = message.sequences.map(e => e.toString()); + } else { + obj.sequences = []; + } + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryUnreceivedPacketsResponseAminoMsg): QueryUnreceivedPacketsResponse { + return QueryUnreceivedPacketsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnreceivedPacketsResponse): QueryUnreceivedPacketsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUnreceivedPacketsResponse", + value: QueryUnreceivedPacketsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnreceivedPacketsResponseProtoMsg): QueryUnreceivedPacketsResponse { + return QueryUnreceivedPacketsResponse.decode(message.value); + }, + toProto(message: QueryUnreceivedPacketsResponse): Uint8Array { + return QueryUnreceivedPacketsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUnreceivedPacketsResponse): QueryUnreceivedPacketsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", + value: QueryUnreceivedPacketsResponse.encode(message).finish() + }; } - }; - function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { return { portId: "", @@ -2185,260 +3084,366 @@ function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { packetAckSequences: [] }; } - export const QueryUnreceivedAcksRequest = { - encode(message: QueryUnreceivedAcksRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", + encode(message: QueryUnreceivedAcksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - writer.uint32(26).fork(); - for (const v of message.packetAckSequences) { writer.uint64(v); } - writer.ldelim(); return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnreceivedAcksRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedAcksRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUnreceivedAcksRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.packetAckSequences.push((reader.uint64() as Long)); + message.packetAckSequences.push(reader.uint64()); } } else { - message.packetAckSequences.push((reader.uint64() as Long)); + message.packetAckSequences.push(reader.uint64()); } - break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUnreceivedAcksRequest { + fromPartial(object: Partial): QueryUnreceivedAcksRequest { const message = createBaseQueryUnreceivedAcksRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - message.packetAckSequences = object.packetAckSequences?.map(e => Long.fromValue(e)) || []; + message.packetAckSequences = object.packetAckSequences?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: QueryUnreceivedAcksRequestAmino): QueryUnreceivedAcksRequest { + const message = createBaseQueryUnreceivedAcksRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + message.packetAckSequences = object.packet_ack_sequences?.map(e => BigInt(e)) || []; return message; + }, + toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + if (message.packetAckSequences) { + obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); + } else { + obj.packet_ack_sequences = []; + } + return obj; + }, + fromAminoMsg(object: QueryUnreceivedAcksRequestAminoMsg): QueryUnreceivedAcksRequest { + return QueryUnreceivedAcksRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUnreceivedAcksRequest", + value: QueryUnreceivedAcksRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnreceivedAcksRequestProtoMsg): QueryUnreceivedAcksRequest { + return QueryUnreceivedAcksRequest.decode(message.value); + }, + toProto(message: QueryUnreceivedAcksRequest): Uint8Array { + return QueryUnreceivedAcksRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", + value: QueryUnreceivedAcksRequest.encode(message).finish() + }; } - }; - function createBaseQueryUnreceivedAcksResponse(): QueryUnreceivedAcksResponse { return { sequences: [], - height: undefined + height: Height.fromPartial({}) }; } - export const QueryUnreceivedAcksResponse = { - encode(message: QueryUnreceivedAcksResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", + encode(message: QueryUnreceivedAcksResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); - for (const v of message.sequences) { writer.uint64(v); } - writer.ldelim(); - if (message.height !== undefined) { Height.encode(message.height, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnreceivedAcksResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedAcksResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUnreceivedAcksResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.sequences.push((reader.uint64() as Long)); + message.sequences.push(reader.uint64()); } } else { - message.sequences.push((reader.uint64() as Long)); + message.sequences.push(reader.uint64()); } - break; - case 2: message.height = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUnreceivedAcksResponse { + fromPartial(object: Partial): QueryUnreceivedAcksResponse { const message = createBaseQueryUnreceivedAcksResponse(); - message.sequences = object.sequences?.map(e => Long.fromValue(e)) || []; + message.sequences = object.sequences?.map(e => BigInt(e.toString())) || []; message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; + }, + fromAmino(object: QueryUnreceivedAcksResponseAmino): QueryUnreceivedAcksResponse { + const message = createBaseQueryUnreceivedAcksResponse(); + message.sequences = object.sequences?.map(e => BigInt(e)) || []; + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryUnreceivedAcksResponse): QueryUnreceivedAcksResponseAmino { + const obj: any = {}; + if (message.sequences) { + obj.sequences = message.sequences.map(e => e.toString()); + } else { + obj.sequences = []; + } + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryUnreceivedAcksResponseAminoMsg): QueryUnreceivedAcksResponse { + return QueryUnreceivedAcksResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnreceivedAcksResponse): QueryUnreceivedAcksResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUnreceivedAcksResponse", + value: QueryUnreceivedAcksResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnreceivedAcksResponseProtoMsg): QueryUnreceivedAcksResponse { + return QueryUnreceivedAcksResponse.decode(message.value); + }, + toProto(message: QueryUnreceivedAcksResponse): Uint8Array { + return QueryUnreceivedAcksResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUnreceivedAcksResponse): QueryUnreceivedAcksResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", + value: QueryUnreceivedAcksResponse.encode(message).finish() + }; } - }; - function createBaseQueryNextSequenceReceiveRequest(): QueryNextSequenceReceiveRequest { return { portId: "", channelId: "" }; } - export const QueryNextSequenceReceiveRequest = { - encode(message: QueryNextSequenceReceiveRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", + encode(message: QueryNextSequenceReceiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNextSequenceReceiveRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextSequenceReceiveRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryNextSequenceReceiveRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryNextSequenceReceiveRequest { + fromPartial(object: Partial): QueryNextSequenceReceiveRequest { const message = createBaseQueryNextSequenceReceiveRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; return message; + }, + fromAmino(object: QueryNextSequenceReceiveRequestAmino): QueryNextSequenceReceiveRequest { + const message = createBaseQueryNextSequenceReceiveRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + return obj; + }, + fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { + return QueryNextSequenceReceiveRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAminoMsg { + return { + type: "cosmos-sdk/QueryNextSequenceReceiveRequest", + value: QueryNextSequenceReceiveRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryNextSequenceReceiveRequestProtoMsg): QueryNextSequenceReceiveRequest { + return QueryNextSequenceReceiveRequest.decode(message.value); + }, + toProto(message: QueryNextSequenceReceiveRequest): Uint8Array { + return QueryNextSequenceReceiveRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", + value: QueryNextSequenceReceiveRequest.encode(message).finish() + }; } - }; - function createBaseQueryNextSequenceReceiveResponse(): QueryNextSequenceReceiveResponse { return { - nextSequenceReceive: Long.UZERO, + nextSequenceReceive: BigInt(0), proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryNextSequenceReceiveResponse = { - encode(message: QueryNextSequenceReceiveResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.nextSequenceReceive.isZero()) { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", + encode(message: QueryNextSequenceReceiveResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.nextSequenceReceive !== BigInt(0)) { writer.uint32(8).uint64(message.nextSequenceReceive); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryNextSequenceReceiveResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextSequenceReceiveResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryNextSequenceReceiveResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.nextSequenceReceive = (reader.uint64() as Long); + message.nextSequenceReceive = reader.uint64(); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryNextSequenceReceiveResponse { + fromPartial(object: Partial): QueryNextSequenceReceiveResponse { const message = createBaseQueryNextSequenceReceiveResponse(); - message.nextSequenceReceive = object.nextSequenceReceive !== undefined && object.nextSequenceReceive !== null ? Long.fromValue(object.nextSequenceReceive) : Long.UZERO; + message.nextSequenceReceive = object.nextSequenceReceive !== undefined && object.nextSequenceReceive !== null ? BigInt(object.nextSequenceReceive.toString()) : BigInt(0); message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryNextSequenceReceiveResponseAmino): QueryNextSequenceReceiveResponse { + const message = createBaseQueryNextSequenceReceiveResponse(); + if (object.next_sequence_receive !== undefined && object.next_sequence_receive !== null) { + message.nextSequenceReceive = BigInt(object.next_sequence_receive); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { + const obj: any = {}; + obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryNextSequenceReceiveResponseAminoMsg): QueryNextSequenceReceiveResponse { + return QueryNextSequenceReceiveResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAminoMsg { + return { + type: "cosmos-sdk/QueryNextSequenceReceiveResponse", + value: QueryNextSequenceReceiveResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryNextSequenceReceiveResponseProtoMsg): QueryNextSequenceReceiveResponse { + return QueryNextSequenceReceiveResponse.decode(message.value); + }, + toProto(message: QueryNextSequenceReceiveResponse): Uint8Array { + return QueryNextSequenceReceiveResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", + value: QueryNextSequenceReceiveResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/channel/v1/tx.amino.ts b/src/codegen/ibc/core/channel/v1/tx.amino.ts index 51cd3b0..0884ce7 100644 --- a/src/codegen/ibc/core/channel/v1/tx.amino.ts +++ b/src/codegen/ibc/core/channel/v1/tx.amino.ts @@ -1,670 +1,53 @@ -import { stateFromJSON, orderFromJSON } from "./channel"; -import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, omitDefault, Long } from "../../../../helpers"; import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement } from "./tx"; -export interface AminoMsgChannelOpenInit extends AminoMsg { - type: "cosmos-sdk/MsgChannelOpenInit"; - value: { - port_id: string; - channel: { - state: number; - ordering: number; - counterparty: { - port_id: string; - channel_id: string; - }; - connection_hops: string[]; - version: string; - }; - signer: string; - }; -} -export interface AminoMsgChannelOpenTry extends AminoMsg { - type: "cosmos-sdk/MsgChannelOpenTry"; - value: { - port_id: string; - previous_channel_id: string; - channel: { - state: number; - ordering: number; - counterparty: { - port_id: string; - channel_id: string; - }; - connection_hops: string[]; - version: string; - }; - counterparty_version: string; - proof_init: Uint8Array; - proof_height: AminoHeight; - signer: string; - }; -} -export interface AminoMsgChannelOpenAck extends AminoMsg { - type: "cosmos-sdk/MsgChannelOpenAck"; - value: { - port_id: string; - channel_id: string; - counterparty_channel_id: string; - counterparty_version: string; - proof_try: Uint8Array; - proof_height: AminoHeight; - signer: string; - }; -} -export interface AminoMsgChannelOpenConfirm extends AminoMsg { - type: "cosmos-sdk/MsgChannelOpenConfirm"; - value: { - port_id: string; - channel_id: string; - proof_ack: Uint8Array; - proof_height: AminoHeight; - signer: string; - }; -} -export interface AminoMsgChannelCloseInit extends AminoMsg { - type: "cosmos-sdk/MsgChannelCloseInit"; - value: { - port_id: string; - channel_id: string; - signer: string; - }; -} -export interface AminoMsgChannelCloseConfirm extends AminoMsg { - type: "cosmos-sdk/MsgChannelCloseConfirm"; - value: { - port_id: string; - channel_id: string; - proof_init: Uint8Array; - proof_height: AminoHeight; - signer: string; - }; -} -export interface AminoMsgRecvPacket extends AminoMsg { - type: "cosmos-sdk/MsgRecvPacket"; - value: { - packet: { - sequence: string; - source_port: string; - source_channel: string; - destination_port: string; - destination_channel: string; - data: Uint8Array; - timeout_height: AminoHeight; - timeout_timestamp: string; - }; - proof_commitment: Uint8Array; - proof_height: AminoHeight; - signer: string; - }; -} -export interface AminoMsgTimeout extends AminoMsg { - type: "cosmos-sdk/MsgTimeout"; - value: { - packet: { - sequence: string; - source_port: string; - source_channel: string; - destination_port: string; - destination_channel: string; - data: Uint8Array; - timeout_height: AminoHeight; - timeout_timestamp: string; - }; - proof_unreceived: Uint8Array; - proof_height: AminoHeight; - next_sequence_recv: string; - signer: string; - }; -} -export interface AminoMsgTimeoutOnClose extends AminoMsg { - type: "cosmos-sdk/MsgTimeoutOnClose"; - value: { - packet: { - sequence: string; - source_port: string; - source_channel: string; - destination_port: string; - destination_channel: string; - data: Uint8Array; - timeout_height: AminoHeight; - timeout_timestamp: string; - }; - proof_unreceived: Uint8Array; - proof_close: Uint8Array; - proof_height: AminoHeight; - next_sequence_recv: string; - signer: string; - }; -} -export interface AminoMsgAcknowledgement extends AminoMsg { - type: "cosmos-sdk/MsgAcknowledgement"; - value: { - packet: { - sequence: string; - source_port: string; - source_channel: string; - destination_port: string; - destination_channel: string; - data: Uint8Array; - timeout_height: AminoHeight; - timeout_timestamp: string; - }; - acknowledgement: Uint8Array; - proof_acked: Uint8Array; - proof_height: AminoHeight; - signer: string; - }; -} export const AminoConverter = { "/ibc.core.channel.v1.MsgChannelOpenInit": { aminoType: "cosmos-sdk/MsgChannelOpenInit", - toAmino: ({ - portId, - channel, - signer - }: MsgChannelOpenInit): AminoMsgChannelOpenInit["value"] => { - return { - port_id: portId, - channel: { - state: channel.state, - ordering: channel.ordering, - counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId - }, - connection_hops: channel.connectionHops, - version: channel.version - }, - signer - }; - }, - fromAmino: ({ - port_id, - channel, - signer - }: AminoMsgChannelOpenInit["value"]): MsgChannelOpenInit => { - return { - portId: port_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { - portId: channel.counterparty.port_id, - channelId: channel.counterparty.channel_id - }, - connectionHops: channel.connection_hops, - version: channel.version - }, - signer - }; - } + toAmino: MsgChannelOpenInit.toAmino, + fromAmino: MsgChannelOpenInit.fromAmino }, "/ibc.core.channel.v1.MsgChannelOpenTry": { aminoType: "cosmos-sdk/MsgChannelOpenTry", - toAmino: ({ - portId, - previousChannelId, - channel, - counterpartyVersion, - proofInit, - proofHeight, - signer - }: MsgChannelOpenTry): AminoMsgChannelOpenTry["value"] => { - return { - port_id: portId, - previous_channel_id: previousChannelId, - channel: { - state: channel.state, - ordering: channel.ordering, - counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId - }, - connection_hops: channel.connectionHops, - version: channel.version - }, - counterparty_version: counterpartyVersion, - proof_init: proofInit, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - port_id, - previous_channel_id, - channel, - counterparty_version, - proof_init, - proof_height, - signer - }: AminoMsgChannelOpenTry["value"]): MsgChannelOpenTry => { - return { - portId: port_id, - previousChannelId: previous_channel_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { - portId: channel.counterparty.port_id, - channelId: channel.counterparty.channel_id - }, - connectionHops: channel.connection_hops, - version: channel.version - }, - counterpartyVersion: counterparty_version, - proofInit: proof_init, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgChannelOpenTry.toAmino, + fromAmino: MsgChannelOpenTry.fromAmino }, "/ibc.core.channel.v1.MsgChannelOpenAck": { aminoType: "cosmos-sdk/MsgChannelOpenAck", - toAmino: ({ - portId, - channelId, - counterpartyChannelId, - counterpartyVersion, - proofTry, - proofHeight, - signer - }: MsgChannelOpenAck): AminoMsgChannelOpenAck["value"] => { - return { - port_id: portId, - channel_id: channelId, - counterparty_channel_id: counterpartyChannelId, - counterparty_version: counterpartyVersion, - proof_try: proofTry, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - port_id, - channel_id, - counterparty_channel_id, - counterparty_version, - proof_try, - proof_height, - signer - }: AminoMsgChannelOpenAck["value"]): MsgChannelOpenAck => { - return { - portId: port_id, - channelId: channel_id, - counterpartyChannelId: counterparty_channel_id, - counterpartyVersion: counterparty_version, - proofTry: proof_try, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgChannelOpenAck.toAmino, + fromAmino: MsgChannelOpenAck.fromAmino }, "/ibc.core.channel.v1.MsgChannelOpenConfirm": { aminoType: "cosmos-sdk/MsgChannelOpenConfirm", - toAmino: ({ - portId, - channelId, - proofAck, - proofHeight, - signer - }: MsgChannelOpenConfirm): AminoMsgChannelOpenConfirm["value"] => { - return { - port_id: portId, - channel_id: channelId, - proof_ack: proofAck, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - port_id, - channel_id, - proof_ack, - proof_height, - signer - }: AminoMsgChannelOpenConfirm["value"]): MsgChannelOpenConfirm => { - return { - portId: port_id, - channelId: channel_id, - proofAck: proof_ack, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgChannelOpenConfirm.toAmino, + fromAmino: MsgChannelOpenConfirm.fromAmino }, "/ibc.core.channel.v1.MsgChannelCloseInit": { aminoType: "cosmos-sdk/MsgChannelCloseInit", - toAmino: ({ - portId, - channelId, - signer - }: MsgChannelCloseInit): AminoMsgChannelCloseInit["value"] => { - return { - port_id: portId, - channel_id: channelId, - signer - }; - }, - fromAmino: ({ - port_id, - channel_id, - signer - }: AminoMsgChannelCloseInit["value"]): MsgChannelCloseInit => { - return { - portId: port_id, - channelId: channel_id, - signer - }; - } + toAmino: MsgChannelCloseInit.toAmino, + fromAmino: MsgChannelCloseInit.fromAmino }, "/ibc.core.channel.v1.MsgChannelCloseConfirm": { aminoType: "cosmos-sdk/MsgChannelCloseConfirm", - toAmino: ({ - portId, - channelId, - proofInit, - proofHeight, - signer - }: MsgChannelCloseConfirm): AminoMsgChannelCloseConfirm["value"] => { - return { - port_id: portId, - channel_id: channelId, - proof_init: proofInit, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - port_id, - channel_id, - proof_init, - proof_height, - signer - }: AminoMsgChannelCloseConfirm["value"]): MsgChannelCloseConfirm => { - return { - portId: port_id, - channelId: channel_id, - proofInit: proof_init, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgChannelCloseConfirm.toAmino, + fromAmino: MsgChannelCloseConfirm.fromAmino }, "/ibc.core.channel.v1.MsgRecvPacket": { aminoType: "cosmos-sdk/MsgRecvPacket", - toAmino: ({ - packet, - proofCommitment, - proofHeight, - signer - }: MsgRecvPacket): AminoMsgRecvPacket["value"] => { - return { - packet: { - sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, - data: packet.data, - timeout_height: packet.timeoutHeight ? { - revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), - revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() - } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() - }, - proof_commitment: proofCommitment, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - packet, - proof_commitment, - proof_height, - signer - }: AminoMsgRecvPacket["value"]): MsgRecvPacket => { - return { - packet: { - sequence: Long.fromString(packet.sequence), - sourcePort: packet.source_port, - sourceChannel: packet.source_channel, - destinationPort: packet.destination_port, - destinationChannel: packet.destination_channel, - data: packet.data, - timeoutHeight: packet.timeout_height ? { - revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), - revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) - } : undefined, - timeoutTimestamp: Long.fromString(packet.timeout_timestamp) - }, - proofCommitment: proof_commitment, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgRecvPacket.toAmino, + fromAmino: MsgRecvPacket.fromAmino }, "/ibc.core.channel.v1.MsgTimeout": { aminoType: "cosmos-sdk/MsgTimeout", - toAmino: ({ - packet, - proofUnreceived, - proofHeight, - nextSequenceRecv, - signer - }: MsgTimeout): AminoMsgTimeout["value"] => { - return { - packet: { - sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, - data: packet.data, - timeout_height: packet.timeoutHeight ? { - revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), - revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() - } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() - }, - proof_unreceived: proofUnreceived, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - next_sequence_recv: nextSequenceRecv.toString(), - signer - }; - }, - fromAmino: ({ - packet, - proof_unreceived, - proof_height, - next_sequence_recv, - signer - }: AminoMsgTimeout["value"]): MsgTimeout => { - return { - packet: { - sequence: Long.fromString(packet.sequence), - sourcePort: packet.source_port, - sourceChannel: packet.source_channel, - destinationPort: packet.destination_port, - destinationChannel: packet.destination_channel, - data: packet.data, - timeoutHeight: packet.timeout_height ? { - revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), - revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) - } : undefined, - timeoutTimestamp: Long.fromString(packet.timeout_timestamp) - }, - proofUnreceived: proof_unreceived, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - nextSequenceRecv: Long.fromString(next_sequence_recv), - signer - }; - } + toAmino: MsgTimeout.toAmino, + fromAmino: MsgTimeout.fromAmino }, "/ibc.core.channel.v1.MsgTimeoutOnClose": { aminoType: "cosmos-sdk/MsgTimeoutOnClose", - toAmino: ({ - packet, - proofUnreceived, - proofClose, - proofHeight, - nextSequenceRecv, - signer - }: MsgTimeoutOnClose): AminoMsgTimeoutOnClose["value"] => { - return { - packet: { - sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, - data: packet.data, - timeout_height: packet.timeoutHeight ? { - revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), - revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() - } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() - }, - proof_unreceived: proofUnreceived, - proof_close: proofClose, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - next_sequence_recv: nextSequenceRecv.toString(), - signer - }; - }, - fromAmino: ({ - packet, - proof_unreceived, - proof_close, - proof_height, - next_sequence_recv, - signer - }: AminoMsgTimeoutOnClose["value"]): MsgTimeoutOnClose => { - return { - packet: { - sequence: Long.fromString(packet.sequence), - sourcePort: packet.source_port, - sourceChannel: packet.source_channel, - destinationPort: packet.destination_port, - destinationChannel: packet.destination_channel, - data: packet.data, - timeoutHeight: packet.timeout_height ? { - revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), - revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) - } : undefined, - timeoutTimestamp: Long.fromString(packet.timeout_timestamp) - }, - proofUnreceived: proof_unreceived, - proofClose: proof_close, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - nextSequenceRecv: Long.fromString(next_sequence_recv), - signer - }; - } + toAmino: MsgTimeoutOnClose.toAmino, + fromAmino: MsgTimeoutOnClose.fromAmino }, "/ibc.core.channel.v1.MsgAcknowledgement": { aminoType: "cosmos-sdk/MsgAcknowledgement", - toAmino: ({ - packet, - acknowledgement, - proofAcked, - proofHeight, - signer - }: MsgAcknowledgement): AminoMsgAcknowledgement["value"] => { - return { - packet: { - sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, - data: packet.data, - timeout_height: packet.timeoutHeight ? { - revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), - revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() - } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() - }, - acknowledgement, - proof_acked: proofAcked, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - packet, - acknowledgement, - proof_acked, - proof_height, - signer - }: AminoMsgAcknowledgement["value"]): MsgAcknowledgement => { - return { - packet: { - sequence: Long.fromString(packet.sequence), - sourcePort: packet.source_port, - sourceChannel: packet.source_channel, - destinationPort: packet.destination_port, - destinationChannel: packet.destination_channel, - data: packet.data, - timeoutHeight: packet.timeout_height ? { - revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), - revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) - } : undefined, - timeoutTimestamp: Long.fromString(packet.timeout_timestamp) - }, - acknowledgement, - proofAcked: proof_acked, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgAcknowledgement.toAmino, + fromAmino: MsgAcknowledgement.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/ibc/core/channel/v1/tx.registry.ts b/src/codegen/ibc/core/channel/v1/tx.registry.ts index 667978a..a71445b 100644 --- a/src/codegen/ibc/core/channel/v1/tx.registry.ts +++ b/src/codegen/ibc/core/channel/v1/tx.registry.ts @@ -14,70 +14,60 @@ export const MessageComposer = { value: MsgChannelOpenInit.encode(value).finish() }; }, - channelOpenTry(value: MsgChannelOpenTry) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: MsgChannelOpenTry.encode(value).finish() }; }, - channelOpenAck(value: MsgChannelOpenAck) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: MsgChannelOpenAck.encode(value).finish() }; }, - channelOpenConfirm(value: MsgChannelOpenConfirm) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: MsgChannelOpenConfirm.encode(value).finish() }; }, - channelCloseInit(value: MsgChannelCloseInit) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: MsgChannelCloseInit.encode(value).finish() }; }, - channelCloseConfirm(value: MsgChannelCloseConfirm) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: MsgChannelCloseConfirm.encode(value).finish() }; }, - recvPacket(value: MsgRecvPacket) { return { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: MsgRecvPacket.encode(value).finish() }; }, - timeout(value: MsgTimeout) { return { typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: MsgTimeout.encode(value).finish() }; }, - timeoutOnClose(value: MsgTimeoutOnClose) { return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: MsgTimeoutOnClose.encode(value).finish() }; }, - acknowledgement(value: MsgAcknowledgement) { return { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value: MsgAcknowledgement.encode(value).finish() }; } - }, withTypeUrl: { channelOpenInit(value: MsgChannelOpenInit) { @@ -86,70 +76,60 @@ export const MessageComposer = { value }; }, - channelOpenTry(value: MsgChannelOpenTry) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value }; }, - channelOpenAck(value: MsgChannelOpenAck) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value }; }, - channelOpenConfirm(value: MsgChannelOpenConfirm) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value }; }, - channelCloseInit(value: MsgChannelCloseInit) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value }; }, - channelCloseConfirm(value: MsgChannelCloseConfirm) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value }; }, - recvPacket(value: MsgRecvPacket) { return { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value }; }, - timeout(value: MsgTimeout) { return { typeUrl: "/ibc.core.channel.v1.MsgTimeout", value }; }, - timeoutOnClose(value: MsgTimeoutOnClose) { return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value }; }, - acknowledgement(value: MsgAcknowledgement) { return { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value }; } - }, fromPartial: { channelOpenInit(value: MsgChannelOpenInit) { @@ -158,69 +138,59 @@ export const MessageComposer = { value: MsgChannelOpenInit.fromPartial(value) }; }, - channelOpenTry(value: MsgChannelOpenTry) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: MsgChannelOpenTry.fromPartial(value) }; }, - channelOpenAck(value: MsgChannelOpenAck) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: MsgChannelOpenAck.fromPartial(value) }; }, - channelOpenConfirm(value: MsgChannelOpenConfirm) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: MsgChannelOpenConfirm.fromPartial(value) }; }, - channelCloseInit(value: MsgChannelCloseInit) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: MsgChannelCloseInit.fromPartial(value) }; }, - channelCloseConfirm(value: MsgChannelCloseConfirm) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: MsgChannelCloseConfirm.fromPartial(value) }; }, - recvPacket(value: MsgRecvPacket) { return { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: MsgRecvPacket.fromPartial(value) }; }, - timeout(value: MsgTimeout) { return { typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: MsgTimeout.fromPartial(value) }; }, - timeoutOnClose(value: MsgTimeoutOnClose) { return { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: MsgTimeoutOnClose.fromPartial(value) }; }, - acknowledgement(value: MsgAcknowledgement) { return { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value: MsgAcknowledgement.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/ibc/core/channel/v1/tx.rpc.msg.ts b/src/codegen/ibc/core/channel/v1/tx.rpc.msg.ts index b9ebcc5..1429bd6 100644 --- a/src/codegen/ibc/core/channel/v1/tx.rpc.msg.ts +++ b/src/codegen/ibc/core/channel/v1/tx.rpc.msg.ts @@ -1,45 +1,34 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { MsgChannelOpenInit, MsgChannelOpenInitResponse, MsgChannelOpenTry, MsgChannelOpenTryResponse, MsgChannelOpenAck, MsgChannelOpenAckResponse, MsgChannelOpenConfirm, MsgChannelOpenConfirmResponse, MsgChannelCloseInit, MsgChannelCloseInitResponse, MsgChannelCloseConfirm, MsgChannelCloseConfirmResponse, MsgRecvPacket, MsgRecvPacketResponse, MsgTimeout, MsgTimeoutResponse, MsgTimeoutOnClose, MsgTimeoutOnCloseResponse, MsgAcknowledgement, MsgAcknowledgementResponse } from "./tx"; /** Msg defines the ibc/channel Msg service. */ - export interface Msg { /** ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. */ channelOpenInit(request: MsgChannelOpenInit): Promise; /** ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. */ - channelOpenTry(request: MsgChannelOpenTry): Promise; /** ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. */ - channelOpenAck(request: MsgChannelOpenAck): Promise; /** ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. */ - channelOpenConfirm(request: MsgChannelOpenConfirm): Promise; /** ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. */ - channelCloseInit(request: MsgChannelCloseInit): Promise; /** * ChannelCloseConfirm defines a rpc handler method for * MsgChannelCloseConfirm. */ - channelCloseConfirm(request: MsgChannelCloseConfirm): Promise; /** RecvPacket defines a rpc handler method for MsgRecvPacket. */ - recvPacket(request: MsgRecvPacket): Promise; /** Timeout defines a rpc handler method for MsgTimeout. */ - timeout(request: MsgTimeout): Promise; /** TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. */ - timeoutOnClose(request: MsgTimeoutOnClose): Promise; /** Acknowledgement defines a rpc handler method for MsgAcknowledgement. */ - acknowledgement(request: MsgAcknowledgement): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.channelOpenInit = this.channelOpenInit.bind(this); @@ -53,65 +42,54 @@ export class MsgClientImpl implements Msg { this.timeoutOnClose = this.timeoutOnClose.bind(this); this.acknowledgement = this.acknowledgement.bind(this); } - channelOpenInit(request: MsgChannelOpenInit): Promise { const data = MsgChannelOpenInit.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenInit", data); - return promise.then(data => MsgChannelOpenInitResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgChannelOpenInitResponse.decode(new BinaryReader(data))); } - channelOpenTry(request: MsgChannelOpenTry): Promise { const data = MsgChannelOpenTry.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenTry", data); - return promise.then(data => MsgChannelOpenTryResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgChannelOpenTryResponse.decode(new BinaryReader(data))); } - channelOpenAck(request: MsgChannelOpenAck): Promise { const data = MsgChannelOpenAck.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenAck", data); - return promise.then(data => MsgChannelOpenAckResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgChannelOpenAckResponse.decode(new BinaryReader(data))); } - channelOpenConfirm(request: MsgChannelOpenConfirm): Promise { const data = MsgChannelOpenConfirm.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenConfirm", data); - return promise.then(data => MsgChannelOpenConfirmResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgChannelOpenConfirmResponse.decode(new BinaryReader(data))); } - channelCloseInit(request: MsgChannelCloseInit): Promise { const data = MsgChannelCloseInit.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelCloseInit", data); - return promise.then(data => MsgChannelCloseInitResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgChannelCloseInitResponse.decode(new BinaryReader(data))); } - channelCloseConfirm(request: MsgChannelCloseConfirm): Promise { const data = MsgChannelCloseConfirm.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelCloseConfirm", data); - return promise.then(data => MsgChannelCloseConfirmResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgChannelCloseConfirmResponse.decode(new BinaryReader(data))); } - recvPacket(request: MsgRecvPacket): Promise { const data = MsgRecvPacket.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "RecvPacket", data); - return promise.then(data => MsgRecvPacketResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgRecvPacketResponse.decode(new BinaryReader(data))); } - timeout(request: MsgTimeout): Promise { const data = MsgTimeout.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "Timeout", data); - return promise.then(data => MsgTimeoutResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgTimeoutResponse.decode(new BinaryReader(data))); } - timeoutOnClose(request: MsgTimeoutOnClose): Promise { const data = MsgTimeoutOnClose.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "TimeoutOnClose", data); - return promise.then(data => MsgTimeoutOnCloseResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgTimeoutOnCloseResponse.decode(new BinaryReader(data))); } - acknowledgement(request: MsgAcknowledgement): Promise { const data = MsgAcknowledgement.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Msg", "Acknowledgement", data); - return promise.then(data => MsgAcknowledgementResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgAcknowledgementResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/ibc/core/channel/v1/tx.ts b/src/codegen/ibc/core/channel/v1/tx.ts index 4eaa770..4a646b5 100644 --- a/src/codegen/ibc/core/channel/v1/tx.ts +++ b/src/codegen/ibc/core/channel/v1/tx.ts @@ -1,497 +1,769 @@ -import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; -import { Height, HeightSDKType } from "../../client/v1/client"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../../helpers"; +import { Channel, ChannelAmino, ChannelSDKType, Packet, PacketAmino, PacketSDKType } from "./channel"; +import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It * is called by a relayer on Chain A. */ - export interface MsgChannelOpenInit { portId: string; - channel?: Channel; + channel: Channel; signer: string; } +export interface MsgChannelOpenInitProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit"; + value: Uint8Array; +} +/** + * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It + * is called by a relayer on Chain A. + */ +export interface MsgChannelOpenInitAmino { + port_id?: string; + channel?: ChannelAmino; + signer?: string; +} +export interface MsgChannelOpenInitAminoMsg { + type: "cosmos-sdk/MsgChannelOpenInit"; + value: MsgChannelOpenInitAmino; +} /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It * is called by a relayer on Chain A. */ - export interface MsgChannelOpenInitSDKType { port_id: string; - channel?: ChannelSDKType; + channel: ChannelSDKType; signer: string; } /** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ - export interface MsgChannelOpenInitResponse {} +export interface MsgChannelOpenInitResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse"; + value: Uint8Array; +} +/** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ +export interface MsgChannelOpenInitResponseAmino {} +export interface MsgChannelOpenInitResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenInitResponse"; + value: MsgChannelOpenInitResponseAmino; +} /** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ - export interface MsgChannelOpenInitResponseSDKType {} /** * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel * on Chain B. */ - export interface MsgChannelOpenTry { portId: string; /** * in the case of crossing hello's, when both chains call OpenInit, we need * the channel identifier of the previous channel in state INIT */ - previousChannelId: string; - channel?: Channel; + channel: Channel; counterpartyVersion: string; proofInit: Uint8Array; - proofHeight?: Height; + proofHeight: Height; signer: string; } +export interface MsgChannelOpenTryProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry"; + value: Uint8Array; +} /** * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel * on Chain B. */ - -export interface MsgChannelOpenTrySDKType { - port_id: string; +export interface MsgChannelOpenTryAmino { + port_id?: string; /** * in the case of crossing hello's, when both chains call OpenInit, we need * the channel identifier of the previous channel in state INIT */ - + previous_channel_id?: string; + channel?: ChannelAmino; + counterparty_version?: string; + proof_init?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgChannelOpenTryAminoMsg { + type: "cosmos-sdk/MsgChannelOpenTry"; + value: MsgChannelOpenTryAmino; +} +/** + * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel + * on Chain B. + */ +export interface MsgChannelOpenTrySDKType { + port_id: string; previous_channel_id: string; - channel?: ChannelSDKType; + channel: ChannelSDKType; counterparty_version: string; proof_init: Uint8Array; - proof_height?: HeightSDKType; + proof_height: HeightSDKType; signer: string; } /** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ - export interface MsgChannelOpenTryResponse {} +export interface MsgChannelOpenTryResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse"; + value: Uint8Array; +} +/** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ +export interface MsgChannelOpenTryResponseAmino {} +export interface MsgChannelOpenTryResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenTryResponse"; + value: MsgChannelOpenTryResponseAmino; +} /** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ - export interface MsgChannelOpenTryResponseSDKType {} /** * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge * the change of channel state to TRYOPEN on Chain B. */ - export interface MsgChannelOpenAck { portId: string; channelId: string; counterpartyChannelId: string; counterpartyVersion: string; proofTry: Uint8Array; - proofHeight?: Height; + proofHeight: Height; signer: string; } +export interface MsgChannelOpenAckProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck"; + value: Uint8Array; +} +/** + * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge + * the change of channel state to TRYOPEN on Chain B. + */ +export interface MsgChannelOpenAckAmino { + port_id?: string; + channel_id?: string; + counterparty_channel_id?: string; + counterparty_version?: string; + proof_try?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgChannelOpenAckAminoMsg { + type: "cosmos-sdk/MsgChannelOpenAck"; + value: MsgChannelOpenAckAmino; +} /** * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge * the change of channel state to TRYOPEN on Chain B. */ - export interface MsgChannelOpenAckSDKType { port_id: string; channel_id: string; counterparty_channel_id: string; counterparty_version: string; proof_try: Uint8Array; - proof_height?: HeightSDKType; + proof_height: HeightSDKType; signer: string; } /** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ - export interface MsgChannelOpenAckResponse {} +export interface MsgChannelOpenAckResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse"; + value: Uint8Array; +} +/** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ +export interface MsgChannelOpenAckResponseAmino {} +export interface MsgChannelOpenAckResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenAckResponse"; + value: MsgChannelOpenAckResponseAmino; +} /** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ - export interface MsgChannelOpenAckResponseSDKType {} /** * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to * acknowledge the change of channel state to OPEN on Chain A. */ - export interface MsgChannelOpenConfirm { portId: string; channelId: string; proofAck: Uint8Array; - proofHeight?: Height; + proofHeight: Height; signer: string; } +export interface MsgChannelOpenConfirmProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm"; + value: Uint8Array; +} +/** + * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of channel state to OPEN on Chain A. + */ +export interface MsgChannelOpenConfirmAmino { + port_id?: string; + channel_id?: string; + proof_ack?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgChannelOpenConfirmAminoMsg { + type: "cosmos-sdk/MsgChannelOpenConfirm"; + value: MsgChannelOpenConfirmAmino; +} /** * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to * acknowledge the change of channel state to OPEN on Chain A. */ - export interface MsgChannelOpenConfirmSDKType { port_id: string; channel_id: string; proof_ack: Uint8Array; - proof_height?: HeightSDKType; + proof_height: HeightSDKType; signer: string; } /** * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response * type. */ - export interface MsgChannelOpenConfirmResponse {} +export interface MsgChannelOpenConfirmResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse"; + value: Uint8Array; +} +/** + * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + * type. + */ +export interface MsgChannelOpenConfirmResponseAmino {} +export interface MsgChannelOpenConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenConfirmResponse"; + value: MsgChannelOpenConfirmResponseAmino; +} /** * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response * type. */ - export interface MsgChannelOpenConfirmResponseSDKType {} /** * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A * to close a channel with Chain B. */ - export interface MsgChannelCloseInit { portId: string; channelId: string; signer: string; } +export interface MsgChannelCloseInitProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit"; + value: Uint8Array; +} +/** + * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + * to close a channel with Chain B. + */ +export interface MsgChannelCloseInitAmino { + port_id?: string; + channel_id?: string; + signer?: string; +} +export interface MsgChannelCloseInitAminoMsg { + type: "cosmos-sdk/MsgChannelCloseInit"; + value: MsgChannelCloseInitAmino; +} /** * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A * to close a channel with Chain B. */ - export interface MsgChannelCloseInitSDKType { port_id: string; channel_id: string; signer: string; } /** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ - export interface MsgChannelCloseInitResponse {} +export interface MsgChannelCloseInitResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse"; + value: Uint8Array; +} +/** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ +export interface MsgChannelCloseInitResponseAmino {} +export interface MsgChannelCloseInitResponseAminoMsg { + type: "cosmos-sdk/MsgChannelCloseInitResponse"; + value: MsgChannelCloseInitResponseAmino; +} /** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ - export interface MsgChannelCloseInitResponseSDKType {} /** * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B * to acknowledge the change of channel state to CLOSED on Chain A. */ - export interface MsgChannelCloseConfirm { portId: string; channelId: string; proofInit: Uint8Array; - proofHeight?: Height; + proofHeight: Height; signer: string; } +export interface MsgChannelCloseConfirmProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm"; + value: Uint8Array; +} +/** + * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + * to acknowledge the change of channel state to CLOSED on Chain A. + */ +export interface MsgChannelCloseConfirmAmino { + port_id?: string; + channel_id?: string; + proof_init?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgChannelCloseConfirmAminoMsg { + type: "cosmos-sdk/MsgChannelCloseConfirm"; + value: MsgChannelCloseConfirmAmino; +} /** * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B * to acknowledge the change of channel state to CLOSED on Chain A. */ - export interface MsgChannelCloseConfirmSDKType { port_id: string; channel_id: string; proof_init: Uint8Array; - proof_height?: HeightSDKType; + proof_height: HeightSDKType; signer: string; } /** * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response * type. */ - export interface MsgChannelCloseConfirmResponse {} +export interface MsgChannelCloseConfirmResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse"; + value: Uint8Array; +} +/** + * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response + * type. + */ +export interface MsgChannelCloseConfirmResponseAmino {} +export interface MsgChannelCloseConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgChannelCloseConfirmResponse"; + value: MsgChannelCloseConfirmResponseAmino; +} /** * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response * type. */ - export interface MsgChannelCloseConfirmResponseSDKType {} /** MsgRecvPacket receives incoming IBC packet */ - export interface MsgRecvPacket { - packet?: Packet; + packet: Packet; proofCommitment: Uint8Array; - proofHeight?: Height; + proofHeight: Height; signer: string; } +export interface MsgRecvPacketProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket"; + value: Uint8Array; +} +/** MsgRecvPacket receives incoming IBC packet */ +export interface MsgRecvPacketAmino { + packet?: PacketAmino; + proof_commitment?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgRecvPacketAminoMsg { + type: "cosmos-sdk/MsgRecvPacket"; + value: MsgRecvPacketAmino; +} /** MsgRecvPacket receives incoming IBC packet */ - export interface MsgRecvPacketSDKType { - packet?: PacketSDKType; + packet: PacketSDKType; proof_commitment: Uint8Array; - proof_height?: HeightSDKType; + proof_height: HeightSDKType; signer: string; } /** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ - export interface MsgRecvPacketResponse {} +export interface MsgRecvPacketResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse"; + value: Uint8Array; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponseAmino {} +export interface MsgRecvPacketResponseAminoMsg { + type: "cosmos-sdk/MsgRecvPacketResponse"; + value: MsgRecvPacketResponseAmino; +} /** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ - export interface MsgRecvPacketResponseSDKType {} /** MsgTimeout receives timed-out packet */ - export interface MsgTimeout { - packet?: Packet; + packet: Packet; proofUnreceived: Uint8Array; - proofHeight?: Height; - nextSequenceRecv: Long; + proofHeight: Height; + nextSequenceRecv: bigint; signer: string; } +export interface MsgTimeoutProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeout"; + value: Uint8Array; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeoutAmino { + packet?: PacketAmino; + proof_unreceived?: string; + proof_height?: HeightAmino; + next_sequence_recv?: string; + signer?: string; +} +export interface MsgTimeoutAminoMsg { + type: "cosmos-sdk/MsgTimeout"; + value: MsgTimeoutAmino; +} /** MsgTimeout receives timed-out packet */ - export interface MsgTimeoutSDKType { - packet?: PacketSDKType; + packet: PacketSDKType; proof_unreceived: Uint8Array; - proof_height?: HeightSDKType; - next_sequence_recv: Long; + proof_height: HeightSDKType; + next_sequence_recv: bigint; signer: string; } /** MsgTimeoutResponse defines the Msg/Timeout response type. */ - export interface MsgTimeoutResponse {} +export interface MsgTimeoutResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse"; + value: Uint8Array; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponseAmino {} +export interface MsgTimeoutResponseAminoMsg { + type: "cosmos-sdk/MsgTimeoutResponse"; + value: MsgTimeoutResponseAmino; +} /** MsgTimeoutResponse defines the Msg/Timeout response type. */ - export interface MsgTimeoutResponseSDKType {} /** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ - export interface MsgTimeoutOnClose { - packet?: Packet; + packet: Packet; proofUnreceived: Uint8Array; proofClose: Uint8Array; - proofHeight?: Height; - nextSequenceRecv: Long; + proofHeight: Height; + nextSequenceRecv: bigint; signer: string; } +export interface MsgTimeoutOnCloseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose"; + value: Uint8Array; +} +/** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ +export interface MsgTimeoutOnCloseAmino { + packet?: PacketAmino; + proof_unreceived?: string; + proof_close?: string; + proof_height?: HeightAmino; + next_sequence_recv?: string; + signer?: string; +} +export interface MsgTimeoutOnCloseAminoMsg { + type: "cosmos-sdk/MsgTimeoutOnClose"; + value: MsgTimeoutOnCloseAmino; +} /** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ - export interface MsgTimeoutOnCloseSDKType { - packet?: PacketSDKType; + packet: PacketSDKType; proof_unreceived: Uint8Array; proof_close: Uint8Array; - proof_height?: HeightSDKType; - next_sequence_recv: Long; + proof_height: HeightSDKType; + next_sequence_recv: bigint; signer: string; } /** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ - export interface MsgTimeoutOnCloseResponse {} +export interface MsgTimeoutOnCloseResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse"; + value: Uint8Array; +} +/** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ +export interface MsgTimeoutOnCloseResponseAmino {} +export interface MsgTimeoutOnCloseResponseAminoMsg { + type: "cosmos-sdk/MsgTimeoutOnCloseResponse"; + value: MsgTimeoutOnCloseResponseAmino; +} /** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ - export interface MsgTimeoutOnCloseResponseSDKType {} /** MsgAcknowledgement receives incoming IBC acknowledgement */ - export interface MsgAcknowledgement { - packet?: Packet; + packet: Packet; acknowledgement: Uint8Array; proofAcked: Uint8Array; - proofHeight?: Height; + proofHeight: Height; signer: string; } +export interface MsgAcknowledgementProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement"; + value: Uint8Array; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement */ +export interface MsgAcknowledgementAmino { + packet?: PacketAmino; + acknowledgement?: string; + proof_acked?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgAcknowledgementAminoMsg { + type: "cosmos-sdk/MsgAcknowledgement"; + value: MsgAcknowledgementAmino; +} /** MsgAcknowledgement receives incoming IBC acknowledgement */ - export interface MsgAcknowledgementSDKType { - packet?: PacketSDKType; + packet: PacketSDKType; acknowledgement: Uint8Array; proof_acked: Uint8Array; - proof_height?: HeightSDKType; + proof_height: HeightSDKType; signer: string; } /** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ - export interface MsgAcknowledgementResponse {} +export interface MsgAcknowledgementResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse"; + value: Uint8Array; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponseAmino {} +export interface MsgAcknowledgementResponseAminoMsg { + type: "cosmos-sdk/MsgAcknowledgementResponse"; + value: MsgAcknowledgementResponseAmino; +} /** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ - export interface MsgAcknowledgementResponseSDKType {} - function createBaseMsgChannelOpenInit(): MsgChannelOpenInit { return { portId: "", - channel: undefined, + channel: Channel.fromPartial({}), signer: "" }; } - export const MsgChannelOpenInit = { - encode(message: MsgChannelOpenInit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + encode(message: MsgChannelOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(26).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelOpenInit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelOpenInit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channel = Channel.decode(reader, reader.uint32()); break; - case 3: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgChannelOpenInit { + fromPartial(object: Partial): MsgChannelOpenInit { const message = createBaseMsgChannelOpenInit(); message.portId = object.portId ?? ""; message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgChannelOpenInitAmino): MsgChannelOpenInit { + const message = createBaseMsgChannelOpenInit(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { + return MsgChannelOpenInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenInit): MsgChannelOpenInitAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenInit", + value: MsgChannelOpenInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenInitProtoMsg): MsgChannelOpenInit { + return MsgChannelOpenInit.decode(message.value); + }, + toProto(message: MsgChannelOpenInit): Uint8Array { + return MsgChannelOpenInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenInit): MsgChannelOpenInitProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + value: MsgChannelOpenInit.encode(message).finish() + }; } - }; - function createBaseMsgChannelOpenInitResponse(): MsgChannelOpenInitResponse { return {}; } - export const MsgChannelOpenInitResponse = { - encode(_: MsgChannelOpenInitResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", + encode(_: MsgChannelOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelOpenInitResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelOpenInitResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgChannelOpenInitResponse { + fromPartial(_: Partial): MsgChannelOpenInitResponse { + const message = createBaseMsgChannelOpenInitResponse(); + return message; + }, + fromAmino(_: MsgChannelOpenInitResponseAmino): MsgChannelOpenInitResponse { const message = createBaseMsgChannelOpenInitResponse(); return message; + }, + toAmino(_: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenInitResponseAminoMsg): MsgChannelOpenInitResponse { + return MsgChannelOpenInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenInitResponse", + value: MsgChannelOpenInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenInitResponseProtoMsg): MsgChannelOpenInitResponse { + return MsgChannelOpenInitResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenInitResponse): Uint8Array { + return MsgChannelOpenInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", + value: MsgChannelOpenInitResponse.encode(message).finish() + }; } - }; - function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { return { portId: "", previousChannelId: "", - channel: undefined, + channel: Channel.fromPartial({}), counterpartyVersion: "", proofInit: new Uint8Array(), - proofHeight: undefined, + proofHeight: Height.fromPartial({}), signer: "" }; } - export const MsgChannelOpenTry = { - encode(message: MsgChannelOpenTry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + encode(message: MsgChannelOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.previousChannelId !== "") { writer.uint32(18).string(message.previousChannelId); } - if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(26).fork()).ldelim(); } - if (message.counterpartyVersion !== "") { writer.uint32(34).string(message.counterpartyVersion); } - if (message.proofInit.length !== 0) { writer.uint32(42).bytes(message.proofInit); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(58).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelOpenTry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenTry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelOpenTry(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.previousChannelId = reader.string(); break; - case 3: message.channel = Channel.decode(reader, reader.uint32()); break; - case 4: message.counterpartyVersion = reader.string(); break; - case 5: message.proofInit = reader.bytes(); break; - case 6: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 7: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgChannelOpenTry { + fromPartial(object: Partial): MsgChannelOpenTry { const message = createBaseMsgChannelOpenTry(); message.portId = object.portId ?? ""; message.previousChannelId = object.previousChannelId ?? ""; @@ -501,44 +773,121 @@ export const MsgChannelOpenTry = { message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgChannelOpenTryAmino): MsgChannelOpenTry { + const message = createBaseMsgChannelOpenTry(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.previous_channel_id !== undefined && object.previous_channel_id !== null) { + message.previousChannelId = object.previous_channel_id; + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + if (object.counterparty_version !== undefined && object.counterparty_version !== null) { + message.counterpartyVersion = object.counterparty_version; + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.previous_channel_id = message.previousChannelId; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + obj.counterparty_version = message.counterpartyVersion; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { + return MsgChannelOpenTry.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenTry): MsgChannelOpenTryAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenTry", + value: MsgChannelOpenTry.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenTryProtoMsg): MsgChannelOpenTry { + return MsgChannelOpenTry.decode(message.value); + }, + toProto(message: MsgChannelOpenTry): Uint8Array { + return MsgChannelOpenTry.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenTry): MsgChannelOpenTryProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + value: MsgChannelOpenTry.encode(message).finish() + }; } - }; - function createBaseMsgChannelOpenTryResponse(): MsgChannelOpenTryResponse { return {}; } - export const MsgChannelOpenTryResponse = { - encode(_: MsgChannelOpenTryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", + encode(_: MsgChannelOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelOpenTryResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenTryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelOpenTryResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgChannelOpenTryResponse { + fromPartial(_: Partial): MsgChannelOpenTryResponse { const message = createBaseMsgChannelOpenTryResponse(); return message; + }, + fromAmino(_: MsgChannelOpenTryResponseAmino): MsgChannelOpenTryResponse { + const message = createBaseMsgChannelOpenTryResponse(); + return message; + }, + toAmino(_: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenTryResponseAminoMsg): MsgChannelOpenTryResponse { + return MsgChannelOpenTryResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenTryResponse", + value: MsgChannelOpenTryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenTryResponseProtoMsg): MsgChannelOpenTryResponse { + return MsgChannelOpenTryResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenTryResponse): Uint8Array { + return MsgChannelOpenTryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", + value: MsgChannelOpenTryResponse.encode(message).finish() + }; } - }; - function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { return { portId: "", @@ -546,91 +895,72 @@ function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { counterpartyChannelId: "", counterpartyVersion: "", proofTry: new Uint8Array(), - proofHeight: undefined, + proofHeight: Height.fromPartial({}), signer: "" }; } - export const MsgChannelOpenAck = { - encode(message: MsgChannelOpenAck, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + encode(message: MsgChannelOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.counterpartyChannelId !== "") { writer.uint32(26).string(message.counterpartyChannelId); } - if (message.counterpartyVersion !== "") { writer.uint32(34).string(message.counterpartyVersion); } - if (message.proofTry.length !== 0) { writer.uint32(42).bytes(message.proofTry); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(58).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelOpenAck { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelOpenAck(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: message.counterpartyChannelId = reader.string(); break; - case 4: message.counterpartyVersion = reader.string(); break; - case 5: message.proofTry = reader.bytes(); break; - case 6: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 7: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgChannelOpenAck { + fromPartial(object: Partial): MsgChannelOpenAck { const message = createBaseMsgChannelOpenAck(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; @@ -640,118 +970,180 @@ export const MsgChannelOpenAck = { message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgChannelOpenAckAmino): MsgChannelOpenAck { + const message = createBaseMsgChannelOpenAck(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.counterparty_channel_id !== undefined && object.counterparty_channel_id !== null) { + message.counterpartyChannelId = object.counterparty_channel_id; + } + if (object.counterparty_version !== undefined && object.counterparty_version !== null) { + message.counterpartyVersion = object.counterparty_version; + } + if (object.proof_try !== undefined && object.proof_try !== null) { + message.proofTry = bytesFromBase64(object.proof_try); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion; + obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { + return MsgChannelOpenAck.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenAck): MsgChannelOpenAckAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenAck", + value: MsgChannelOpenAck.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenAckProtoMsg): MsgChannelOpenAck { + return MsgChannelOpenAck.decode(message.value); + }, + toProto(message: MsgChannelOpenAck): Uint8Array { + return MsgChannelOpenAck.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenAck): MsgChannelOpenAckProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + value: MsgChannelOpenAck.encode(message).finish() + }; } - }; - function createBaseMsgChannelOpenAckResponse(): MsgChannelOpenAckResponse { return {}; } - export const MsgChannelOpenAckResponse = { - encode(_: MsgChannelOpenAckResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", + encode(_: MsgChannelOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelOpenAckResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenAckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelOpenAckResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgChannelOpenAckResponse { + fromPartial(_: Partial): MsgChannelOpenAckResponse { const message = createBaseMsgChannelOpenAckResponse(); return message; + }, + fromAmino(_: MsgChannelOpenAckResponseAmino): MsgChannelOpenAckResponse { + const message = createBaseMsgChannelOpenAckResponse(); + return message; + }, + toAmino(_: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenAckResponseAminoMsg): MsgChannelOpenAckResponse { + return MsgChannelOpenAckResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenAckResponse", + value: MsgChannelOpenAckResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenAckResponseProtoMsg): MsgChannelOpenAckResponse { + return MsgChannelOpenAckResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenAckResponse): Uint8Array { + return MsgChannelOpenAckResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", + value: MsgChannelOpenAckResponse.encode(message).finish() + }; } - }; - function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { return { portId: "", channelId: "", proofAck: new Uint8Array(), - proofHeight: undefined, + proofHeight: Height.fromPartial({}), signer: "" }; } - export const MsgChannelOpenConfirm = { - encode(message: MsgChannelOpenConfirm, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + encode(message: MsgChannelOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.proofAck.length !== 0) { writer.uint32(26).bytes(message.proofAck); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(42).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelOpenConfirm { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelOpenConfirm(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: message.proofAck = reader.bytes(); break; - case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 5: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgChannelOpenConfirm { + fromPartial(object: Partial): MsgChannelOpenConfirm { const message = createBaseMsgChannelOpenConfirm(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; @@ -759,44 +1151,113 @@ export const MsgChannelOpenConfirm = { message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgChannelOpenConfirmAmino): MsgChannelOpenConfirm { + const message = createBaseMsgChannelOpenConfirm(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.proof_ack !== undefined && object.proof_ack !== null) { + message.proofAck = bytesFromBase64(object.proof_ack); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { + return MsgChannelOpenConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenConfirm", + value: MsgChannelOpenConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenConfirmProtoMsg): MsgChannelOpenConfirm { + return MsgChannelOpenConfirm.decode(message.value); + }, + toProto(message: MsgChannelOpenConfirm): Uint8Array { + return MsgChannelOpenConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + value: MsgChannelOpenConfirm.encode(message).finish() + }; } - }; - function createBaseMsgChannelOpenConfirmResponse(): MsgChannelOpenConfirmResponse { return {}; } - export const MsgChannelOpenConfirmResponse = { - encode(_: MsgChannelOpenConfirmResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", + encode(_: MsgChannelOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelOpenConfirmResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelOpenConfirmResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgChannelOpenConfirmResponse { + fromPartial(_: Partial): MsgChannelOpenConfirmResponse { const message = createBaseMsgChannelOpenConfirmResponse(); return message; + }, + fromAmino(_: MsgChannelOpenConfirmResponseAmino): MsgChannelOpenConfirmResponse { + const message = createBaseMsgChannelOpenConfirmResponse(); + return message; + }, + toAmino(_: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenConfirmResponseAminoMsg): MsgChannelOpenConfirmResponse { + return MsgChannelOpenConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenConfirmResponse", + value: MsgChannelOpenConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenConfirmResponseProtoMsg): MsgChannelOpenConfirmResponse { + return MsgChannelOpenConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenConfirmResponse): Uint8Array { + return MsgChannelOpenConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", + value: MsgChannelOpenConfirmResponse.encode(message).finish() + }; } - }; - function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { return { portId: "", @@ -804,172 +1265,207 @@ function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { signer: "" }; } - export const MsgChannelCloseInit = { - encode(message: MsgChannelCloseInit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + encode(message: MsgChannelCloseInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.signer !== "") { writer.uint32(26).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelCloseInit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelCloseInit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgChannelCloseInit { + fromPartial(object: Partial): MsgChannelCloseInit { const message = createBaseMsgChannelCloseInit(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgChannelCloseInitAmino): MsgChannelCloseInit { + const message = createBaseMsgChannelCloseInit(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { + return MsgChannelCloseInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseInit): MsgChannelCloseInitAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseInit", + value: MsgChannelCloseInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseInitProtoMsg): MsgChannelCloseInit { + return MsgChannelCloseInit.decode(message.value); + }, + toProto(message: MsgChannelCloseInit): Uint8Array { + return MsgChannelCloseInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseInit): MsgChannelCloseInitProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + value: MsgChannelCloseInit.encode(message).finish() + }; } - }; - function createBaseMsgChannelCloseInitResponse(): MsgChannelCloseInitResponse { return {}; } - export const MsgChannelCloseInitResponse = { - encode(_: MsgChannelCloseInitResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", + encode(_: MsgChannelCloseInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelCloseInitResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelCloseInitResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgChannelCloseInitResponse { + fromPartial(_: Partial): MsgChannelCloseInitResponse { + const message = createBaseMsgChannelCloseInitResponse(); + return message; + }, + fromAmino(_: MsgChannelCloseInitResponseAmino): MsgChannelCloseInitResponse { const message = createBaseMsgChannelCloseInitResponse(); return message; + }, + toAmino(_: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseInitResponseAminoMsg): MsgChannelCloseInitResponse { + return MsgChannelCloseInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseInitResponse", + value: MsgChannelCloseInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseInitResponseProtoMsg): MsgChannelCloseInitResponse { + return MsgChannelCloseInitResponse.decode(message.value); + }, + toProto(message: MsgChannelCloseInitResponse): Uint8Array { + return MsgChannelCloseInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", + value: MsgChannelCloseInitResponse.encode(message).finish() + }; } - }; - function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { return { portId: "", channelId: "", proofInit: new Uint8Array(), - proofHeight: undefined, + proofHeight: Height.fromPartial({}), signer: "" }; } - export const MsgChannelCloseConfirm = { - encode(message: MsgChannelCloseConfirm, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + encode(message: MsgChannelCloseConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.proofInit.length !== 0) { writer.uint32(26).bytes(message.proofInit); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(42).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelCloseConfirm { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelCloseConfirm(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.channelId = reader.string(); break; - case 3: message.proofInit = reader.bytes(); break; - case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 5: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgChannelCloseConfirm { + fromPartial(object: Partial): MsgChannelCloseConfirm { const message = createBaseMsgChannelCloseConfirm(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; @@ -977,475 +1473,691 @@ export const MsgChannelCloseConfirm = { message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgChannelCloseConfirmAmino): MsgChannelCloseConfirm { + const message = createBaseMsgChannelCloseConfirm(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.channel_id = message.channelId; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { + return MsgChannelCloseConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseConfirm", + value: MsgChannelCloseConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseConfirmProtoMsg): MsgChannelCloseConfirm { + return MsgChannelCloseConfirm.decode(message.value); + }, + toProto(message: MsgChannelCloseConfirm): Uint8Array { + return MsgChannelCloseConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + value: MsgChannelCloseConfirm.encode(message).finish() + }; } - }; - function createBaseMsgChannelCloseConfirmResponse(): MsgChannelCloseConfirmResponse { return {}; } - export const MsgChannelCloseConfirmResponse = { - encode(_: MsgChannelCloseConfirmResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", + encode(_: MsgChannelCloseConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgChannelCloseConfirmResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgChannelCloseConfirmResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgChannelCloseConfirmResponse { + fromPartial(_: Partial): MsgChannelCloseConfirmResponse { const message = createBaseMsgChannelCloseConfirmResponse(); return message; + }, + fromAmino(_: MsgChannelCloseConfirmResponseAmino): MsgChannelCloseConfirmResponse { + const message = createBaseMsgChannelCloseConfirmResponse(); + return message; + }, + toAmino(_: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseConfirmResponseAminoMsg): MsgChannelCloseConfirmResponse { + return MsgChannelCloseConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseConfirmResponse", + value: MsgChannelCloseConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseConfirmResponseProtoMsg): MsgChannelCloseConfirmResponse { + return MsgChannelCloseConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelCloseConfirmResponse): Uint8Array { + return MsgChannelCloseConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", + value: MsgChannelCloseConfirmResponse.encode(message).finish() + }; } - }; - function createBaseMsgRecvPacket(): MsgRecvPacket { return { - packet: undefined, + packet: Packet.fromPartial({}), proofCommitment: new Uint8Array(), - proofHeight: undefined, + proofHeight: Height.fromPartial({}), signer: "" }; } - export const MsgRecvPacket = { - encode(message: MsgRecvPacket, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + encode(message: MsgRecvPacket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); } - if (message.proofCommitment.length !== 0) { writer.uint32(18).bytes(message.proofCommitment); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(34).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRecvPacket { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecvPacket { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRecvPacket(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.packet = Packet.decode(reader, reader.uint32()); break; - case 2: message.proofCommitment = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 4: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgRecvPacket { + fromPartial(object: Partial): MsgRecvPacket { const message = createBaseMsgRecvPacket(); message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; message.proofCommitment = object.proofCommitment ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgRecvPacketAmino): MsgRecvPacket { + const message = createBaseMsgRecvPacket(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_commitment !== undefined && object.proof_commitment !== null) { + message.proofCommitment = bytesFromBase64(object.proof_commitment); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgRecvPacket): MsgRecvPacketAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { + return MsgRecvPacket.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecvPacket): MsgRecvPacketAminoMsg { + return { + type: "cosmos-sdk/MsgRecvPacket", + value: MsgRecvPacket.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecvPacketProtoMsg): MsgRecvPacket { + return MsgRecvPacket.decode(message.value); + }, + toProto(message: MsgRecvPacket): Uint8Array { + return MsgRecvPacket.encode(message).finish(); + }, + toProtoMsg(message: MsgRecvPacket): MsgRecvPacketProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + value: MsgRecvPacket.encode(message).finish() + }; } - }; - function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { return {}; } - export const MsgRecvPacketResponse = { - encode(_: MsgRecvPacketResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", + encode(_: MsgRecvPacketResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRecvPacketResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecvPacketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRecvPacketResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgRecvPacketResponse { + fromPartial(_: Partial): MsgRecvPacketResponse { + const message = createBaseMsgRecvPacketResponse(); + return message; + }, + fromAmino(_: MsgRecvPacketResponseAmino): MsgRecvPacketResponse { const message = createBaseMsgRecvPacketResponse(); return message; + }, + toAmino(_: MsgRecvPacketResponse): MsgRecvPacketResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRecvPacketResponseAminoMsg): MsgRecvPacketResponse { + return MsgRecvPacketResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecvPacketResponse): MsgRecvPacketResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRecvPacketResponse", + value: MsgRecvPacketResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecvPacketResponseProtoMsg): MsgRecvPacketResponse { + return MsgRecvPacketResponse.decode(message.value); + }, + toProto(message: MsgRecvPacketResponse): Uint8Array { + return MsgRecvPacketResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRecvPacketResponse): MsgRecvPacketResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", + value: MsgRecvPacketResponse.encode(message).finish() + }; } - }; - function createBaseMsgTimeout(): MsgTimeout { return { - packet: undefined, + packet: Packet.fromPartial({}), proofUnreceived: new Uint8Array(), - proofHeight: undefined, - nextSequenceRecv: Long.UZERO, + proofHeight: Height.fromPartial({}), + nextSequenceRecv: BigInt(0), signer: "" }; } - export const MsgTimeout = { - encode(message: MsgTimeout, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + encode(message: MsgTimeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); } - if (message.proofUnreceived.length !== 0) { writer.uint32(18).bytes(message.proofUnreceived); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - - if (!message.nextSequenceRecv.isZero()) { + if (message.nextSequenceRecv !== BigInt(0)) { writer.uint32(32).uint64(message.nextSequenceRecv); } - if (message.signer !== "") { writer.uint32(42).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgTimeout { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeout { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTimeout(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.packet = Packet.decode(reader, reader.uint32()); break; - case 2: message.proofUnreceived = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 4: - message.nextSequenceRecv = (reader.uint64() as Long); + message.nextSequenceRecv = reader.uint64(); break; - case 5: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgTimeout { + fromPartial(object: Partial): MsgTimeout { const message = createBaseMsgTimeout(); message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; - message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? Long.fromValue(object.nextSequenceRecv) : Long.UZERO; + message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgTimeoutAmino): MsgTimeout { + const message = createBaseMsgTimeout(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_unreceived !== undefined && object.proof_unreceived !== null) { + message.proofUnreceived = bytesFromBase64(object.proof_unreceived); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.next_sequence_recv !== undefined && object.next_sequence_recv !== null) { + message.nextSequenceRecv = BigInt(object.next_sequence_recv); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgTimeout): MsgTimeoutAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { + return MsgTimeout.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeout): MsgTimeoutAminoMsg { + return { + type: "cosmos-sdk/MsgTimeout", + value: MsgTimeout.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutProtoMsg): MsgTimeout { + return MsgTimeout.decode(message.value); + }, + toProto(message: MsgTimeout): Uint8Array { + return MsgTimeout.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeout): MsgTimeoutProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + value: MsgTimeout.encode(message).finish() + }; } - }; - function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { return {}; } - export const MsgTimeoutResponse = { - encode(_: MsgTimeoutResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", + encode(_: MsgTimeoutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgTimeoutResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTimeoutResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgTimeoutResponse { + fromPartial(_: Partial): MsgTimeoutResponse { const message = createBaseMsgTimeoutResponse(); return message; + }, + fromAmino(_: MsgTimeoutResponseAmino): MsgTimeoutResponse { + const message = createBaseMsgTimeoutResponse(); + return message; + }, + toAmino(_: MsgTimeoutResponse): MsgTimeoutResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgTimeoutResponseAminoMsg): MsgTimeoutResponse { + return MsgTimeoutResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutResponse): MsgTimeoutResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutResponse", + value: MsgTimeoutResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutResponseProtoMsg): MsgTimeoutResponse { + return MsgTimeoutResponse.decode(message.value); + }, + toProto(message: MsgTimeoutResponse): Uint8Array { + return MsgTimeoutResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutResponse): MsgTimeoutResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", + value: MsgTimeoutResponse.encode(message).finish() + }; } - }; - function createBaseMsgTimeoutOnClose(): MsgTimeoutOnClose { return { - packet: undefined, + packet: Packet.fromPartial({}), proofUnreceived: new Uint8Array(), proofClose: new Uint8Array(), - proofHeight: undefined, - nextSequenceRecv: Long.UZERO, + proofHeight: Height.fromPartial({}), + nextSequenceRecv: BigInt(0), signer: "" }; } - export const MsgTimeoutOnClose = { - encode(message: MsgTimeoutOnClose, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + encode(message: MsgTimeoutOnClose, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); } - if (message.proofUnreceived.length !== 0) { writer.uint32(18).bytes(message.proofUnreceived); } - if (message.proofClose.length !== 0) { writer.uint32(26).bytes(message.proofClose); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - - if (!message.nextSequenceRecv.isZero()) { + if (message.nextSequenceRecv !== BigInt(0)) { writer.uint32(40).uint64(message.nextSequenceRecv); } - if (message.signer !== "") { writer.uint32(50).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgTimeoutOnClose { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutOnClose { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTimeoutOnClose(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.packet = Packet.decode(reader, reader.uint32()); break; - case 2: message.proofUnreceived = reader.bytes(); break; - case 3: message.proofClose = reader.bytes(); break; - case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 5: - message.nextSequenceRecv = (reader.uint64() as Long); + message.nextSequenceRecv = reader.uint64(); break; - case 6: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgTimeoutOnClose { + fromPartial(object: Partial): MsgTimeoutOnClose { const message = createBaseMsgTimeoutOnClose(); message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); message.proofClose = object.proofClose ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; - message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? Long.fromValue(object.nextSequenceRecv) : Long.UZERO; + message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgTimeoutOnCloseAmino): MsgTimeoutOnClose { + const message = createBaseMsgTimeoutOnClose(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_unreceived !== undefined && object.proof_unreceived !== null) { + message.proofUnreceived = bytesFromBase64(object.proof_unreceived); + } + if (object.proof_close !== undefined && object.proof_close !== null) { + message.proofClose = bytesFromBase64(object.proof_close); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.next_sequence_recv !== undefined && object.next_sequence_recv !== null) { + message.nextSequenceRecv = BigInt(object.next_sequence_recv); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgTimeoutOnClose): MsgTimeoutOnCloseAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; + obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { + return MsgTimeoutOnClose.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutOnClose", + value: MsgTimeoutOnClose.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutOnCloseProtoMsg): MsgTimeoutOnClose { + return MsgTimeoutOnClose.decode(message.value); + }, + toProto(message: MsgTimeoutOnClose): Uint8Array { + return MsgTimeoutOnClose.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutOnClose): MsgTimeoutOnCloseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + value: MsgTimeoutOnClose.encode(message).finish() + }; } - }; - function createBaseMsgTimeoutOnCloseResponse(): MsgTimeoutOnCloseResponse { return {}; } - export const MsgTimeoutOnCloseResponse = { - encode(_: MsgTimeoutOnCloseResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", + encode(_: MsgTimeoutOnCloseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgTimeoutOnCloseResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutOnCloseResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTimeoutOnCloseResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgTimeoutOnCloseResponse { + fromPartial(_: Partial): MsgTimeoutOnCloseResponse { const message = createBaseMsgTimeoutOnCloseResponse(); return message; + }, + fromAmino(_: MsgTimeoutOnCloseResponseAmino): MsgTimeoutOnCloseResponse { + const message = createBaseMsgTimeoutOnCloseResponse(); + return message; + }, + toAmino(_: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgTimeoutOnCloseResponseAminoMsg): MsgTimeoutOnCloseResponse { + return MsgTimeoutOnCloseResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutOnCloseResponse", + value: MsgTimeoutOnCloseResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutOnCloseResponseProtoMsg): MsgTimeoutOnCloseResponse { + return MsgTimeoutOnCloseResponse.decode(message.value); + }, + toProto(message: MsgTimeoutOnCloseResponse): Uint8Array { + return MsgTimeoutOnCloseResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", + value: MsgTimeoutOnCloseResponse.encode(message).finish() + }; } - }; - function createBaseMsgAcknowledgement(): MsgAcknowledgement { return { - packet: undefined, + packet: Packet.fromPartial({}), acknowledgement: new Uint8Array(), proofAcked: new Uint8Array(), - proofHeight: undefined, + proofHeight: Height.fromPartial({}), signer: "" }; } - export const MsgAcknowledgement = { - encode(message: MsgAcknowledgement, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + encode(message: MsgAcknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); } - if (message.acknowledgement.length !== 0) { writer.uint32(18).bytes(message.acknowledgement); } - if (message.proofAcked.length !== 0) { writer.uint32(26).bytes(message.proofAcked); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(42).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgAcknowledgement { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgAcknowledgement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgAcknowledgement(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.packet = Packet.decode(reader, reader.uint32()); break; - case 2: message.acknowledgement = reader.bytes(); break; - case 3: message.proofAcked = reader.bytes(); break; - case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 5: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgAcknowledgement { + fromPartial(object: Partial): MsgAcknowledgement { const message = createBaseMsgAcknowledgement(); message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; message.acknowledgement = object.acknowledgement ?? new Uint8Array(); @@ -1453,40 +2165,110 @@ export const MsgAcknowledgement = { message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgAcknowledgementAmino): MsgAcknowledgement { + const message = createBaseMsgAcknowledgement(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = bytesFromBase64(object.acknowledgement); + } + if (object.proof_acked !== undefined && object.proof_acked !== null) { + message.proofAcked = bytesFromBase64(object.proof_acked); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgAcknowledgement): MsgAcknowledgementAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; + obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { + return MsgAcknowledgement.fromAmino(object.value); + }, + toAminoMsg(message: MsgAcknowledgement): MsgAcknowledgementAminoMsg { + return { + type: "cosmos-sdk/MsgAcknowledgement", + value: MsgAcknowledgement.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAcknowledgementProtoMsg): MsgAcknowledgement { + return MsgAcknowledgement.decode(message.value); + }, + toProto(message: MsgAcknowledgement): Uint8Array { + return MsgAcknowledgement.encode(message).finish(); + }, + toProtoMsg(message: MsgAcknowledgement): MsgAcknowledgementProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + value: MsgAcknowledgement.encode(message).finish() + }; } - }; - function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { return {}; } - export const MsgAcknowledgementResponse = { - encode(_: MsgAcknowledgementResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", + encode(_: MsgAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgAcknowledgementResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgAcknowledgementResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgAcknowledgementResponse { + fromPartial(_: Partial): MsgAcknowledgementResponse { const message = createBaseMsgAcknowledgementResponse(); return message; + }, + fromAmino(_: MsgAcknowledgementResponseAmino): MsgAcknowledgementResponse { + const message = createBaseMsgAcknowledgementResponse(); + return message; + }, + toAmino(_: MsgAcknowledgementResponse): MsgAcknowledgementResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgAcknowledgementResponseAminoMsg): MsgAcknowledgementResponse { + return MsgAcknowledgementResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgAcknowledgementResponse): MsgAcknowledgementResponseAminoMsg { + return { + type: "cosmos-sdk/MsgAcknowledgementResponse", + value: MsgAcknowledgementResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAcknowledgementResponseProtoMsg): MsgAcknowledgementResponse { + return MsgAcknowledgementResponse.decode(message.value); + }, + toProto(message: MsgAcknowledgementResponse): Uint8Array { + return MsgAcknowledgementResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAcknowledgementResponse): MsgAcknowledgementResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", + value: MsgAcknowledgementResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/client.ts b/src/codegen/ibc/core/client/v1/client.ts index 9d8dfcc..bfa36bd 100644 --- a/src/codegen/ibc/core/client/v1/client.ts +++ b/src/codegen/ibc/core/client/v1/client.ts @@ -1,77 +1,112 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { Plan, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * IdentifiedClientState defines a client state with an additional client * identifier field. */ - export interface IdentifiedClientState { /** client identifier */ clientId: string; /** client state */ - clientState?: Any; } +export interface IdentifiedClientStateProtoMsg { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState"; + value: Uint8Array; +} /** * IdentifiedClientState defines a client state with an additional client * identifier field. */ - -export interface IdentifiedClientStateSDKType { +export interface IdentifiedClientStateAmino { /** client identifier */ - client_id: string; + client_id?: string; /** client state */ - + client_state?: AnyAmino; +} +export interface IdentifiedClientStateAminoMsg { + type: "cosmos-sdk/IdentifiedClientState"; + value: IdentifiedClientStateAmino; +} +/** + * IdentifiedClientState defines a client state with an additional client + * identifier field. + */ +export interface IdentifiedClientStateSDKType { + client_id: string; client_state?: AnySDKType; } /** * ConsensusStateWithHeight defines a consensus state with an additional height * field. */ - export interface ConsensusStateWithHeight { /** consensus state height */ - height?: Height; + height: Height; /** consensus state */ - consensusState?: Any; } +export interface ConsensusStateWithHeightProtoMsg { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight"; + value: Uint8Array; +} /** * ConsensusStateWithHeight defines a consensus state with an additional height * field. */ - -export interface ConsensusStateWithHeightSDKType { +export interface ConsensusStateWithHeightAmino { /** consensus state height */ - height?: HeightSDKType; + height?: HeightAmino; /** consensus state */ - + consensus_state?: AnyAmino; +} +export interface ConsensusStateWithHeightAminoMsg { + type: "cosmos-sdk/ConsensusStateWithHeight"; + value: ConsensusStateWithHeightAmino; +} +/** + * ConsensusStateWithHeight defines a consensus state with an additional height + * field. + */ +export interface ConsensusStateWithHeightSDKType { + height: HeightSDKType; consensus_state?: AnySDKType; } /** * ClientConsensusStates defines all the stored consensus states for a given * client. */ - export interface ClientConsensusStates { /** client identifier */ clientId: string; /** consensus states and their heights associated with the client */ - consensusStates: ConsensusStateWithHeight[]; } +export interface ClientConsensusStatesProtoMsg { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates"; + value: Uint8Array; +} /** * ClientConsensusStates defines all the stored consensus states for a given * client. */ - -export interface ClientConsensusStatesSDKType { +export interface ClientConsensusStatesAmino { /** client identifier */ - client_id: string; + client_id?: string; /** consensus states and their heights associated with the client */ - + consensus_states?: ConsensusStateWithHeightAmino[]; +} +export interface ClientConsensusStatesAminoMsg { + type: "cosmos-sdk/ClientConsensusStates"; + value: ClientConsensusStatesAmino; +} +/** + * ClientConsensusStates defines all the stored consensus states for a given + * client. + */ +export interface ClientConsensusStatesSDKType { + client_id: string; consensus_states: ConsensusStateWithHeightSDKType[]; } /** @@ -80,55 +115,66 @@ export interface ClientConsensusStatesSDKType { * handler may fail if the subject and the substitute do not match in client and * chain parameters (with exception to latest height, frozen height, and chain-id). */ - export interface ClientUpdateProposal { /** the title of the update proposal */ title: string; /** the description of the proposal */ - description: string; /** the client identifier for the client to be updated if the proposal passes */ - subjectClientId: string; /** * the substitute client identifier for the client standing in for the subject * client */ - substituteClientId: string; } +export interface ClientUpdateProposalProtoMsg { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal"; + value: Uint8Array; +} /** * ClientUpdateProposal is a governance proposal. If it passes, the substitute * client's latest consensus state is copied over to the subject client. The proposal * handler may fail if the subject and the substitute do not match in client and * chain parameters (with exception to latest height, frozen height, and chain-id). */ - -export interface ClientUpdateProposalSDKType { +export interface ClientUpdateProposalAmino { /** the title of the update proposal */ - title: string; + title?: string; /** the description of the proposal */ - - description: string; + description?: string; /** the client identifier for the client to be updated if the proposal passes */ - - subject_client_id: string; + subject_client_id?: string; /** * the substitute client identifier for the client standing in for the subject * client */ - + substitute_client_id?: string; +} +export interface ClientUpdateProposalAminoMsg { + type: "cosmos-sdk/ClientUpdateProposal"; + value: ClientUpdateProposalAmino; +} +/** + * ClientUpdateProposal is a governance proposal. If it passes, the substitute + * client's latest consensus state is copied over to the subject client. The proposal + * handler may fail if the subject and the substitute do not match in client and + * chain parameters (with exception to latest height, frozen height, and chain-id). + */ +export interface ClientUpdateProposalSDKType { + title: string; + description: string; + subject_client_id: string; substitute_client_id: string; } /** * UpgradeProposal is a gov Content type for initiating an IBC breaking * upgrade. */ - export interface UpgradeProposal { title: string; description: string; - plan?: Plan; + plan: Plan; /** * An UpgradedClientState must be provided to perform an IBC breaking upgrade. * This will make the chain commit to the correct upgraded (self) client state @@ -137,18 +183,20 @@ export interface UpgradeProposal { * of the chain. This will allow IBC connections to persist smoothly across * planned chain upgrades */ - upgradedClientState?: Any; } +export interface UpgradeProposalProtoMsg { + typeUrl: "/ibc.core.client.v1.UpgradeProposal"; + value: Uint8Array; +} /** * UpgradeProposal is a gov Content type for initiating an IBC breaking * upgrade. */ - -export interface UpgradeProposalSDKType { - title: string; - description: string; - plan?: PlanSDKType; +export interface UpgradeProposalAmino { + title?: string; + description?: string; + plan?: PlanAmino; /** * An UpgradedClientState must be provided to perform an IBC breaking upgrade. * This will make the chain commit to the correct upgraded (self) client state @@ -157,7 +205,20 @@ export interface UpgradeProposalSDKType { * of the chain. This will allow IBC connections to persist smoothly across * planned chain upgrades */ - + upgraded_client_state?: AnyAmino; +} +export interface UpgradeProposalAminoMsg { + type: "cosmos-sdk/UpgradeProposal"; + value: UpgradeProposalAmino; +} +/** + * UpgradeProposal is a gov Content type for initiating an IBC breaking + * upgrade. + */ +export interface UpgradeProposalSDKType { + title: string; + description: string; + plan: PlanSDKType; upgraded_client_state?: AnySDKType; } /** @@ -172,13 +233,15 @@ export interface UpgradeProposalSDKType { * height continues to be monitonically increasing even as the RevisionHeight * gets reset */ - export interface Height { /** the revision that the client is currently on */ - revisionNumber: Long; + revisionNumber: bigint; /** the height within the given revision */ - - revisionHeight: Long; + revisionHeight: bigint; +} +export interface HeightProtoMsg { + typeUrl: "/ibc.core.client.v1.Height"; + value: Uint8Array; } /** * Height is a monotonically increasing data type @@ -192,192 +255,299 @@ export interface Height { * height continues to be monitonically increasing even as the RevisionHeight * gets reset */ - -export interface HeightSDKType { +export interface HeightAmino { /** the revision that the client is currently on */ - revision_number: Long; + revision_number?: string; /** the height within the given revision */ - - revision_height: Long; + revision_height?: string; +} +export interface HeightAminoMsg { + type: "cosmos-sdk/Height"; + value: HeightAmino; +} +/** + * Height is a monotonically increasing data type + * that can be compared against another Height for the purposes of updating and + * freezing clients + * + * Normally the RevisionHeight is incremented at each height while keeping + * RevisionNumber the same. However some consensus algorithms may choose to + * reset the height in certain conditions e.g. hard forks, state-machine + * breaking changes In these cases, the RevisionNumber is incremented so that + * height continues to be monitonically increasing even as the RevisionHeight + * gets reset + */ +export interface HeightSDKType { + revision_number: bigint; + revision_height: bigint; } /** Params defines the set of IBC light client parameters. */ - export interface Params { /** allowed_clients defines the list of allowed client state types. */ allowedClients: string[]; } +export interface ParamsProtoMsg { + typeUrl: "/ibc.core.client.v1.Params"; + value: Uint8Array; +} /** Params defines the set of IBC light client parameters. */ - -export interface ParamsSDKType { +export interface ParamsAmino { /** allowed_clients defines the list of allowed client state types. */ + allowed_clients?: string[]; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** Params defines the set of IBC light client parameters. */ +export interface ParamsSDKType { allowed_clients: string[]; } - function createBaseIdentifiedClientState(): IdentifiedClientState { return { clientId: "", clientState: undefined }; } - export const IdentifiedClientState = { - encode(message: IdentifiedClientState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState", + encode(message: IdentifiedClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IdentifiedClientState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseIdentifiedClientState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.clientState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): IdentifiedClientState { + fromPartial(object: Partial): IdentifiedClientState { const message = createBaseIdentifiedClientState(); message.clientId = object.clientId ?? ""; message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; return message; + }, + fromAmino(object: IdentifiedClientStateAmino): IdentifiedClientState { + const message = createBaseIdentifiedClientState(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + return message; + }, + toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + return obj; + }, + fromAminoMsg(object: IdentifiedClientStateAminoMsg): IdentifiedClientState { + return IdentifiedClientState.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedClientState): IdentifiedClientStateAminoMsg { + return { + type: "cosmos-sdk/IdentifiedClientState", + value: IdentifiedClientState.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedClientStateProtoMsg): IdentifiedClientState { + return IdentifiedClientState.decode(message.value); + }, + toProto(message: IdentifiedClientState): Uint8Array { + return IdentifiedClientState.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedClientState): IdentifiedClientStateProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState", + value: IdentifiedClientState.encode(message).finish() + }; } - }; - function createBaseConsensusStateWithHeight(): ConsensusStateWithHeight { return { - height: undefined, + height: Height.fromPartial({}), consensusState: undefined }; } - export const ConsensusStateWithHeight = { - encode(message: ConsensusStateWithHeight, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", + encode(message: ConsensusStateWithHeight, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== undefined) { Height.encode(message.height, writer.uint32(10).fork()).ldelim(); } - if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusStateWithHeight { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusStateWithHeight { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensusStateWithHeight(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.height = Height.decode(reader, reader.uint32()); break; - case 2: message.consensusState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConsensusStateWithHeight { + fromPartial(object: Partial): ConsensusStateWithHeight { const message = createBaseConsensusStateWithHeight(); message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; return message; + }, + fromAmino(object: ConsensusStateWithHeightAmino): ConsensusStateWithHeight { + const message = createBaseConsensusStateWithHeight(); + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + return message; + }, + toAmino(message: ConsensusStateWithHeight): ConsensusStateWithHeightAmino { + const obj: any = {}; + obj.height = message.height ? Height.toAmino(message.height) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateWithHeightAminoMsg): ConsensusStateWithHeight { + return ConsensusStateWithHeight.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusStateWithHeight): ConsensusStateWithHeightAminoMsg { + return { + type: "cosmos-sdk/ConsensusStateWithHeight", + value: ConsensusStateWithHeight.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateWithHeightProtoMsg): ConsensusStateWithHeight { + return ConsensusStateWithHeight.decode(message.value); + }, + toProto(message: ConsensusStateWithHeight): Uint8Array { + return ConsensusStateWithHeight.encode(message).finish(); + }, + toProtoMsg(message: ConsensusStateWithHeight): ConsensusStateWithHeightProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", + value: ConsensusStateWithHeight.encode(message).finish() + }; } - }; - function createBaseClientConsensusStates(): ClientConsensusStates { return { clientId: "", consensusStates: [] }; } - export const ClientConsensusStates = { - encode(message: ClientConsensusStates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates", + encode(message: ClientConsensusStates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - for (const v of message.consensusStates) { ConsensusStateWithHeight.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientConsensusStates { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientConsensusStates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientConsensusStates(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.consensusStates.push(ConsensusStateWithHeight.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientConsensusStates { + fromPartial(object: Partial): ClientConsensusStates { const message = createBaseClientConsensusStates(); message.clientId = object.clientId ?? ""; message.consensusStates = object.consensusStates?.map(e => ConsensusStateWithHeight.fromPartial(e)) || []; return message; + }, + fromAmino(object: ClientConsensusStatesAmino): ClientConsensusStates { + const message = createBaseClientConsensusStates(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.consensusStates = object.consensus_states?.map(e => ConsensusStateWithHeight.fromAmino(e)) || []; + return message; + }, + toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { + const obj: any = {}; + obj.client_id = message.clientId; + if (message.consensusStates) { + obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); + } else { + obj.consensus_states = []; + } + return obj; + }, + fromAminoMsg(object: ClientConsensusStatesAminoMsg): ClientConsensusStates { + return ClientConsensusStates.fromAmino(object.value); + }, + toAminoMsg(message: ClientConsensusStates): ClientConsensusStatesAminoMsg { + return { + type: "cosmos-sdk/ClientConsensusStates", + value: ClientConsensusStates.toAmino(message) + }; + }, + fromProtoMsg(message: ClientConsensusStatesProtoMsg): ClientConsensusStates { + return ClientConsensusStates.decode(message.value); + }, + toProto(message: ClientConsensusStates): Uint8Array { + return ClientConsensusStates.encode(message).finish(); + }, + toProtoMsg(message: ClientConsensusStates): ClientConsensusStatesProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates", + value: ClientConsensusStates.encode(message).finish() + }; } - }; - function createBaseClientUpdateProposal(): ClientUpdateProposal { return { title: "", @@ -386,244 +556,353 @@ function createBaseClientUpdateProposal(): ClientUpdateProposal { substituteClientId: "" }; } - export const ClientUpdateProposal = { - encode(message: ClientUpdateProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + encode(message: ClientUpdateProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.subjectClientId !== "") { writer.uint32(26).string(message.subjectClientId); } - if (message.substituteClientId !== "") { writer.uint32(34).string(message.substituteClientId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientUpdateProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientUpdateProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientUpdateProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.title = reader.string(); break; - case 2: message.description = reader.string(); break; - case 3: message.subjectClientId = reader.string(); break; - case 4: message.substituteClientId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientUpdateProposal { + fromPartial(object: Partial): ClientUpdateProposal { const message = createBaseClientUpdateProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; message.subjectClientId = object.subjectClientId ?? ""; message.substituteClientId = object.substituteClientId ?? ""; return message; + }, + fromAmino(object: ClientUpdateProposalAmino): ClientUpdateProposal { + const message = createBaseClientUpdateProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.subject_client_id !== undefined && object.subject_client_id !== null) { + message.subjectClientId = object.subject_client_id; + } + if (object.substitute_client_id !== undefined && object.substitute_client_id !== null) { + message.substituteClientId = object.substitute_client_id; + } + return message; + }, + toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + obj.subject_client_id = message.subjectClientId; + obj.substitute_client_id = message.substituteClientId; + return obj; + }, + fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { + return ClientUpdateProposal.fromAmino(object.value); + }, + toAminoMsg(message: ClientUpdateProposal): ClientUpdateProposalAminoMsg { + return { + type: "cosmos-sdk/ClientUpdateProposal", + value: ClientUpdateProposal.toAmino(message) + }; + }, + fromProtoMsg(message: ClientUpdateProposalProtoMsg): ClientUpdateProposal { + return ClientUpdateProposal.decode(message.value); + }, + toProto(message: ClientUpdateProposal): Uint8Array { + return ClientUpdateProposal.encode(message).finish(); + }, + toProtoMsg(message: ClientUpdateProposal): ClientUpdateProposalProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + value: ClientUpdateProposal.encode(message).finish() + }; } - }; - function createBaseUpgradeProposal(): UpgradeProposal { return { title: "", description: "", - plan: undefined, + plan: Plan.fromPartial({}), upgradedClientState: undefined }; } - export const UpgradeProposal = { - encode(message: UpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + encode(message: UpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.plan !== undefined) { Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); } - if (message.upgradedClientState !== undefined) { Any.encode(message.upgradedClientState, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UpgradeProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): UpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUpgradeProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.title = reader.string(); break; - case 2: message.description = reader.string(); break; - case 3: message.plan = Plan.decode(reader, reader.uint32()); break; - case 4: message.upgradedClientState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): UpgradeProposal { + fromPartial(object: Partial): UpgradeProposal { const message = createBaseUpgradeProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; return message; + }, + fromAmino(object: UpgradeProposalAmino): UpgradeProposal { + const message = createBaseUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + return message; + }, + toAmino(message: UpgradeProposal): UpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + return obj; + }, + fromAminoMsg(object: UpgradeProposalAminoMsg): UpgradeProposal { + return UpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: UpgradeProposal): UpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/UpgradeProposal", + value: UpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: UpgradeProposalProtoMsg): UpgradeProposal { + return UpgradeProposal.decode(message.value); + }, + toProto(message: UpgradeProposal): Uint8Array { + return UpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: UpgradeProposal): UpgradeProposalProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + value: UpgradeProposal.encode(message).finish() + }; } - }; - function createBaseHeight(): Height { return { - revisionNumber: Long.UZERO, - revisionHeight: Long.UZERO + revisionNumber: BigInt(0), + revisionHeight: BigInt(0) }; } - export const Height = { - encode(message: Height, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.revisionNumber.isZero()) { + typeUrl: "/ibc.core.client.v1.Height", + encode(message: Height, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.revisionNumber !== BigInt(0)) { writer.uint32(8).uint64(message.revisionNumber); } - - if (!message.revisionHeight.isZero()) { + if (message.revisionHeight !== BigInt(0)) { writer.uint32(16).uint64(message.revisionHeight); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Height { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Height { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHeight(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.revisionNumber = (reader.uint64() as Long); + message.revisionNumber = reader.uint64(); break; - case 2: - message.revisionHeight = (reader.uint64() as Long); + message.revisionHeight = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Height { + fromPartial(object: Partial): Height { const message = createBaseHeight(); - message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? Long.fromValue(object.revisionNumber) : Long.UZERO; - message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? Long.fromValue(object.revisionHeight) : Long.UZERO; + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); return message; + }, + fromAmino(object: HeightAmino): Height { + return { + revisionNumber: BigInt(object.revision_number || "0"), + revisionHeight: BigInt(object.revision_height || "0") + }; + }, + toAmino(message: Height): HeightAmino { + const obj: any = {}; + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: HeightAminoMsg): Height { + return Height.fromAmino(object.value); + }, + toAminoMsg(message: Height): HeightAminoMsg { + return { + type: "cosmos-sdk/Height", + value: Height.toAmino(message) + }; + }, + fromProtoMsg(message: HeightProtoMsg): Height { + return Height.decode(message.value); + }, + toProto(message: Height): Uint8Array { + return Height.encode(message).finish(); + }, + toProtoMsg(message: Height): HeightProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.Height", + value: Height.encode(message).finish() + }; } - }; - function createBaseParams(): Params { return { allowedClients: [] }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowedClients) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.allowedClients.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); message.allowedClients = object.allowedClients?.map(e => e) || []; return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.allowedClients = object.allowed_clients?.map(e => e) || []; + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.allowedClients) { + obj.allowed_clients = message.allowedClients.map(e => e); + } else { + obj.allowed_clients = []; + } + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.Params", + value: Params.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/genesis.ts b/src/codegen/ibc/core/client/v1/genesis.ts index 0ff3a7d..92b93c8 100644 --- a/src/codegen/ibc/core/client/v1/genesis.ts +++ b/src/codegen/ibc/core/client/v1/genesis.ts @@ -1,288 +1,415 @@ -import { IdentifiedClientState, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesSDKType, Params, ParamsSDKType } from "./client"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesAmino, ClientConsensusStatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** GenesisState defines the ibc client submodule's genesis state. */ - export interface GenesisState { /** client states with their corresponding identifiers */ clients: IdentifiedClientState[]; /** consensus states from each client */ - clientsConsensus: ClientConsensusStates[]; /** metadata from each client */ - clientsMetadata: IdentifiedGenesisMetadata[]; - params?: Params; + params: Params; /** create localhost on initialization */ - createLocalhost: boolean; /** the sequence for the next generated client identifier */ - - nextClientSequence: Long; + nextClientSequence: bigint; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.core.client.v1.GenesisState"; + value: Uint8Array; } /** GenesisState defines the ibc client submodule's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** client states with their corresponding identifiers */ - clients: IdentifiedClientStateSDKType[]; + clients?: IdentifiedClientStateAmino[]; /** consensus states from each client */ - - clients_consensus: ClientConsensusStatesSDKType[]; + clients_consensus?: ClientConsensusStatesAmino[]; /** metadata from each client */ - - clients_metadata: IdentifiedGenesisMetadataSDKType[]; - params?: ParamsSDKType; + clients_metadata?: IdentifiedGenesisMetadataAmino[]; + params?: ParamsAmino; /** create localhost on initialization */ - - create_localhost: boolean; + create_localhost?: boolean; /** the sequence for the next generated client identifier */ - - next_client_sequence: Long; + next_client_sequence?: string; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the ibc client submodule's genesis state. */ +export interface GenesisStateSDKType { + clients: IdentifiedClientStateSDKType[]; + clients_consensus: ClientConsensusStatesSDKType[]; + clients_metadata: IdentifiedGenesisMetadataSDKType[]; + params: ParamsSDKType; + create_localhost: boolean; + next_client_sequence: bigint; } /** * GenesisMetadata defines the genesis type for metadata that clients may return * with ExportMetadata */ - export interface GenesisMetadata { /** store key of metadata without clientID-prefix */ key: Uint8Array; /** metadata value */ - + value: Uint8Array; +} +export interface GenesisMetadataProtoMsg { + typeUrl: "/ibc.core.client.v1.GenesisMetadata"; value: Uint8Array; } /** * GenesisMetadata defines the genesis type for metadata that clients may return * with ExportMetadata */ - -export interface GenesisMetadataSDKType { +export interface GenesisMetadataAmino { /** store key of metadata without clientID-prefix */ - key: Uint8Array; + key?: string; /** metadata value */ - + value?: string; +} +export interface GenesisMetadataAminoMsg { + type: "cosmos-sdk/GenesisMetadata"; + value: GenesisMetadataAmino; +} +/** + * GenesisMetadata defines the genesis type for metadata that clients may return + * with ExportMetadata + */ +export interface GenesisMetadataSDKType { + key: Uint8Array; value: Uint8Array; } /** * IdentifiedGenesisMetadata has the client metadata with the corresponding * client id. */ - export interface IdentifiedGenesisMetadata { clientId: string; clientMetadata: GenesisMetadata[]; } +export interface IdentifiedGenesisMetadataProtoMsg { + typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata"; + value: Uint8Array; +} +/** + * IdentifiedGenesisMetadata has the client metadata with the corresponding + * client id. + */ +export interface IdentifiedGenesisMetadataAmino { + client_id?: string; + client_metadata?: GenesisMetadataAmino[]; +} +export interface IdentifiedGenesisMetadataAminoMsg { + type: "cosmos-sdk/IdentifiedGenesisMetadata"; + value: IdentifiedGenesisMetadataAmino; +} /** * IdentifiedGenesisMetadata has the client metadata with the corresponding * client id. */ - export interface IdentifiedGenesisMetadataSDKType { client_id: string; client_metadata: GenesisMetadataSDKType[]; } - function createBaseGenesisState(): GenesisState { return { clients: [], clientsConsensus: [], clientsMetadata: [], - params: undefined, + params: Params.fromPartial({}), createLocalhost: false, - nextClientSequence: Long.UZERO + nextClientSequence: BigInt(0) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.clients) { IdentifiedClientState.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.clientsConsensus) { ClientConsensusStates.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.clientsMetadata) { IdentifiedGenesisMetadata.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.params !== undefined) { Params.encode(message.params, writer.uint32(34).fork()).ldelim(); } - if (message.createLocalhost === true) { writer.uint32(40).bool(message.createLocalhost); } - - if (!message.nextClientSequence.isZero()) { + if (message.nextClientSequence !== BigInt(0)) { writer.uint32(48).uint64(message.nextClientSequence); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clients.push(IdentifiedClientState.decode(reader, reader.uint32())); break; - case 2: message.clientsConsensus.push(ClientConsensusStates.decode(reader, reader.uint32())); break; - case 3: message.clientsMetadata.push(IdentifiedGenesisMetadata.decode(reader, reader.uint32())); break; - case 4: message.params = Params.decode(reader, reader.uint32()); break; - case 5: message.createLocalhost = reader.bool(); break; - case 6: - message.nextClientSequence = (reader.uint64() as Long); + message.nextClientSequence = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.clients = object.clients?.map(e => IdentifiedClientState.fromPartial(e)) || []; message.clientsConsensus = object.clientsConsensus?.map(e => ClientConsensusStates.fromPartial(e)) || []; message.clientsMetadata = object.clientsMetadata?.map(e => IdentifiedGenesisMetadata.fromPartial(e)) || []; message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.createLocalhost = object.createLocalhost ?? false; - message.nextClientSequence = object.nextClientSequence !== undefined && object.nextClientSequence !== null ? Long.fromValue(object.nextClientSequence) : Long.UZERO; + message.nextClientSequence = object.nextClientSequence !== undefined && object.nextClientSequence !== null ? BigInt(object.nextClientSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.clients = object.clients?.map(e => IdentifiedClientState.fromAmino(e)) || []; + message.clientsConsensus = object.clients_consensus?.map(e => ClientConsensusStates.fromAmino(e)) || []; + message.clientsMetadata = object.clients_metadata?.map(e => IdentifiedGenesisMetadata.fromAmino(e)) || []; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + if (object.create_localhost !== undefined && object.create_localhost !== null) { + message.createLocalhost = object.create_localhost; + } + if (object.next_client_sequence !== undefined && object.next_client_sequence !== null) { + message.nextClientSequence = BigInt(object.next_client_sequence); + } return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.clients) { + obj.clients = message.clients.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); + } else { + obj.clients = []; + } + if (message.clientsConsensus) { + obj.clients_consensus = message.clientsConsensus.map(e => e ? ClientConsensusStates.toAmino(e) : undefined); + } else { + obj.clients_consensus = []; + } + if (message.clientsMetadata) { + obj.clients_metadata = message.clientsMetadata.map(e => e ? IdentifiedGenesisMetadata.toAmino(e) : undefined); + } else { + obj.clients_metadata = []; + } + obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.create_localhost = message.createLocalhost; + obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; - function createBaseGenesisMetadata(): GenesisMetadata { return { key: new Uint8Array(), value: new Uint8Array() }; } - export const GenesisMetadata = { - encode(message: GenesisMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.GenesisMetadata", + encode(message: GenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): GenesisMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisMetadata(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: message.value = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisMetadata { + fromPartial(object: Partial): GenesisMetadata { const message = createBaseGenesisMetadata(); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); return message; + }, + fromAmino(object: GenesisMetadataAmino): GenesisMetadata { + const message = createBaseGenesisMetadata(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: GenesisMetadata): GenesisMetadataAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisMetadataAminoMsg): GenesisMetadata { + return GenesisMetadata.fromAmino(object.value); + }, + toAminoMsg(message: GenesisMetadata): GenesisMetadataAminoMsg { + return { + type: "cosmos-sdk/GenesisMetadata", + value: GenesisMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisMetadataProtoMsg): GenesisMetadata { + return GenesisMetadata.decode(message.value); + }, + toProto(message: GenesisMetadata): Uint8Array { + return GenesisMetadata.encode(message).finish(); + }, + toProtoMsg(message: GenesisMetadata): GenesisMetadataProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.GenesisMetadata", + value: GenesisMetadata.encode(message).finish() + }; } - }; - function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { return { clientId: "", clientMetadata: [] }; } - export const IdentifiedGenesisMetadata = { - encode(message: IdentifiedGenesisMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", + encode(message: IdentifiedGenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - for (const v of message.clientMetadata) { GenesisMetadata.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IdentifiedGenesisMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedGenesisMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseIdentifiedGenesisMetadata(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.clientMetadata.push(GenesisMetadata.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): IdentifiedGenesisMetadata { + fromPartial(object: Partial): IdentifiedGenesisMetadata { const message = createBaseIdentifiedGenesisMetadata(); message.clientId = object.clientId ?? ""; message.clientMetadata = object.clientMetadata?.map(e => GenesisMetadata.fromPartial(e)) || []; return message; + }, + fromAmino(object: IdentifiedGenesisMetadataAmino): IdentifiedGenesisMetadata { + const message = createBaseIdentifiedGenesisMetadata(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.clientMetadata = object.client_metadata?.map(e => GenesisMetadata.fromAmino(e)) || []; + return message; + }, + toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { + const obj: any = {}; + obj.client_id = message.clientId; + if (message.clientMetadata) { + obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); + } else { + obj.client_metadata = []; + } + return obj; + }, + fromAminoMsg(object: IdentifiedGenesisMetadataAminoMsg): IdentifiedGenesisMetadata { + return IdentifiedGenesisMetadata.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAminoMsg { + return { + type: "cosmos-sdk/IdentifiedGenesisMetadata", + value: IdentifiedGenesisMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedGenesisMetadataProtoMsg): IdentifiedGenesisMetadata { + return IdentifiedGenesisMetadata.decode(message.value); + }, + toProto(message: IdentifiedGenesisMetadata): Uint8Array { + return IdentifiedGenesisMetadata.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", + value: IdentifiedGenesisMetadata.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/query.lcd.ts b/src/codegen/ibc/core/client/v1/query.lcd.ts index 1625599..5021f2e 100644 --- a/src/codegen/ibc/core/client/v1/query.lcd.ts +++ b/src/codegen/ibc/core/client/v1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryClientStateRequest, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -20,88 +19,65 @@ export class LCDQueryClient { this.upgradedConsensusState = this.upgradedConsensusState.bind(this); } /* ClientState queries an IBC light client. */ - - async clientState(params: QueryClientStateRequest): Promise { const endpoint = `ibc/core/client/v1/client_states/${params.clientId}`; return await this.req.get(endpoint); } /* ClientStates queries all the IBC light clients of a chain. */ - - async clientStates(params: QueryClientStatesRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `ibc/core/client/v1/client_states`; return await this.req.get(endpoint, options); } /* ConsensusState queries a consensus state associated with a client state at a given height. */ - - async consensusState(params: QueryConsensusStateRequest): Promise { const options: any = { params: {} }; - if (typeof params?.latestHeight !== "undefined") { options.params.latest_height = params.latestHeight; } - - const endpoint = `ibc/core/client/v1/consensus_states/${params.clientId}/revision/${params.revisionNumber}height/${params.revisionHeight}`; + const endpoint = `ibc/core/client/v1/consensus_states/${params.clientId}/revision/${params.revisionNumber}/height/${params.revisionHeight}`; return await this.req.get(endpoint, options); } /* ConsensusStates queries all the consensus state associated with a given client. */ - - async consensusStates(params: QueryConsensusStatesRequest): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `ibc/core/client/v1/consensus_states/${params.clientId}`; return await this.req.get(endpoint, options); } /* Status queries the status of an IBC client. */ - - async clientStatus(params: QueryClientStatusRequest): Promise { const endpoint = `ibc/core/client/v1/client_status/${params.clientId}`; return await this.req.get(endpoint); } /* ClientParams queries all parameters of the ibc client. */ - - async clientParams(_params: QueryClientParamsRequest = {}): Promise { const endpoint = `ibc/client/v1/params`; return await this.req.get(endpoint); } /* UpgradedClientState queries an Upgraded IBC light client. */ - - async upgradedClientState(_params: QueryUpgradedClientStateRequest = {}): Promise { const endpoint = `ibc/core/client/v1/upgraded_client_states`; return await this.req.get(endpoint); } /* UpgradedConsensusState queries an Upgraded IBC consensus state. */ - - async upgradedConsensusState(_params: QueryUpgradedConsensusStateRequest = {}): Promise { const endpoint = `ibc/core/client/v1/upgraded_consensus_states`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/query.rpc.Query.ts b/src/codegen/ibc/core/client/v1/query.rpc.Query.ts index 58429d5..c9e9553 100644 --- a/src/codegen/ibc/core/client/v1/query.rpc.Query.ts +++ b/src/codegen/ibc/core/client/v1/query.rpc.Query.ts @@ -1,43 +1,34 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryClientStateRequest, QueryClientStateResponse, QueryClientStatesRequest, QueryClientStatesResponse, QueryConsensusStateRequest, QueryConsensusStateResponse, QueryConsensusStatesRequest, QueryConsensusStatesResponse, QueryClientStatusRequest, QueryClientStatusResponse, QueryClientParamsRequest, QueryClientParamsResponse, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse } from "./query"; /** Query provides defines the gRPC querier service */ - export interface Query { /** ClientState queries an IBC light client. */ clientState(request: QueryClientStateRequest): Promise; /** ClientStates queries all the IBC light clients of a chain. */ - clientStates(request?: QueryClientStatesRequest): Promise; /** * ConsensusState queries a consensus state associated with a client state at * a given height. */ - consensusState(request: QueryConsensusStateRequest): Promise; /** * ConsensusStates queries all the consensus state associated with a given * client. */ - consensusStates(request: QueryConsensusStatesRequest): Promise; /** Status queries the status of an IBC client. */ - clientStatus(request: QueryClientStatusRequest): Promise; /** ClientParams queries all parameters of the ibc client. */ - clientParams(request?: QueryClientParamsRequest): Promise; /** UpgradedClientState queries an Upgraded IBC light client. */ - upgradedClientState(request?: QueryUpgradedClientStateRequest): Promise; /** UpgradedConsensusState queries an Upgraded IBC consensus state. */ - upgradedConsensusState(request?: QueryUpgradedConsensusStateRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.clientState = this.clientState.bind(this); @@ -49,57 +40,48 @@ export class QueryClientImpl implements Query { this.upgradedClientState = this.upgradedClientState.bind(this); this.upgradedConsensusState = this.upgradedConsensusState.bind(this); } - clientState(request: QueryClientStateRequest): Promise { const data = QueryClientStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientState", data); - return promise.then(data => QueryClientStateResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryClientStateResponse.decode(new BinaryReader(data))); } - clientStates(request: QueryClientStatesRequest = { pagination: undefined }): Promise { const data = QueryClientStatesRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientStates", data); - return promise.then(data => QueryClientStatesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryClientStatesResponse.decode(new BinaryReader(data))); } - consensusState(request: QueryConsensusStateRequest): Promise { const data = QueryConsensusStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "ConsensusState", data); - return promise.then(data => QueryConsensusStateResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryConsensusStateResponse.decode(new BinaryReader(data))); } - consensusStates(request: QueryConsensusStatesRequest): Promise { const data = QueryConsensusStatesRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "ConsensusStates", data); - return promise.then(data => QueryConsensusStatesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryConsensusStatesResponse.decode(new BinaryReader(data))); } - clientStatus(request: QueryClientStatusRequest): Promise { const data = QueryClientStatusRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientStatus", data); - return promise.then(data => QueryClientStatusResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryClientStatusResponse.decode(new BinaryReader(data))); } - clientParams(request: QueryClientParamsRequest = {}): Promise { const data = QueryClientParamsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientParams", data); - return promise.then(data => QueryClientParamsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryClientParamsResponse.decode(new BinaryReader(data))); } - upgradedClientState(request: QueryUpgradedClientStateRequest = {}): Promise { const data = QueryUpgradedClientStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedClientState", data); - return promise.then(data => QueryUpgradedClientStateResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryUpgradedClientStateResponse.decode(new BinaryReader(data))); } - upgradedConsensusState(request: QueryUpgradedConsensusStateRequest = {}): Promise { const data = QueryUpgradedConsensusStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedConsensusState", data); - return promise.then(data => QueryUpgradedConsensusStateResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryUpgradedConsensusStateResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -108,34 +90,26 @@ export const createRpcQueryExtension = (base: QueryClient) => { clientState(request: QueryClientStateRequest): Promise { return queryService.clientState(request); }, - clientStates(request?: QueryClientStatesRequest): Promise { return queryService.clientStates(request); }, - consensusState(request: QueryConsensusStateRequest): Promise { return queryService.consensusState(request); }, - consensusStates(request: QueryConsensusStatesRequest): Promise { return queryService.consensusStates(request); }, - clientStatus(request: QueryClientStatusRequest): Promise { return queryService.clientStatus(request); }, - clientParams(request?: QueryClientParamsRequest): Promise { return queryService.clientParams(request); }, - upgradedClientState(request?: QueryUpgradedClientStateRequest): Promise { return queryService.upgradedClientState(request); }, - upgradedConsensusState(request?: QueryUpgradedConsensusStateRequest): Promise { return queryService.upgradedConsensusState(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/query.ts b/src/codegen/ibc/core/client/v1/query.ts index 5dafa03..edeea04 100644 --- a/src/codegen/ibc/core/client/v1/query.ts +++ b/src/codegen/ibc/core/client/v1/query.ts @@ -1,24 +1,37 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightAmino, ConsensusStateWithHeightSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC * method */ - export interface QueryClientStateRequest { /** client state unique identifier */ clientId: string; } +export interface QueryClientStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStateRequest"; + value: Uint8Array; +} /** * QueryClientStateRequest is the request type for the Query/ClientState RPC * method */ - -export interface QueryClientStateRequestSDKType { +export interface QueryClientStateRequestAmino { /** client state unique identifier */ + client_id?: string; +} +export interface QueryClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryClientStateRequest"; + value: QueryClientStateRequestAmino; +} +/** + * QueryClientStateRequest is the request type for the Query/ClientState RPC + * method + */ +export interface QueryClientStateRequestSDKType { client_id: string; } /** @@ -26,73 +39,110 @@ export interface QueryClientStateRequestSDKType { * method. Besides the client state, it includes a proof and the height from * which the proof was retrieved. */ - export interface QueryClientStateResponse { /** client state associated with the request identifier */ clientState?: Any; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryClientStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStateResponse"; + value: Uint8Array; } /** * QueryClientStateResponse is the response type for the Query/ClientState RPC * method. Besides the client state, it includes a proof and the height from * which the proof was retrieved. */ - -export interface QueryClientStateResponseSDKType { +export interface QueryClientStateResponseAmino { /** client state associated with the request identifier */ - client_state?: AnySDKType; + client_state?: AnyAmino; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryClientStateResponse"; + value: QueryClientStateResponseAmino; +} +/** + * QueryClientStateResponse is the response type for the Query/ClientState RPC + * method. Besides the client state, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryClientStateResponseSDKType { + client_state?: AnySDKType; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryClientStatesRequest is the request type for the Query/ClientStates RPC * method */ - export interface QueryClientStatesRequest { /** pagination request */ pagination?: PageRequest; } +export interface QueryClientStatesRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest"; + value: Uint8Array; +} /** * QueryClientStatesRequest is the request type for the Query/ClientStates RPC * method */ - -export interface QueryClientStatesRequestSDKType { +export interface QueryClientStatesRequestAmino { /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryClientStatesRequestAminoMsg { + type: "cosmos-sdk/QueryClientStatesRequest"; + value: QueryClientStatesRequestAmino; +} +/** + * QueryClientStatesRequest is the request type for the Query/ClientStates RPC + * method + */ +export interface QueryClientStatesRequestSDKType { pagination?: PageRequestSDKType; } /** * QueryClientStatesResponse is the response type for the Query/ClientStates RPC * method. */ - export interface QueryClientStatesResponse { /** list of stored ClientStates of the chain. */ clientStates: IdentifiedClientState[]; /** pagination response */ - pagination?: PageResponse; } +export interface QueryClientStatesResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse"; + value: Uint8Array; +} /** * QueryClientStatesResponse is the response type for the Query/ClientStates RPC * method. */ - -export interface QueryClientStatesResponseSDKType { +export interface QueryClientStatesResponseAmino { /** list of stored ClientStates of the chain. */ - client_states: IdentifiedClientStateSDKType[]; + client_states?: IdentifiedClientStateAmino[]; /** pagination response */ - + pagination?: PageResponseAmino; +} +export interface QueryClientStatesResponseAminoMsg { + type: "cosmos-sdk/QueryClientStatesResponse"; + value: QueryClientStatesResponseAmino; +} +/** + * QueryClientStatesResponse is the response type for the Query/ClientStates RPC + * method. + */ +export interface QueryClientStatesResponseSDKType { + client_states: IdentifiedClientStateSDKType[]; pagination?: PageResponseSDKType; } /** @@ -100,154 +150,226 @@ export interface QueryClientStatesResponseSDKType { * RPC method. Besides the consensus state, it includes a proof and the height * from which the proof was retrieved. */ - export interface QueryConsensusStateRequest { /** client identifier */ clientId: string; /** consensus state revision number */ - - revisionNumber: Long; + revisionNumber: bigint; /** consensus state revision height */ - - revisionHeight: Long; + revisionHeight: bigint; /** * latest_height overrrides the height field and queries the latest stored * ConsensusState */ - latestHeight: boolean; } +export interface QueryConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest"; + value: Uint8Array; +} /** * QueryConsensusStateRequest is the request type for the Query/ConsensusState * RPC method. Besides the consensus state, it includes a proof and the height * from which the proof was retrieved. */ - -export interface QueryConsensusStateRequestSDKType { +export interface QueryConsensusStateRequestAmino { /** client identifier */ - client_id: string; + client_id?: string; /** consensus state revision number */ - - revision_number: Long; + revision_number?: string; /** consensus state revision height */ - - revision_height: Long; + revision_height?: string; /** * latest_height overrrides the height field and queries the latest stored * ConsensusState */ - + latest_height?: boolean; +} +export interface QueryConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryConsensusStateRequest"; + value: QueryConsensusStateRequestAmino; +} +/** + * QueryConsensusStateRequest is the request type for the Query/ConsensusState + * RPC method. Besides the consensus state, it includes a proof and the height + * from which the proof was retrieved. + */ +export interface QueryConsensusStateRequestSDKType { + client_id: string; + revision_number: bigint; + revision_height: bigint; latest_height: boolean; } /** * QueryConsensusStateResponse is the response type for the Query/ConsensusState * RPC method */ - export interface QueryConsensusStateResponse { /** consensus state associated with the client identifier at the given height */ consensusState?: Any; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse"; + value: Uint8Array; } /** * QueryConsensusStateResponse is the response type for the Query/ConsensusState * RPC method */ - -export interface QueryConsensusStateResponseSDKType { +export interface QueryConsensusStateResponseAmino { /** consensus state associated with the client identifier at the given height */ - consensus_state?: AnySDKType; + consensus_state?: AnyAmino; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryConsensusStateResponse"; + value: QueryConsensusStateResponseAmino; +} +/** + * QueryConsensusStateResponse is the response type for the Query/ConsensusState + * RPC method + */ +export interface QueryConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates * RPC method. */ - export interface QueryConsensusStatesRequest { /** client identifier */ clientId: string; /** pagination request */ - pagination?: PageRequest; } +export interface QueryConsensusStatesRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest"; + value: Uint8Array; +} /** * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates * RPC method. */ - -export interface QueryConsensusStatesRequestSDKType { +export interface QueryConsensusStatesRequestAmino { /** client identifier */ - client_id: string; + client_id?: string; /** pagination request */ - + pagination?: PageRequestAmino; +} +export interface QueryConsensusStatesRequestAminoMsg { + type: "cosmos-sdk/QueryConsensusStatesRequest"; + value: QueryConsensusStatesRequestAmino; +} +/** + * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates + * RPC method. + */ +export interface QueryConsensusStatesRequestSDKType { + client_id: string; pagination?: PageRequestSDKType; } /** * QueryConsensusStatesResponse is the response type for the * Query/ConsensusStates RPC method */ - export interface QueryConsensusStatesResponse { /** consensus states associated with the identifier */ consensusStates: ConsensusStateWithHeight[]; /** pagination response */ - pagination?: PageResponse; } +export interface QueryConsensusStatesResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse"; + value: Uint8Array; +} /** * QueryConsensusStatesResponse is the response type for the * Query/ConsensusStates RPC method */ - -export interface QueryConsensusStatesResponseSDKType { +export interface QueryConsensusStatesResponseAmino { /** consensus states associated with the identifier */ - consensus_states: ConsensusStateWithHeightSDKType[]; + consensus_states?: ConsensusStateWithHeightAmino[]; /** pagination response */ - + pagination?: PageResponseAmino; +} +export interface QueryConsensusStatesResponseAminoMsg { + type: "cosmos-sdk/QueryConsensusStatesResponse"; + value: QueryConsensusStatesResponseAmino; +} +/** + * QueryConsensusStatesResponse is the response type for the + * Query/ConsensusStates RPC method + */ +export interface QueryConsensusStatesResponseSDKType { + consensus_states: ConsensusStateWithHeightSDKType[]; pagination?: PageResponseSDKType; } /** * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC * method */ - export interface QueryClientStatusRequest { /** client unique identifier */ clientId: string; } +export interface QueryClientStatusRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest"; + value: Uint8Array; +} /** * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC * method */ - -export interface QueryClientStatusRequestSDKType { +export interface QueryClientStatusRequestAmino { /** client unique identifier */ + client_id?: string; +} +export interface QueryClientStatusRequestAminoMsg { + type: "cosmos-sdk/QueryClientStatusRequest"; + value: QueryClientStatusRequestAmino; +} +/** + * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC + * method + */ +export interface QueryClientStatusRequestSDKType { client_id: string; } /** * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC * method. It returns the current status of the IBC client. */ - export interface QueryClientStatusResponse { status: string; } +export interface QueryClientStatusResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse"; + value: Uint8Array; +} +/** + * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC + * method. It returns the current status of the IBC client. + */ +export interface QueryClientStatusResponseAmino { + status?: string; +} +export interface QueryClientStatusResponseAminoMsg { + type: "cosmos-sdk/QueryClientStatusResponse"; + value: QueryClientStatusResponseAmino; +} /** * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC * method. It returns the current status of the IBC client. */ - export interface QueryClientStatusResponseSDKType { status: string; } @@ -255,876 +377,1350 @@ export interface QueryClientStatusResponseSDKType { * QueryClientParamsRequest is the request type for the Query/ClientParams RPC * method. */ - export interface QueryClientParamsRequest {} +export interface QueryClientParamsRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest"; + value: Uint8Array; +} +/** + * QueryClientParamsRequest is the request type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsRequestAmino {} +export interface QueryClientParamsRequestAminoMsg { + type: "cosmos-sdk/QueryClientParamsRequest"; + value: QueryClientParamsRequestAmino; +} /** * QueryClientParamsRequest is the request type for the Query/ClientParams RPC * method. */ - export interface QueryClientParamsRequestSDKType {} /** * QueryClientParamsResponse is the response type for the Query/ClientParams RPC * method. */ - export interface QueryClientParamsResponse { /** params defines the parameters of the module. */ params?: Params; } +export interface QueryClientParamsResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse"; + value: Uint8Array; +} /** * QueryClientParamsResponse is the response type for the Query/ClientParams RPC * method. */ - -export interface QueryClientParamsResponseSDKType { +export interface QueryClientParamsResponseAmino { /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryClientParamsResponseAminoMsg { + type: "cosmos-sdk/QueryClientParamsResponse"; + value: QueryClientParamsResponseAmino; +} +/** + * QueryClientParamsResponse is the response type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsResponseSDKType { params?: ParamsSDKType; } /** * QueryUpgradedClientStateRequest is the request type for the * Query/UpgradedClientState RPC method */ - export interface QueryUpgradedClientStateRequest {} +export interface QueryUpgradedClientStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest"; + value: Uint8Array; +} +/** + * QueryUpgradedClientStateRequest is the request type for the + * Query/UpgradedClientState RPC method + */ +export interface QueryUpgradedClientStateRequestAmino {} +export interface QueryUpgradedClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedClientStateRequest"; + value: QueryUpgradedClientStateRequestAmino; +} /** * QueryUpgradedClientStateRequest is the request type for the * Query/UpgradedClientState RPC method */ - export interface QueryUpgradedClientStateRequestSDKType {} /** * QueryUpgradedClientStateResponse is the response type for the * Query/UpgradedClientState RPC method. */ - export interface QueryUpgradedClientStateResponse { /** client state associated with the request identifier */ upgradedClientState?: Any; } +export interface QueryUpgradedClientStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse"; + value: Uint8Array; +} /** * QueryUpgradedClientStateResponse is the response type for the * Query/UpgradedClientState RPC method. */ - -export interface QueryUpgradedClientStateResponseSDKType { +export interface QueryUpgradedClientStateResponseAmino { /** client state associated with the request identifier */ + upgraded_client_state?: AnyAmino; +} +export interface QueryUpgradedClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedClientStateResponse"; + value: QueryUpgradedClientStateResponseAmino; +} +/** + * QueryUpgradedClientStateResponse is the response type for the + * Query/UpgradedClientState RPC method. + */ +export interface QueryUpgradedClientStateResponseSDKType { upgraded_client_state?: AnySDKType; } /** * QueryUpgradedConsensusStateRequest is the request type for the * Query/UpgradedConsensusState RPC method */ - export interface QueryUpgradedConsensusStateRequest {} +export interface QueryUpgradedConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the + * Query/UpgradedConsensusState RPC method + */ +export interface QueryUpgradedConsensusStateRequestAmino {} +export interface QueryUpgradedConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest"; + value: QueryUpgradedConsensusStateRequestAmino; +} /** * QueryUpgradedConsensusStateRequest is the request type for the * Query/UpgradedConsensusState RPC method */ - export interface QueryUpgradedConsensusStateRequestSDKType {} /** * QueryUpgradedConsensusStateResponse is the response type for the * Query/UpgradedConsensusState RPC method. */ - export interface QueryUpgradedConsensusStateResponse { /** Consensus state associated with the request identifier */ upgradedConsensusState?: Any; } +export interface QueryUpgradedConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse"; + value: Uint8Array; +} /** * QueryUpgradedConsensusStateResponse is the response type for the * Query/UpgradedConsensusState RPC method. */ - -export interface QueryUpgradedConsensusStateResponseSDKType { +export interface QueryUpgradedConsensusStateResponseAmino { /** Consensus state associated with the request identifier */ + upgraded_consensus_state?: AnyAmino; +} +export interface QueryUpgradedConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse"; + value: QueryUpgradedConsensusStateResponseAmino; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the + * Query/UpgradedConsensusState RPC method. + */ +export interface QueryUpgradedConsensusStateResponseSDKType { upgraded_consensus_state?: AnySDKType; } - function createBaseQueryClientStateRequest(): QueryClientStateRequest { return { clientId: "" }; } - export const QueryClientStateRequest = { - encode(message: QueryClientStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", + encode(message: QueryClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientStateRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientStateRequest { + fromPartial(object: Partial): QueryClientStateRequest { const message = createBaseQueryClientStateRequest(); message.clientId = object.clientId ?? ""; return message; + }, + fromAmino(object: QueryClientStateRequestAmino): QueryClientStateRequest { + const message = createBaseQueryClientStateRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + return message; + }, + toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + return obj; + }, + fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { + return QueryClientStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStateRequest): QueryClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStateRequest", + value: QueryClientStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStateRequestProtoMsg): QueryClientStateRequest { + return QueryClientStateRequest.decode(message.value); + }, + toProto(message: QueryClientStateRequest): Uint8Array { + return QueryClientStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStateRequest): QueryClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", + value: QueryClientStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryClientStateResponse(): QueryClientStateResponse { return { clientState: undefined, proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryClientStateResponse = { - encode(message: QueryClientStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", + encode(message: QueryClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientStateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientStateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientState = Any.decode(reader, reader.uint32()); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientStateResponse { + fromPartial(object: Partial): QueryClientStateResponse { const message = createBaseQueryClientStateResponse(); message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryClientStateResponseAmino): QueryClientStateResponse { + const message = createBaseQueryClientStateResponse(); + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryClientStateResponse): QueryClientStateResponseAmino { + const obj: any = {}; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryClientStateResponseAminoMsg): QueryClientStateResponse { + return QueryClientStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStateResponse): QueryClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStateResponse", + value: QueryClientStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStateResponseProtoMsg): QueryClientStateResponse { + return QueryClientStateResponse.decode(message.value); + }, + toProto(message: QueryClientStateResponse): Uint8Array { + return QueryClientStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStateResponse): QueryClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", + value: QueryClientStateResponse.encode(message).finish() + }; } - }; - function createBaseQueryClientStatesRequest(): QueryClientStatesRequest { return { pagination: undefined }; } - export const QueryClientStatesRequest = { - encode(message: QueryClientStatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", + encode(message: QueryClientStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientStatesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStatesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientStatesRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientStatesRequest { + fromPartial(object: Partial): QueryClientStatesRequest { const message = createBaseQueryClientStatesRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryClientStatesRequestAmino): QueryClientStatesRequest { + const message = createBaseQueryClientStatesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryClientStatesRequest): QueryClientStatesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClientStatesRequestAminoMsg): QueryClientStatesRequest { + return QueryClientStatesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStatesRequest): QueryClientStatesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatesRequest", + value: QueryClientStatesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStatesRequestProtoMsg): QueryClientStatesRequest { + return QueryClientStatesRequest.decode(message.value); + }, + toProto(message: QueryClientStatesRequest): Uint8Array { + return QueryClientStatesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStatesRequest): QueryClientStatesRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", + value: QueryClientStatesRequest.encode(message).finish() + }; } - }; - function createBaseQueryClientStatesResponse(): QueryClientStatesResponse { return { clientStates: [], pagination: undefined }; } - export const QueryClientStatesResponse = { - encode(message: QueryClientStatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", + encode(message: QueryClientStatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.clientStates) { IdentifiedClientState.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): QueryClientStatesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientStatesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientStates.push(IdentifiedClientState.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientStatesResponse { + fromPartial(object: Partial): QueryClientStatesResponse { const message = createBaseQueryClientStatesResponse(); message.clientStates = object.clientStates?.map(e => IdentifiedClientState.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryClientStatesResponseAmino): QueryClientStatesResponse { + const message = createBaseQueryClientStatesResponse(); + message.clientStates = object.client_states?.map(e => IdentifiedClientState.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryClientStatesResponse): QueryClientStatesResponseAmino { + const obj: any = {}; + if (message.clientStates) { + obj.client_states = message.clientStates.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); + } else { + obj.client_states = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClientStatesResponseAminoMsg): QueryClientStatesResponse { + return QueryClientStatesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStatesResponse): QueryClientStatesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatesResponse", + value: QueryClientStatesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStatesResponseProtoMsg): QueryClientStatesResponse { + return QueryClientStatesResponse.decode(message.value); + }, + toProto(message: QueryClientStatesResponse): Uint8Array { + return QueryClientStatesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStatesResponse): QueryClientStatesResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", + value: QueryClientStatesResponse.encode(message).finish() + }; } - }; - function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { return { clientId: "", - revisionNumber: Long.UZERO, - revisionHeight: Long.UZERO, + revisionNumber: BigInt(0), + revisionHeight: BigInt(0), latestHeight: false }; } - export const QueryConsensusStateRequest = { - encode(message: QueryConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", + encode(message: QueryConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - - if (!message.revisionNumber.isZero()) { + if (message.revisionNumber !== BigInt(0)) { writer.uint32(16).uint64(message.revisionNumber); } - - if (!message.revisionHeight.isZero()) { + if (message.revisionHeight !== BigInt(0)) { writer.uint32(24).uint64(message.revisionHeight); } - if (message.latestHeight === true) { writer.uint32(32).bool(message.latestHeight); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConsensusStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConsensusStateRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: - message.revisionNumber = (reader.uint64() as Long); + message.revisionNumber = reader.uint64(); break; - case 3: - message.revisionHeight = (reader.uint64() as Long); + message.revisionHeight = reader.uint64(); break; - case 4: message.latestHeight = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConsensusStateRequest { + fromPartial(object: Partial): QueryConsensusStateRequest { const message = createBaseQueryConsensusStateRequest(); message.clientId = object.clientId ?? ""; - message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? Long.fromValue(object.revisionNumber) : Long.UZERO; - message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? Long.fromValue(object.revisionHeight) : Long.UZERO; + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); message.latestHeight = object.latestHeight ?? false; return message; + }, + fromAmino(object: QueryConsensusStateRequestAmino): QueryConsensusStateRequest { + const message = createBaseQueryConsensusStateRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.revision_number !== undefined && object.revision_number !== null) { + message.revisionNumber = BigInt(object.revision_number); + } + if (object.revision_height !== undefined && object.revision_height !== null) { + message.revisionHeight = BigInt(object.revision_height); + } + if (object.latest_height !== undefined && object.latest_height !== null) { + message.latestHeight = object.latest_height; + } + return message; + }, + toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.latest_height = message.latestHeight; + return obj; + }, + fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { + return QueryConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStateRequest): QueryConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateRequest", + value: QueryConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStateRequestProtoMsg): QueryConsensusStateRequest { + return QueryConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryConsensusStateRequest): Uint8Array { + return QueryConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStateRequest): QueryConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", + value: QueryConsensusStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryConsensusStateResponse(): QueryConsensusStateResponse { return { consensusState: undefined, proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryConsensusStateResponse = { - encode(message: QueryConsensusStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", + encode(message: QueryConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConsensusStateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConsensusStateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.consensusState = Any.decode(reader, reader.uint32()); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConsensusStateResponse { + fromPartial(object: Partial): QueryConsensusStateResponse { const message = createBaseQueryConsensusStateResponse(); message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryConsensusStateResponseAmino): QueryConsensusStateResponse { + const message = createBaseQueryConsensusStateResponse(); + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryConsensusStateResponse): QueryConsensusStateResponseAmino { + const obj: any = {}; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryConsensusStateResponseAminoMsg): QueryConsensusStateResponse { + return QueryConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStateResponse): QueryConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateResponse", + value: QueryConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStateResponseProtoMsg): QueryConsensusStateResponse { + return QueryConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryConsensusStateResponse): Uint8Array { + return QueryConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStateResponse): QueryConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", + value: QueryConsensusStateResponse.encode(message).finish() + }; } - }; - function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { return { clientId: "", pagination: undefined }; } - export const QueryConsensusStatesRequest = { - encode(message: QueryConsensusStatesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", + encode(message: QueryConsensusStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConsensusStatesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStatesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConsensusStatesRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConsensusStatesRequest { + fromPartial(object: Partial): QueryConsensusStatesRequest { const message = createBaseQueryConsensusStatesRequest(); message.clientId = object.clientId ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryConsensusStatesRequestAmino): QueryConsensusStatesRequest { + const message = createBaseQueryConsensusStatesRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConsensusStatesRequestAminoMsg): QueryConsensusStatesRequest { + return QueryConsensusStatesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStatesRequest", + value: QueryConsensusStatesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStatesRequestProtoMsg): QueryConsensusStatesRequest { + return QueryConsensusStatesRequest.decode(message.value); + }, + toProto(message: QueryConsensusStatesRequest): Uint8Array { + return QueryConsensusStatesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", + value: QueryConsensusStatesRequest.encode(message).finish() + }; } - }; - function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse { return { consensusStates: [], pagination: undefined }; } - export const QueryConsensusStatesResponse = { - encode(message: QueryConsensusStatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", + encode(message: QueryConsensusStatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.consensusStates) { ConsensusStateWithHeight.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): QueryConsensusStatesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConsensusStatesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.consensusStates.push(ConsensusStateWithHeight.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConsensusStatesResponse { + fromPartial(object: Partial): QueryConsensusStatesResponse { const message = createBaseQueryConsensusStatesResponse(); message.consensusStates = object.consensusStates?.map(e => ConsensusStateWithHeight.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryConsensusStatesResponseAmino): QueryConsensusStatesResponse { + const message = createBaseQueryConsensusStatesResponse(); + message.consensusStates = object.consensus_states?.map(e => ConsensusStateWithHeight.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConsensusStatesResponse): QueryConsensusStatesResponseAmino { + const obj: any = {}; + if (message.consensusStates) { + obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); + } else { + obj.consensus_states = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConsensusStatesResponseAminoMsg): QueryConsensusStatesResponse { + return QueryConsensusStatesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStatesResponse): QueryConsensusStatesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStatesResponse", + value: QueryConsensusStatesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStatesResponseProtoMsg): QueryConsensusStatesResponse { + return QueryConsensusStatesResponse.decode(message.value); + }, + toProto(message: QueryConsensusStatesResponse): Uint8Array { + return QueryConsensusStatesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStatesResponse): QueryConsensusStatesResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", + value: QueryConsensusStatesResponse.encode(message).finish() + }; } - }; - function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { return { clientId: "" }; } - export const QueryClientStatusRequest = { - encode(message: QueryClientStatusRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", + encode(message: QueryClientStatusRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientStatusRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientStatusRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientStatusRequest { + fromPartial(object: Partial): QueryClientStatusRequest { const message = createBaseQueryClientStatusRequest(); message.clientId = object.clientId ?? ""; return message; + }, + fromAmino(object: QueryClientStatusRequestAmino): QueryClientStatusRequest { + const message = createBaseQueryClientStatusRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + return message; + }, + toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + return obj; + }, + fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { + return QueryClientStatusRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStatusRequest): QueryClientStatusRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatusRequest", + value: QueryClientStatusRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStatusRequestProtoMsg): QueryClientStatusRequest { + return QueryClientStatusRequest.decode(message.value); + }, + toProto(message: QueryClientStatusRequest): Uint8Array { + return QueryClientStatusRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStatusRequest): QueryClientStatusRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", + value: QueryClientStatusRequest.encode(message).finish() + }; } - }; - function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { return { status: "" }; } - export const QueryClientStatusResponse = { - encode(message: QueryClientStatusResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", + encode(message: QueryClientStatusResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.status !== "") { writer.uint32(10).string(message.status); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientStatusResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientStatusResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.status = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientStatusResponse { + fromPartial(object: Partial): QueryClientStatusResponse { const message = createBaseQueryClientStatusResponse(); message.status = object.status ?? ""; return message; + }, + fromAmino(object: QueryClientStatusResponseAmino): QueryClientStatusResponse { + const message = createBaseQueryClientStatusResponse(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + return message; + }, + toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { + const obj: any = {}; + obj.status = message.status; + return obj; + }, + fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { + return QueryClientStatusResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStatusResponse): QueryClientStatusResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatusResponse", + value: QueryClientStatusResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStatusResponseProtoMsg): QueryClientStatusResponse { + return QueryClientStatusResponse.decode(message.value); + }, + toProto(message: QueryClientStatusResponse): Uint8Array { + return QueryClientStatusResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStatusResponse): QueryClientStatusResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", + value: QueryClientStatusResponse.encode(message).finish() + }; } - }; - function createBaseQueryClientParamsRequest(): QueryClientParamsRequest { return {}; } - export const QueryClientParamsRequest = { - encode(_: QueryClientParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", + encode(_: QueryClientParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientParamsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryClientParamsRequest { + fromPartial(_: Partial): QueryClientParamsRequest { + const message = createBaseQueryClientParamsRequest(); + return message; + }, + fromAmino(_: QueryClientParamsRequestAmino): QueryClientParamsRequest { const message = createBaseQueryClientParamsRequest(); return message; + }, + toAmino(_: QueryClientParamsRequest): QueryClientParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryClientParamsRequestAminoMsg): QueryClientParamsRequest { + return QueryClientParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientParamsRequest): QueryClientParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientParamsRequest", + value: QueryClientParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientParamsRequestProtoMsg): QueryClientParamsRequest { + return QueryClientParamsRequest.decode(message.value); + }, + toProto(message: QueryClientParamsRequest): Uint8Array { + return QueryClientParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientParamsRequest): QueryClientParamsRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", + value: QueryClientParamsRequest.encode(message).finish() + }; } - }; - function createBaseQueryClientParamsResponse(): QueryClientParamsResponse { return { params: undefined }; } - export const QueryClientParamsResponse = { - encode(message: QueryClientParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", + encode(message: QueryClientParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientParamsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientParamsResponse { + fromPartial(object: Partial): QueryClientParamsResponse { const message = createBaseQueryClientParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryClientParamsResponseAmino): QueryClientParamsResponse { + const message = createBaseQueryClientParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryClientParamsResponse): QueryClientParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClientParamsResponseAminoMsg): QueryClientParamsResponse { + return QueryClientParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientParamsResponse): QueryClientParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientParamsResponse", + value: QueryClientParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientParamsResponseProtoMsg): QueryClientParamsResponse { + return QueryClientParamsResponse.decode(message.value); + }, + toProto(message: QueryClientParamsResponse): Uint8Array { + return QueryClientParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientParamsResponse): QueryClientParamsResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", + value: QueryClientParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRequest { return {}; } - export const QueryUpgradedClientStateRequest = { - encode(_: QueryUpgradedClientStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", + encode(_: QueryUpgradedClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedClientStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedClientStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUpgradedClientStateRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryUpgradedClientStateRequest { + fromPartial(_: Partial): QueryUpgradedClientStateRequest { const message = createBaseQueryUpgradedClientStateRequest(); return message; + }, + fromAmino(_: QueryUpgradedClientStateRequestAmino): QueryUpgradedClientStateRequest { + const message = createBaseQueryUpgradedClientStateRequest(); + return message; + }, + toAmino(_: QueryUpgradedClientStateRequest): QueryUpgradedClientStateRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryUpgradedClientStateRequestAminoMsg): QueryUpgradedClientStateRequest { + return QueryUpgradedClientStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedClientStateRequest): QueryUpgradedClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedClientStateRequest", + value: QueryUpgradedClientStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedClientStateRequestProtoMsg): QueryUpgradedClientStateRequest { + return QueryUpgradedClientStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedClientStateRequest): Uint8Array { + return QueryUpgradedClientStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedClientStateRequest): QueryUpgradedClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", + value: QueryUpgradedClientStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryUpgradedClientStateResponse(): QueryUpgradedClientStateResponse { return { upgradedClientState: undefined }; } - export const QueryUpgradedClientStateResponse = { - encode(message: QueryUpgradedClientStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", + encode(message: QueryUpgradedClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.upgradedClientState !== undefined) { Any.encode(message.upgradedClientState, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedClientStateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedClientStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryUpgradedClientStateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.upgradedClientState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUpgradedClientStateResponse { + fromPartial(object: Partial): QueryUpgradedClientStateResponse { const message = createBaseQueryUpgradedClientStateResponse(); message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; return message; + }, + fromAmino(object: QueryUpgradedClientStateResponseAmino): QueryUpgradedClientStateResponse { + const message = createBaseQueryUpgradedClientStateResponse(); + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + return message; + }, + toAmino(message: QueryUpgradedClientStateResponse): QueryUpgradedClientStateResponseAmino { + const obj: any = {}; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + return obj; + }, + fromAminoMsg(object: QueryUpgradedClientStateResponseAminoMsg): QueryUpgradedClientStateResponse { + return QueryUpgradedClientStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedClientStateResponse): QueryUpgradedClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedClientStateResponse", + value: QueryUpgradedClientStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedClientStateResponseProtoMsg): QueryUpgradedClientStateResponse { + return QueryUpgradedClientStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedClientStateResponse): Uint8Array { + return QueryUpgradedClientStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedClientStateResponse): QueryUpgradedClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", + value: QueryUpgradedClientStateResponse.encode(message).finish() + }; } - }; - function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { return {}; } - export const QueryUpgradedConsensusStateRequest = { - encode(_: QueryUpgradedConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", + encode(_: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryUpgradedConsensusStateRequest { + fromPartial(_: Partial): QueryUpgradedConsensusStateRequest { const message = createBaseQueryUpgradedConsensusStateRequest(); return message; + }, + fromAmino(_: QueryUpgradedConsensusStateRequestAmino): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + return message; + }, + toAmino(_: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedConsensusStateRequestProtoMsg): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateRequest): Uint8Array { + return QueryUpgradedConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { return { upgradedConsensusState: undefined }; } - export const QueryUpgradedConsensusStateResponse = { - encode(message: QueryUpgradedConsensusStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.upgradedConsensusState !== undefined) { Any.encode(message.upgradedConsensusState, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.upgradedConsensusState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryUpgradedConsensusStateResponse { + fromPartial(object: Partial): QueryUpgradedConsensusStateResponse { const message = createBaseQueryUpgradedConsensusStateResponse(); message.upgradedConsensusState = object.upgradedConsensusState !== undefined && object.upgradedConsensusState !== null ? Any.fromPartial(object.upgradedConsensusState) : undefined; return message; + }, + fromAmino(object: QueryUpgradedConsensusStateResponseAmino): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + if (object.upgraded_consensus_state !== undefined && object.upgraded_consensus_state !== null) { + message.upgradedConsensusState = Any.fromAmino(object.upgraded_consensus_state); + } + return message; + }, + toAmino(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseAmino { + const obj: any = {}; + obj.upgraded_consensus_state = message.upgradedConsensusState ? Any.toAmino(message.upgradedConsensusState) : undefined; + return obj; + }, + fromAminoMsg(object: QueryUpgradedConsensusStateResponseAminoMsg): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedConsensusStateResponseProtoMsg): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateResponse): Uint8Array { + return QueryUpgradedConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/tx.amino.ts b/src/codegen/ibc/core/client/v1/tx.amino.ts index b6e162a..a3cd386 100644 --- a/src/codegen/ibc/core/client/v1/tx.amino.ts +++ b/src/codegen/ibc/core/client/v1/tx.amino.ts @@ -1,205 +1,23 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; -export interface AminoMsgCreateClient extends AminoMsg { - type: "cosmos-sdk/MsgCreateClient"; - value: { - client_state: { - type_url: string; - value: Uint8Array; - }; - consensus_state: { - type_url: string; - value: Uint8Array; - }; - signer: string; - }; -} -export interface AminoMsgUpdateClient extends AminoMsg { - type: "cosmos-sdk/MsgUpdateClient"; - value: { - client_id: string; - header: { - type_url: string; - value: Uint8Array; - }; - signer: string; - }; -} -export interface AminoMsgUpgradeClient extends AminoMsg { - type: "cosmos-sdk/MsgUpgradeClient"; - value: { - client_id: string; - client_state: { - type_url: string; - value: Uint8Array; - }; - consensus_state: { - type_url: string; - value: Uint8Array; - }; - proof_upgrade_client: Uint8Array; - proof_upgrade_consensus_state: Uint8Array; - signer: string; - }; -} -export interface AminoMsgSubmitMisbehaviour extends AminoMsg { - type: "cosmos-sdk/MsgSubmitMisbehaviour"; - value: { - client_id: string; - misbehaviour: { - type_url: string; - value: Uint8Array; - }; - signer: string; - }; -} export const AminoConverter = { "/ibc.core.client.v1.MsgCreateClient": { aminoType: "cosmos-sdk/MsgCreateClient", - toAmino: ({ - clientState, - consensusState, - signer - }: MsgCreateClient): AminoMsgCreateClient["value"] => { - return { - client_state: { - type_url: clientState.typeUrl, - value: clientState.value - }, - consensus_state: { - type_url: consensusState.typeUrl, - value: consensusState.value - }, - signer - }; - }, - fromAmino: ({ - client_state, - consensus_state, - signer - }: AminoMsgCreateClient["value"]): MsgCreateClient => { - return { - clientState: { - typeUrl: client_state.type_url, - value: client_state.value - }, - consensusState: { - typeUrl: consensus_state.type_url, - value: consensus_state.value - }, - signer - }; - } + toAmino: MsgCreateClient.toAmino, + fromAmino: MsgCreateClient.fromAmino }, "/ibc.core.client.v1.MsgUpdateClient": { aminoType: "cosmos-sdk/MsgUpdateClient", - toAmino: ({ - clientId, - header, - signer - }: MsgUpdateClient): AminoMsgUpdateClient["value"] => { - return { - client_id: clientId, - header: { - type_url: header.typeUrl, - value: header.value - }, - signer - }; - }, - fromAmino: ({ - client_id, - header, - signer - }: AminoMsgUpdateClient["value"]): MsgUpdateClient => { - return { - clientId: client_id, - header: { - typeUrl: header.type_url, - value: header.value - }, - signer - }; - } + toAmino: MsgUpdateClient.toAmino, + fromAmino: MsgUpdateClient.fromAmino }, "/ibc.core.client.v1.MsgUpgradeClient": { aminoType: "cosmos-sdk/MsgUpgradeClient", - toAmino: ({ - clientId, - clientState, - consensusState, - proofUpgradeClient, - proofUpgradeConsensusState, - signer - }: MsgUpgradeClient): AminoMsgUpgradeClient["value"] => { - return { - client_id: clientId, - client_state: { - type_url: clientState.typeUrl, - value: clientState.value - }, - consensus_state: { - type_url: consensusState.typeUrl, - value: consensusState.value - }, - proof_upgrade_client: proofUpgradeClient, - proof_upgrade_consensus_state: proofUpgradeConsensusState, - signer - }; - }, - fromAmino: ({ - client_id, - client_state, - consensus_state, - proof_upgrade_client, - proof_upgrade_consensus_state, - signer - }: AminoMsgUpgradeClient["value"]): MsgUpgradeClient => { - return { - clientId: client_id, - clientState: { - typeUrl: client_state.type_url, - value: client_state.value - }, - consensusState: { - typeUrl: consensus_state.type_url, - value: consensus_state.value - }, - proofUpgradeClient: proof_upgrade_client, - proofUpgradeConsensusState: proof_upgrade_consensus_state, - signer - }; - } + toAmino: MsgUpgradeClient.toAmino, + fromAmino: MsgUpgradeClient.fromAmino }, "/ibc.core.client.v1.MsgSubmitMisbehaviour": { aminoType: "cosmos-sdk/MsgSubmitMisbehaviour", - toAmino: ({ - clientId, - misbehaviour, - signer - }: MsgSubmitMisbehaviour): AminoMsgSubmitMisbehaviour["value"] => { - return { - client_id: clientId, - misbehaviour: { - type_url: misbehaviour.typeUrl, - value: misbehaviour.value - }, - signer - }; - }, - fromAmino: ({ - client_id, - misbehaviour, - signer - }: AminoMsgSubmitMisbehaviour["value"]): MsgSubmitMisbehaviour => { - return { - clientId: client_id, - misbehaviour: { - typeUrl: misbehaviour.type_url, - value: misbehaviour.value - }, - signer - }; - } + toAmino: MsgSubmitMisbehaviour.toAmino, + fromAmino: MsgSubmitMisbehaviour.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/tx.registry.ts b/src/codegen/ibc/core/client/v1/tx.registry.ts index 461eccd..a3582cd 100644 --- a/src/codegen/ibc/core/client/v1/tx.registry.ts +++ b/src/codegen/ibc/core/client/v1/tx.registry.ts @@ -14,28 +14,24 @@ export const MessageComposer = { value: MsgCreateClient.encode(value).finish() }; }, - updateClient(value: MsgUpdateClient) { return { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", value: MsgUpdateClient.encode(value).finish() }; }, - upgradeClient(value: MsgUpgradeClient) { return { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", value: MsgUpgradeClient.encode(value).finish() }; }, - submitMisbehaviour(value: MsgSubmitMisbehaviour) { return { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", value: MsgSubmitMisbehaviour.encode(value).finish() }; } - }, withTypeUrl: { createClient(value: MsgCreateClient) { @@ -44,28 +40,24 @@ export const MessageComposer = { value }; }, - updateClient(value: MsgUpdateClient) { return { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", value }; }, - upgradeClient(value: MsgUpgradeClient) { return { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", value }; }, - submitMisbehaviour(value: MsgSubmitMisbehaviour) { return { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", value }; } - }, fromPartial: { createClient(value: MsgCreateClient) { @@ -74,27 +66,23 @@ export const MessageComposer = { value: MsgCreateClient.fromPartial(value) }; }, - updateClient(value: MsgUpdateClient) { return { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", value: MsgUpdateClient.fromPartial(value) }; }, - upgradeClient(value: MsgUpgradeClient) { return { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", value: MsgUpgradeClient.fromPartial(value) }; }, - submitMisbehaviour(value: MsgSubmitMisbehaviour) { return { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", value: MsgSubmitMisbehaviour.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/tx.rpc.msg.ts b/src/codegen/ibc/core/client/v1/tx.rpc.msg.ts index 3197da3..29890ac 100644 --- a/src/codegen/ibc/core/client/v1/tx.rpc.msg.ts +++ b/src/codegen/ibc/core/client/v1/tx.rpc.msg.ts @@ -1,24 +1,19 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { MsgCreateClient, MsgCreateClientResponse, MsgUpdateClient, MsgUpdateClientResponse, MsgUpgradeClient, MsgUpgradeClientResponse, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourResponse } from "./tx"; /** Msg defines the ibc/client Msg service. */ - export interface Msg { /** CreateClient defines a rpc handler method for MsgCreateClient. */ createClient(request: MsgCreateClient): Promise; /** UpdateClient defines a rpc handler method for MsgUpdateClient. */ - updateClient(request: MsgUpdateClient): Promise; /** UpgradeClient defines a rpc handler method for MsgUpgradeClient. */ - upgradeClient(request: MsgUpgradeClient): Promise; /** SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. */ - submitMisbehaviour(request: MsgSubmitMisbehaviour): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.createClient = this.createClient.bind(this); @@ -26,29 +21,24 @@ export class MsgClientImpl implements Msg { this.upgradeClient = this.upgradeClient.bind(this); this.submitMisbehaviour = this.submitMisbehaviour.bind(this); } - createClient(request: MsgCreateClient): Promise { const data = MsgCreateClient.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Msg", "CreateClient", data); - return promise.then(data => MsgCreateClientResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgCreateClientResponse.decode(new BinaryReader(data))); } - updateClient(request: MsgUpdateClient): Promise { const data = MsgUpdateClient.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpdateClient", data); - return promise.then(data => MsgUpdateClientResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgUpdateClientResponse.decode(new BinaryReader(data))); } - upgradeClient(request: MsgUpgradeClient): Promise { const data = MsgUpgradeClient.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpgradeClient", data); - return promise.then(data => MsgUpgradeClientResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgUpgradeClientResponse.decode(new BinaryReader(data))); } - submitMisbehaviour(request: MsgSubmitMisbehaviour): Promise { const data = MsgSubmitMisbehaviour.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Msg", "SubmitMisbehaviour", data); - return promise.then(data => MsgSubmitMisbehaviourResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgSubmitMisbehaviourResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/ibc/core/client/v1/tx.ts b/src/codegen/ibc/core/client/v1/tx.ts index a9a609e..3b6dd16 100644 --- a/src/codegen/ibc/core/client/v1/tx.ts +++ b/src/codegen/ibc/core/client/v1/tx.ts @@ -1,8 +1,7 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** MsgCreateClient defines a message to create an IBC client */ - export interface MsgCreateClient { /** light client state */ clientState?: Any; @@ -10,172 +9,245 @@ export interface MsgCreateClient { * consensus state associated with the client that corresponds to a given * height. */ - consensusState?: Any; /** signer address */ - signer: string; } +export interface MsgCreateClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgCreateClient"; + value: Uint8Array; +} /** MsgCreateClient defines a message to create an IBC client */ - -export interface MsgCreateClientSDKType { +export interface MsgCreateClientAmino { /** light client state */ - client_state?: AnySDKType; + client_state?: AnyAmino; /** * consensus state associated with the client that corresponds to a given * height. */ - - consensus_state?: AnySDKType; + consensus_state?: AnyAmino; /** signer address */ - + signer?: string; +} +export interface MsgCreateClientAminoMsg { + type: "cosmos-sdk/MsgCreateClient"; + value: MsgCreateClientAmino; +} +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClientSDKType { + client_state?: AnySDKType; + consensus_state?: AnySDKType; signer: string; } /** MsgCreateClientResponse defines the Msg/CreateClient response type. */ - export interface MsgCreateClientResponse {} +export interface MsgCreateClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse"; + value: Uint8Array; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponseAmino {} +export interface MsgCreateClientResponseAminoMsg { + type: "cosmos-sdk/MsgCreateClientResponse"; + value: MsgCreateClientResponseAmino; +} /** MsgCreateClientResponse defines the Msg/CreateClient response type. */ - export interface MsgCreateClientResponseSDKType {} /** * MsgUpdateClient defines an sdk.Msg to update a IBC client state using * the given header. */ - export interface MsgUpdateClient { /** client unique identifier */ clientId: string; /** header to update the light client */ - header?: Any; /** signer address */ - signer: string; } +export interface MsgUpdateClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient"; + value: Uint8Array; +} /** * MsgUpdateClient defines an sdk.Msg to update a IBC client state using * the given header. */ - -export interface MsgUpdateClientSDKType { +export interface MsgUpdateClientAmino { /** client unique identifier */ - client_id: string; + client_id?: string; /** header to update the light client */ - - header?: AnySDKType; + header?: AnyAmino; /** signer address */ - + signer?: string; +} +export interface MsgUpdateClientAminoMsg { + type: "cosmos-sdk/MsgUpdateClient"; + value: MsgUpdateClientAmino; +} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given header. + */ +export interface MsgUpdateClientSDKType { + client_id: string; + header?: AnySDKType; signer: string; } /** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ - export interface MsgUpdateClientResponse {} +export interface MsgUpdateClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse"; + value: Uint8Array; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponseAmino {} +export interface MsgUpdateClientResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateClientResponse"; + value: MsgUpdateClientResponseAmino; +} /** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ - export interface MsgUpdateClientResponseSDKType {} /** * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client * state */ - export interface MsgUpgradeClient { /** client unique identifier */ clientId: string; /** upgraded client state */ - clientState?: Any; /** * upgraded consensus state, only contains enough information to serve as a * basis of trust in update logic */ - consensusState?: Any; /** proof that old chain committed to new client */ - proofUpgradeClient: Uint8Array; /** proof that old chain committed to new consensus state */ - proofUpgradeConsensusState: Uint8Array; /** signer address */ - signer: string; } +export interface MsgUpgradeClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient"; + value: Uint8Array; +} /** * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client * state */ - -export interface MsgUpgradeClientSDKType { +export interface MsgUpgradeClientAmino { /** client unique identifier */ - client_id: string; + client_id?: string; /** upgraded client state */ - - client_state?: AnySDKType; + client_state?: AnyAmino; /** * upgraded consensus state, only contains enough information to serve as a * basis of trust in update logic */ - - consensus_state?: AnySDKType; + consensus_state?: AnyAmino; /** proof that old chain committed to new client */ - - proof_upgrade_client: Uint8Array; + proof_upgrade_client?: string; /** proof that old chain committed to new consensus state */ - - proof_upgrade_consensus_state: Uint8Array; + proof_upgrade_consensus_state?: string; /** signer address */ - + signer?: string; +} +export interface MsgUpgradeClientAminoMsg { + type: "cosmos-sdk/MsgUpgradeClient"; + value: MsgUpgradeClientAmino; +} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClientSDKType { + client_id: string; + client_state?: AnySDKType; + consensus_state?: AnySDKType; + proof_upgrade_client: Uint8Array; + proof_upgrade_consensus_state: Uint8Array; signer: string; } /** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ - export interface MsgUpgradeClientResponse {} +export interface MsgUpgradeClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse"; + value: Uint8Array; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponseAmino {} +export interface MsgUpgradeClientResponseAminoMsg { + type: "cosmos-sdk/MsgUpgradeClientResponse"; + value: MsgUpgradeClientResponseAmino; +} /** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ - export interface MsgUpgradeClientResponseSDKType {} /** * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for * light client misbehaviour. */ - export interface MsgSubmitMisbehaviour { /** client unique identifier */ clientId: string; /** misbehaviour used for freezing the light client */ - misbehaviour?: Any; /** signer address */ - signer: string; } +export interface MsgSubmitMisbehaviourProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour"; + value: Uint8Array; +} /** * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for * light client misbehaviour. */ - -export interface MsgSubmitMisbehaviourSDKType { +export interface MsgSubmitMisbehaviourAmino { /** client unique identifier */ - client_id: string; + client_id?: string; /** misbehaviour used for freezing the light client */ - - misbehaviour?: AnySDKType; + misbehaviour?: AnyAmino; /** signer address */ - + signer?: string; +} +export interface MsgSubmitMisbehaviourAminoMsg { + type: "cosmos-sdk/MsgSubmitMisbehaviour"; + value: MsgSubmitMisbehaviourAmino; +} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + */ +export interface MsgSubmitMisbehaviourSDKType { + client_id: string; + misbehaviour?: AnySDKType; signer: string; } /** * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response * type. */ - export interface MsgSubmitMisbehaviourResponse {} +export interface MsgSubmitMisbehaviourResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse"; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponseAmino {} +export interface MsgSubmitMisbehaviourResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitMisbehaviourResponse"; + value: MsgSubmitMisbehaviourResponseAmino; +} /** * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response * type. */ - export interface MsgSubmitMisbehaviourResponseSDKType {} - function createBaseMsgCreateClient(): MsgCreateClient { return { clientState: undefined, @@ -183,98 +255,148 @@ function createBaseMsgCreateClient(): MsgCreateClient { signer: "" }; } - export const MsgCreateClient = { - encode(message: MsgCreateClient, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + encode(message: MsgCreateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); } - if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(26).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateClient { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateClient(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientState = Any.decode(reader, reader.uint32()); break; - case 2: message.consensusState = Any.decode(reader, reader.uint32()); break; - case 3: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCreateClient { + fromPartial(object: Partial): MsgCreateClient { const message = createBaseMsgCreateClient(); message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgCreateClientAmino): MsgCreateClient { + const message = createBaseMsgCreateClient(); + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgCreateClient): MsgCreateClientAmino { + const obj: any = {}; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { + return MsgCreateClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateClient): MsgCreateClientAminoMsg { + return { + type: "cosmos-sdk/MsgCreateClient", + value: MsgCreateClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateClientProtoMsg): MsgCreateClient { + return MsgCreateClient.decode(message.value); + }, + toProto(message: MsgCreateClient): Uint8Array { + return MsgCreateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateClient): MsgCreateClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.encode(message).finish() + }; } - }; - function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { return {}; } - export const MsgCreateClientResponse = { - encode(_: MsgCreateClientResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", + encode(_: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateClientResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateClientResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgCreateClientResponse { + fromPartial(_: Partial): MsgCreateClientResponse { + const message = createBaseMsgCreateClientResponse(); + return message; + }, + fromAmino(_: MsgCreateClientResponseAmino): MsgCreateClientResponse { const message = createBaseMsgCreateClientResponse(); return message; + }, + toAmino(_: MsgCreateClientResponse): MsgCreateClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateClientResponseAminoMsg): MsgCreateClientResponse { + return MsgCreateClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateClientResponse): MsgCreateClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateClientResponse", + value: MsgCreateClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateClientResponseProtoMsg): MsgCreateClientResponse { + return MsgCreateClientResponse.decode(message.value); + }, + toProto(message: MsgCreateClientResponse): Uint8Array { + return MsgCreateClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateClientResponse): MsgCreateClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", + value: MsgCreateClientResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpdateClient(): MsgUpdateClient { return { clientId: "", @@ -282,98 +404,148 @@ function createBaseMsgUpdateClient(): MsgUpdateClient { signer: "" }; } - export const MsgUpdateClient = { - encode(message: MsgUpdateClient, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + encode(message: MsgUpdateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.header !== undefined) { Any.encode(message.header, writer.uint32(18).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(26).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateClient { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateClient(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.header = Any.decode(reader, reader.uint32()); break; - case 3: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUpdateClient { + fromPartial(object: Partial): MsgUpdateClient { const message = createBaseMsgUpdateClient(); message.clientId = object.clientId ?? ""; message.header = object.header !== undefined && object.header !== null ? Any.fromPartial(object.header) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgUpdateClientAmino): MsgUpdateClient { + const message = createBaseMsgUpdateClient(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.header !== undefined && object.header !== null) { + message.header = Any.fromAmino(object.header); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.header = message.header ? Any.toAmino(message.header) : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { + return MsgUpdateClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateClient): MsgUpdateClientAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateClient", + value: MsgUpdateClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateClientProtoMsg): MsgUpdateClient { + return MsgUpdateClient.decode(message.value); + }, + toProto(message: MsgUpdateClient): Uint8Array { + return MsgUpdateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateClient): MsgUpdateClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.encode(message).finish() + }; } - }; - function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { return {}; } - export const MsgUpdateClientResponse = { - encode(_: MsgUpdateClientResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", + encode(_: MsgUpdateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateClientResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpdateClientResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUpdateClientResponse { + fromPartial(_: Partial): MsgUpdateClientResponse { + const message = createBaseMsgUpdateClientResponse(); + return message; + }, + fromAmino(_: MsgUpdateClientResponseAmino): MsgUpdateClientResponse { const message = createBaseMsgUpdateClientResponse(); return message; + }, + toAmino(_: MsgUpdateClientResponse): MsgUpdateClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateClientResponseAminoMsg): MsgUpdateClientResponse { + return MsgUpdateClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateClientResponse): MsgUpdateClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateClientResponse", + value: MsgUpdateClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateClientResponseProtoMsg): MsgUpdateClientResponse { + return MsgUpdateClientResponse.decode(message.value); + }, + toProto(message: MsgUpdateClientResponse): Uint8Array { + return MsgUpdateClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateClientResponse): MsgUpdateClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", + value: MsgUpdateClientResponse.encode(message).finish() + }; } - }; - function createBaseMsgUpgradeClient(): MsgUpgradeClient { return { clientId: "", @@ -384,79 +556,62 @@ function createBaseMsgUpgradeClient(): MsgUpgradeClient { signer: "" }; } - export const MsgUpgradeClient = { - encode(message: MsgUpgradeClient, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + encode(message: MsgUpgradeClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); } - if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); } - if (message.proofUpgradeClient.length !== 0) { writer.uint32(34).bytes(message.proofUpgradeClient); } - if (message.proofUpgradeConsensusState.length !== 0) { writer.uint32(42).bytes(message.proofUpgradeConsensusState); } - if (message.signer !== "") { writer.uint32(50).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpgradeClient { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpgradeClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpgradeClient(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.clientState = Any.decode(reader, reader.uint32()); break; - case 3: message.consensusState = Any.decode(reader, reader.uint32()); break; - case 4: message.proofUpgradeClient = reader.bytes(); break; - case 5: message.proofUpgradeConsensusState = reader.bytes(); break; - case 6: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgUpgradeClient { + fromPartial(object: Partial): MsgUpgradeClient { const message = createBaseMsgUpgradeClient(); message.clientId = object.clientId ?? ""; message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; @@ -465,44 +620,117 @@ export const MsgUpgradeClient = { message.proofUpgradeConsensusState = object.proofUpgradeConsensusState ?? new Uint8Array(); message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgUpgradeClientAmino): MsgUpgradeClient { + const message = createBaseMsgUpgradeClient(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.proof_upgrade_client !== undefined && object.proof_upgrade_client !== null) { + message.proofUpgradeClient = bytesFromBase64(object.proof_upgrade_client); + } + if (object.proof_upgrade_consensus_state !== undefined && object.proof_upgrade_consensus_state !== null) { + message.proofUpgradeConsensusState = bytesFromBase64(object.proof_upgrade_consensus_state); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; + obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { + return MsgUpgradeClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpgradeClient): MsgUpgradeClientAminoMsg { + return { + type: "cosmos-sdk/MsgUpgradeClient", + value: MsgUpgradeClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpgradeClientProtoMsg): MsgUpgradeClient { + return MsgUpgradeClient.decode(message.value); + }, + toProto(message: MsgUpgradeClient): Uint8Array { + return MsgUpgradeClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpgradeClient): MsgUpgradeClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.encode(message).finish() + }; } - }; - function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { return {}; } - export const MsgUpgradeClientResponse = { - encode(_: MsgUpgradeClientResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", + encode(_: MsgUpgradeClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpgradeClientResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpgradeClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgUpgradeClientResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgUpgradeClientResponse { + fromPartial(_: Partial): MsgUpgradeClientResponse { + const message = createBaseMsgUpgradeClientResponse(); + return message; + }, + fromAmino(_: MsgUpgradeClientResponseAmino): MsgUpgradeClientResponse { const message = createBaseMsgUpgradeClientResponse(); return message; + }, + toAmino(_: MsgUpgradeClientResponse): MsgUpgradeClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpgradeClientResponseAminoMsg): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpgradeClientResponse): MsgUpgradeClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpgradeClientResponse", + value: MsgUpgradeClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpgradeClientResponseProtoMsg): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.decode(message.value); + }, + toProto(message: MsgUpgradeClientResponse): Uint8Array { + return MsgUpgradeClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpgradeClientResponse): MsgUpgradeClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", + value: MsgUpgradeClientResponse.encode(message).finish() + }; } - }; - function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { return { clientId: "", @@ -510,94 +738,145 @@ function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { signer: "" }; } - export const MsgSubmitMisbehaviour = { - encode(message: MsgSubmitMisbehaviour, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + encode(message: MsgSubmitMisbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.misbehaviour !== undefined) { Any.encode(message.misbehaviour, writer.uint32(18).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(26).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitMisbehaviour { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitMisbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitMisbehaviour(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.misbehaviour = Any.decode(reader, reader.uint32()); break; - case 3: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSubmitMisbehaviour { + fromPartial(object: Partial): MsgSubmitMisbehaviour { const message = createBaseMsgSubmitMisbehaviour(); message.clientId = object.clientId ?? ""; message.misbehaviour = object.misbehaviour !== undefined && object.misbehaviour !== null ? Any.fromPartial(object.misbehaviour) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgSubmitMisbehaviourAmino): MsgSubmitMisbehaviour { + const message = createBaseMsgSubmitMisbehaviour(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.misbehaviour !== undefined && object.misbehaviour !== null) { + message.misbehaviour = Any.fromAmino(object.misbehaviour); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitMisbehaviourProtoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviour): Uint8Array { + return MsgSubmitMisbehaviour.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.encode(message).finish() + }; } - }; - function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourResponse { return {}; } - export const MsgSubmitMisbehaviourResponse = { - encode(_: MsgSubmitMisbehaviourResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", + encode(_: MsgSubmitMisbehaviourResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitMisbehaviourResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitMisbehaviourResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSubmitMisbehaviourResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgSubmitMisbehaviourResponse { + fromPartial(_: Partial): MsgSubmitMisbehaviourResponse { const message = createBaseMsgSubmitMisbehaviourResponse(); return message; + }, + fromAmino(_: MsgSubmitMisbehaviourResponseAmino): MsgSubmitMisbehaviourResponse { + const message = createBaseMsgSubmitMisbehaviourResponse(); + return message; + }, + toAmino(_: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSubmitMisbehaviourResponseAminoMsg): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitMisbehaviourResponse", + value: MsgSubmitMisbehaviourResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitMisbehaviourResponseProtoMsg): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviourResponse): Uint8Array { + return MsgSubmitMisbehaviourResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", + value: MsgSubmitMisbehaviourResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/commitment/v1/commitment.ts b/src/codegen/ibc/core/commitment/v1/commitment.ts index 72d8725..42743ea 100644 --- a/src/codegen/ibc/core/commitment/v1/commitment.ts +++ b/src/codegen/ibc/core/commitment/v1/commitment.ts @@ -1,19 +1,32 @@ -import { CommitmentProof, CommitmentProofSDKType } from "../../../../confio/proofs"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { CommitmentProof, CommitmentProofAmino, CommitmentProofSDKType } from "../../../../confio/proofs"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * MerkleRoot defines a merkle root hash. * In the Cosmos SDK, the AppHash of a block header becomes the root. */ - export interface MerkleRoot { hash: Uint8Array; } +export interface MerkleRootProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot"; + value: Uint8Array; +} +/** + * MerkleRoot defines a merkle root hash. + * In the Cosmos SDK, the AppHash of a block header becomes the root. + */ +export interface MerkleRootAmino { + hash?: string; +} +export interface MerkleRootAminoMsg { + type: "cosmos-sdk/MerkleRoot"; + value: MerkleRootAmino; +} /** * MerkleRoot defines a merkle root hash. * In the Cosmos SDK, the AppHash of a block header becomes the root. */ - export interface MerkleRootSDKType { hash: Uint8Array; } @@ -22,16 +35,30 @@ export interface MerkleRootSDKType { * The constructed key from the Path and the key will be append(Path.KeyPath, * append(Path.KeyPrefix, key...)) */ - export interface MerklePrefix { keyPrefix: Uint8Array; } +export interface MerklePrefixProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix"; + value: Uint8Array; +} +/** + * MerklePrefix is merkle path prefixed to the key. + * The constructed key from the Path and the key will be append(Path.KeyPath, + * append(Path.KeyPrefix, key...)) + */ +export interface MerklePrefixAmino { + key_prefix?: string; +} +export interface MerklePrefixAminoMsg { + type: "cosmos-sdk/MerklePrefix"; + value: MerklePrefixAmino; +} /** * MerklePrefix is merkle path prefixed to the key. * The constructed key from the Path and the key will be append(Path.KeyPath, * append(Path.KeyPrefix, key...)) */ - export interface MerklePrefixSDKType { key_prefix: Uint8Array; } @@ -40,16 +67,30 @@ export interface MerklePrefixSDKType { * arbitrary structured object (defined by a commitment type). * MerklePath is represented from root-to-leaf */ - export interface MerklePath { keyPath: string[]; } +export interface MerklePathProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerklePath"; + value: Uint8Array; +} +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * MerklePath is represented from root-to-leaf + */ +export interface MerklePathAmino { + key_path?: string[]; +} +export interface MerklePathAminoMsg { + type: "cosmos-sdk/MerklePath"; + value: MerklePathAmino; +} /** * MerklePath is the path used to verify commitment proofs, which can be an * arbitrary structured object (defined by a commitment type). * MerklePath is represented from root-to-leaf */ - export interface MerklePathSDKType { key_path: string[]; } @@ -60,10 +101,27 @@ export interface MerklePathSDKType { * should be succinct. * MerkleProofs are ordered from leaf-to-root */ - export interface MerkleProof { proofs: CommitmentProof[]; } +export interface MerkleProofProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerkleProof"; + value: Uint8Array; +} +/** + * MerkleProof is a wrapper type over a chain of CommitmentProofs. + * It demonstrates membership or non-membership for an element or set of + * elements, verifiable in conjunction with a known commitment root. Proofs + * should be succinct. + * MerkleProofs are ordered from leaf-to-root + */ +export interface MerkleProofAmino { + proofs?: CommitmentProofAmino[]; +} +export interface MerkleProofAminoMsg { + type: "cosmos-sdk/MerkleProof"; + value: MerkleProofAmino; +} /** * MerkleProof is a wrapper type over a chain of CommitmentProofs. * It demonstrates membership or non-membership for an element or set of @@ -71,187 +129,286 @@ export interface MerkleProof { * should be succinct. * MerkleProofs are ordered from leaf-to-root */ - export interface MerkleProofSDKType { proofs: CommitmentProofSDKType[]; } - function createBaseMerkleRoot(): MerkleRoot { return { hash: new Uint8Array() }; } - export const MerkleRoot = { - encode(message: MerkleRoot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot", + encode(message: MerkleRoot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MerkleRoot { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MerkleRoot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMerkleRoot(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MerkleRoot { + fromPartial(object: Partial): MerkleRoot { const message = createBaseMerkleRoot(); message.hash = object.hash ?? new Uint8Array(); return message; + }, + fromAmino(object: MerkleRootAmino): MerkleRoot { + const message = createBaseMerkleRoot(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: MerkleRoot): MerkleRootAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: MerkleRootAminoMsg): MerkleRoot { + return MerkleRoot.fromAmino(object.value); + }, + toAminoMsg(message: MerkleRoot): MerkleRootAminoMsg { + return { + type: "cosmos-sdk/MerkleRoot", + value: MerkleRoot.toAmino(message) + }; + }, + fromProtoMsg(message: MerkleRootProtoMsg): MerkleRoot { + return MerkleRoot.decode(message.value); + }, + toProto(message: MerkleRoot): Uint8Array { + return MerkleRoot.encode(message).finish(); + }, + toProtoMsg(message: MerkleRoot): MerkleRootProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot", + value: MerkleRoot.encode(message).finish() + }; } - }; - function createBaseMerklePrefix(): MerklePrefix { return { keyPrefix: new Uint8Array() }; } - export const MerklePrefix = { - encode(message: MerklePrefix, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix", + encode(message: MerklePrefix, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.keyPrefix.length !== 0) { writer.uint32(10).bytes(message.keyPrefix); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MerklePrefix { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MerklePrefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMerklePrefix(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.keyPrefix = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MerklePrefix { + fromPartial(object: Partial): MerklePrefix { const message = createBaseMerklePrefix(); message.keyPrefix = object.keyPrefix ?? new Uint8Array(); return message; + }, + fromAmino(object: MerklePrefixAmino): MerklePrefix { + const message = createBaseMerklePrefix(); + if (object.key_prefix !== undefined && object.key_prefix !== null) { + message.keyPrefix = bytesFromBase64(object.key_prefix); + } + return message; + }, + toAmino(message: MerklePrefix): MerklePrefixAmino { + const obj: any = {}; + obj.key_prefix = message.keyPrefix ? base64FromBytes(message.keyPrefix) : undefined; + return obj; + }, + fromAminoMsg(object: MerklePrefixAminoMsg): MerklePrefix { + return MerklePrefix.fromAmino(object.value); + }, + toAminoMsg(message: MerklePrefix): MerklePrefixAminoMsg { + return { + type: "cosmos-sdk/MerklePrefix", + value: MerklePrefix.toAmino(message) + }; + }, + fromProtoMsg(message: MerklePrefixProtoMsg): MerklePrefix { + return MerklePrefix.decode(message.value); + }, + toProto(message: MerklePrefix): Uint8Array { + return MerklePrefix.encode(message).finish(); + }, + toProtoMsg(message: MerklePrefix): MerklePrefixProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix", + value: MerklePrefix.encode(message).finish() + }; } - }; - function createBaseMerklePath(): MerklePath { return { keyPath: [] }; } - export const MerklePath = { - encode(message: MerklePath, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.commitment.v1.MerklePath", + encode(message: MerklePath, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.keyPath) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MerklePath { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MerklePath { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMerklePath(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.keyPath.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MerklePath { + fromPartial(object: Partial): MerklePath { const message = createBaseMerklePath(); message.keyPath = object.keyPath?.map(e => e) || []; return message; + }, + fromAmino(object: MerklePathAmino): MerklePath { + const message = createBaseMerklePath(); + message.keyPath = object.key_path?.map(e => e) || []; + return message; + }, + toAmino(message: MerklePath): MerklePathAmino { + const obj: any = {}; + if (message.keyPath) { + obj.key_path = message.keyPath.map(e => e); + } else { + obj.key_path = []; + } + return obj; + }, + fromAminoMsg(object: MerklePathAminoMsg): MerklePath { + return MerklePath.fromAmino(object.value); + }, + toAminoMsg(message: MerklePath): MerklePathAminoMsg { + return { + type: "cosmos-sdk/MerklePath", + value: MerklePath.toAmino(message) + }; + }, + fromProtoMsg(message: MerklePathProtoMsg): MerklePath { + return MerklePath.decode(message.value); + }, + toProto(message: MerklePath): Uint8Array { + return MerklePath.encode(message).finish(); + }, + toProtoMsg(message: MerklePath): MerklePathProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerklePath", + value: MerklePath.encode(message).finish() + }; } - }; - function createBaseMerkleProof(): MerkleProof { return { proofs: [] }; } - export const MerkleProof = { - encode(message: MerkleProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.commitment.v1.MerkleProof", + encode(message: MerkleProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proofs) { CommitmentProof.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MerkleProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MerkleProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMerkleProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.proofs.push(CommitmentProof.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MerkleProof { + fromPartial(object: Partial): MerkleProof { const message = createBaseMerkleProof(); message.proofs = object.proofs?.map(e => CommitmentProof.fromPartial(e)) || []; return message; + }, + fromAmino(object: MerkleProofAmino): MerkleProof { + const message = createBaseMerkleProof(); + message.proofs = object.proofs?.map(e => CommitmentProof.fromAmino(e)) || []; + return message; + }, + toAmino(message: MerkleProof): MerkleProofAmino { + const obj: any = {}; + if (message.proofs) { + obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e) : undefined); + } else { + obj.proofs = []; + } + return obj; + }, + fromAminoMsg(object: MerkleProofAminoMsg): MerkleProof { + return MerkleProof.fromAmino(object.value); + }, + toAminoMsg(message: MerkleProof): MerkleProofAminoMsg { + return { + type: "cosmos-sdk/MerkleProof", + value: MerkleProof.toAmino(message) + }; + }, + fromProtoMsg(message: MerkleProofProtoMsg): MerkleProof { + return MerkleProof.decode(message.value); + }, + toProto(message: MerkleProof): Uint8Array { + return MerkleProof.encode(message).finish(); + }, + toProtoMsg(message: MerkleProof): MerkleProofProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerkleProof", + value: MerkleProof.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/connection.ts b/src/codegen/ibc/core/connection/v1/connection.ts index cd1bab0..e8a7f63 100644 --- a/src/codegen/ibc/core/connection/v1/connection.ts +++ b/src/codegen/ibc/core/connection/v1/connection.ts @@ -1,68 +1,39 @@ -import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { MerklePrefix, MerklePrefixAmino, MerklePrefixSDKType } from "../../commitment/v1/commitment"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * State defines if a connection is in one of the following states: * INIT, TRYOPEN, OPEN or UNINITIALIZED. */ - export enum State { /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ STATE_UNINITIALIZED_UNSPECIFIED = 0, - /** STATE_INIT - A connection end has just started the opening handshake. */ STATE_INIT = 1, - /** * STATE_TRYOPEN - A connection end has acknowledged the handshake step on the counterparty * chain. */ STATE_TRYOPEN = 2, - - /** STATE_OPEN - A connection end has completed the handshake. */ - STATE_OPEN = 3, - UNRECOGNIZED = -1, -} -/** - * State defines if a connection is in one of the following states: - * INIT, TRYOPEN, OPEN or UNINITIALIZED. - */ - -export enum StateSDKType { - /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ - STATE_UNINITIALIZED_UNSPECIFIED = 0, - - /** STATE_INIT - A connection end has just started the opening handshake. */ - STATE_INIT = 1, - - /** - * STATE_TRYOPEN - A connection end has acknowledged the handshake step on the counterparty - * chain. - */ - STATE_TRYOPEN = 2, - /** STATE_OPEN - A connection end has completed the handshake. */ STATE_OPEN = 3, UNRECOGNIZED = -1, } +export const StateSDKType = State; +export const StateAmino = State; export function stateFromJSON(object: any): State { switch (object) { case 0: case "STATE_UNINITIALIZED_UNSPECIFIED": return State.STATE_UNINITIALIZED_UNSPECIFIED; - case 1: case "STATE_INIT": return State.STATE_INIT; - case 2: case "STATE_TRYOPEN": return State.STATE_TRYOPEN; - case 3: case "STATE_OPEN": return State.STATE_OPEN; - case -1: case "UNRECOGNIZED": default: @@ -73,16 +44,12 @@ export function stateToJSON(object: State): string { switch (object) { case State.STATE_UNINITIALIZED_UNSPECIFIED: return "STATE_UNINITIALIZED_UNSPECIFIED"; - case State.STATE_INIT: return "STATE_INIT"; - case State.STATE_TRYOPEN: return "STATE_TRYOPEN"; - case State.STATE_OPEN: return "STATE_OPEN"; - case State.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -94,7 +61,6 @@ export function stateToJSON(object: State): string { * NOTE: there must only be 2 defined ConnectionEnds to establish * a connection between two chains. */ - export interface ConnectionEnd { /** client associated with this connection. */ clientId: string; @@ -102,21 +68,21 @@ export interface ConnectionEnd { * IBC version which can be utilised to determine encodings or protocols for * channels or packets utilising this connection. */ - versions: Version[]; /** current state of the connection end. */ - state: State; /** counterparty chain associated with this connection. */ - - counterparty?: Counterparty; + counterparty: Counterparty; /** * delay period that must pass before a consensus state can be used for * packet-verification NOTE: delay period logic is only implemented by some * clients. */ - - delayPeriod: Long; + delayPeriod: bigint; +} +export interface ConnectionEndProtoMsg { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd"; + value: Uint8Array; } /** * ConnectionEnd defines a stateful object on a chain connected to another @@ -124,86 +90,105 @@ export interface ConnectionEnd { * NOTE: there must only be 2 defined ConnectionEnds to establish * a connection between two chains. */ - -export interface ConnectionEndSDKType { +export interface ConnectionEndAmino { /** client associated with this connection. */ - client_id: string; + client_id?: string; /** * IBC version which can be utilised to determine encodings or protocols for * channels or packets utilising this connection. */ - - versions: VersionSDKType[]; + versions?: VersionAmino[]; /** current state of the connection end. */ - - state: StateSDKType; + state?: State; /** counterparty chain associated with this connection. */ - - counterparty?: CounterpartySDKType; + counterparty?: CounterpartyAmino; /** * delay period that must pass before a consensus state can be used for * packet-verification NOTE: delay period logic is only implemented by some * clients. */ - - delay_period: Long; + delay_period?: string; +} +export interface ConnectionEndAminoMsg { + type: "cosmos-sdk/ConnectionEnd"; + value: ConnectionEndAmino; +} +/** + * ConnectionEnd defines a stateful object on a chain connected to another + * separate one. + * NOTE: there must only be 2 defined ConnectionEnds to establish + * a connection between two chains. + */ +export interface ConnectionEndSDKType { + client_id: string; + versions: VersionSDKType[]; + state: State; + counterparty: CounterpartySDKType; + delay_period: bigint; } /** * IdentifiedConnection defines a connection with additional connection * identifier field. */ - export interface IdentifiedConnection { /** connection identifier. */ id: string; /** client associated with this connection. */ - clientId: string; /** * IBC version which can be utilised to determine encodings or protocols for * channels or packets utilising this connection */ - versions: Version[]; /** current state of the connection end. */ - state: State; /** counterparty chain associated with this connection. */ - - counterparty?: Counterparty; + counterparty: Counterparty; /** delay period associated with this connection. */ - - delayPeriod: Long; + delayPeriod: bigint; +} +export interface IdentifiedConnectionProtoMsg { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection"; + value: Uint8Array; } /** * IdentifiedConnection defines a connection with additional connection * identifier field. */ - -export interface IdentifiedConnectionSDKType { +export interface IdentifiedConnectionAmino { /** connection identifier. */ - id: string; + id?: string; /** client associated with this connection. */ - - client_id: string; + client_id?: string; /** * IBC version which can be utilised to determine encodings or protocols for * channels or packets utilising this connection */ - - versions: VersionSDKType[]; + versions?: VersionAmino[]; /** current state of the connection end. */ - - state: StateSDKType; + state?: State; /** counterparty chain associated with this connection. */ - - counterparty?: CounterpartySDKType; + counterparty?: CounterpartyAmino; /** delay period associated with this connection. */ - - delay_period: Long; + delay_period?: string; +} +export interface IdentifiedConnectionAminoMsg { + type: "cosmos-sdk/IdentifiedConnection"; + value: IdentifiedConnectionAmino; +} +/** + * IdentifiedConnection defines a connection with additional connection + * identifier field. + */ +export interface IdentifiedConnectionSDKType { + id: string; + client_id: string; + versions: VersionSDKType[]; + state: State; + counterparty: CounterpartySDKType; + delay_period: bigint; } /** Counterparty defines the counterparty chain associated with a connection end. */ - export interface Counterparty { /** * identifies the client on the counterparty chain associated with a given @@ -214,546 +199,800 @@ export interface Counterparty { * identifies the connection end on the counterparty chain associated with a * given connection. */ - connectionId: string; /** commitment merkle prefix of the counterparty chain. */ - - prefix?: MerklePrefix; + prefix: MerklePrefix; +} +export interface CounterpartyProtoMsg { + typeUrl: "/ibc.core.connection.v1.Counterparty"; + value: Uint8Array; } /** Counterparty defines the counterparty chain associated with a connection end. */ - -export interface CounterpartySDKType { +export interface CounterpartyAmino { /** * identifies the client on the counterparty chain associated with a given * connection. */ - client_id: string; + client_id?: string; /** * identifies the connection end on the counterparty chain associated with a * given connection. */ - - connection_id: string; + connection_id?: string; /** commitment merkle prefix of the counterparty chain. */ - - prefix?: MerklePrefixSDKType; + prefix?: MerklePrefixAmino; +} +export interface CounterpartyAminoMsg { + type: "cosmos-sdk/Counterparty"; + value: CounterpartyAmino; +} +/** Counterparty defines the counterparty chain associated with a connection end. */ +export interface CounterpartySDKType { + client_id: string; + connection_id: string; + prefix: MerklePrefixSDKType; } /** ClientPaths define all the connection paths for a client state. */ - export interface ClientPaths { /** list of connection paths */ paths: string[]; } +export interface ClientPathsProtoMsg { + typeUrl: "/ibc.core.connection.v1.ClientPaths"; + value: Uint8Array; +} /** ClientPaths define all the connection paths for a client state. */ - -export interface ClientPathsSDKType { +export interface ClientPathsAmino { /** list of connection paths */ + paths?: string[]; +} +export interface ClientPathsAminoMsg { + type: "cosmos-sdk/ClientPaths"; + value: ClientPathsAmino; +} +/** ClientPaths define all the connection paths for a client state. */ +export interface ClientPathsSDKType { paths: string[]; } /** ConnectionPaths define all the connection paths for a given client state. */ - export interface ConnectionPaths { /** client state unique identifier */ clientId: string; /** list of connection paths */ - paths: string[]; } +export interface ConnectionPathsProtoMsg { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths"; + value: Uint8Array; +} /** ConnectionPaths define all the connection paths for a given client state. */ - -export interface ConnectionPathsSDKType { +export interface ConnectionPathsAmino { /** client state unique identifier */ - client_id: string; + client_id?: string; /** list of connection paths */ - + paths?: string[]; +} +export interface ConnectionPathsAminoMsg { + type: "cosmos-sdk/ConnectionPaths"; + value: ConnectionPathsAmino; +} +/** ConnectionPaths define all the connection paths for a given client state. */ +export interface ConnectionPathsSDKType { + client_id: string; paths: string[]; } /** * Version defines the versioning scheme used to negotiate the IBC verison in * the connection handshake. */ - export interface Version { /** unique version identifier */ identifier: string; /** list of features compatible with the specified identifier */ - features: string[]; } +export interface VersionProtoMsg { + typeUrl: "/ibc.core.connection.v1.Version"; + value: Uint8Array; +} /** * Version defines the versioning scheme used to negotiate the IBC verison in * the connection handshake. */ - -export interface VersionSDKType { +export interface VersionAmino { /** unique version identifier */ - identifier: string; + identifier?: string; /** list of features compatible with the specified identifier */ - + features?: string[]; +} +export interface VersionAminoMsg { + type: "cosmos-sdk/Version"; + value: VersionAmino; +} +/** + * Version defines the versioning scheme used to negotiate the IBC verison in + * the connection handshake. + */ +export interface VersionSDKType { + identifier: string; features: string[]; } /** Params defines the set of Connection parameters. */ - export interface Params { /** * maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the * largest amount of time that the chain might reasonably take to produce the next block under normal operating * conditions. A safe choice is 3-5x the expected time per block. */ - maxExpectedTimePerBlock: Long; + maxExpectedTimePerBlock: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.core.connection.v1.Params"; + value: Uint8Array; } /** Params defines the set of Connection parameters. */ - -export interface ParamsSDKType { +export interface ParamsAmino { /** * maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the * largest amount of time that the chain might reasonably take to produce the next block under normal operating * conditions. A safe choice is 3-5x the expected time per block. */ - max_expected_time_per_block: Long; + max_expected_time_per_block?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** Params defines the set of Connection parameters. */ +export interface ParamsSDKType { + max_expected_time_per_block: bigint; } - function createBaseConnectionEnd(): ConnectionEnd { return { clientId: "", versions: [], state: 0, - counterparty: undefined, - delayPeriod: Long.UZERO + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0) }; } - export const ConnectionEnd = { - encode(message: ConnectionEnd, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd", + encode(message: ConnectionEnd, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - for (const v of message.versions) { Version.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.state !== 0) { writer.uint32(24).int32(message.state); } - if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); } - - if (!message.delayPeriod.isZero()) { + if (message.delayPeriod !== BigInt(0)) { writer.uint32(40).uint64(message.delayPeriod); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionEnd { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionEnd { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConnectionEnd(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.versions.push(Version.decode(reader, reader.uint32())); break; - case 3: message.state = (reader.int32() as any); break; - case 4: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; - case 5: - message.delayPeriod = (reader.uint64() as Long); + message.delayPeriod = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConnectionEnd { + fromPartial(object: Partial): ConnectionEnd { const message = createBaseConnectionEnd(); message.clientId = object.clientId ?? ""; message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; message.state = object.state ?? 0; message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; - message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? Long.fromValue(object.delayPeriod) : Long.UZERO; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); return message; + }, + fromAmino(object: ConnectionEndAmino): ConnectionEnd { + const message = createBaseConnectionEnd(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; + if (object.state !== undefined && object.state !== null) { + message.state = stateFromJSON(object.state); + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + return message; + }, + toAmino(message: ConnectionEnd): ConnectionEndAmino { + const obj: any = {}; + obj.client_id = message.clientId; + if (message.versions) { + obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.versions = []; + } + obj.state = stateToJSON(message.state); + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { + return ConnectionEnd.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionEnd): ConnectionEndAminoMsg { + return { + type: "cosmos-sdk/ConnectionEnd", + value: ConnectionEnd.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionEndProtoMsg): ConnectionEnd { + return ConnectionEnd.decode(message.value); + }, + toProto(message: ConnectionEnd): Uint8Array { + return ConnectionEnd.encode(message).finish(); + }, + toProtoMsg(message: ConnectionEnd): ConnectionEndProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd", + value: ConnectionEnd.encode(message).finish() + }; } - }; - function createBaseIdentifiedConnection(): IdentifiedConnection { return { id: "", clientId: "", versions: [], state: 0, - counterparty: undefined, - delayPeriod: Long.UZERO + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0) }; } - export const IdentifiedConnection = { - encode(message: IdentifiedConnection, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", + encode(message: IdentifiedConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); } - if (message.clientId !== "") { writer.uint32(18).string(message.clientId); } - for (const v of message.versions) { Version.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.state !== 0) { writer.uint32(32).int32(message.state); } - if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(42).fork()).ldelim(); } - - if (!message.delayPeriod.isZero()) { + if (message.delayPeriod !== BigInt(0)) { writer.uint32(48).uint64(message.delayPeriod); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IdentifiedConnection { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedConnection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseIdentifiedConnection(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.id = reader.string(); break; - case 2: message.clientId = reader.string(); break; - case 3: message.versions.push(Version.decode(reader, reader.uint32())); break; - case 4: message.state = (reader.int32() as any); break; - case 5: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; - case 6: - message.delayPeriod = (reader.uint64() as Long); + message.delayPeriod = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): IdentifiedConnection { + fromPartial(object: Partial): IdentifiedConnection { const message = createBaseIdentifiedConnection(); message.id = object.id ?? ""; message.clientId = object.clientId ?? ""; message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; message.state = object.state ?? 0; message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; - message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? Long.fromValue(object.delayPeriod) : Long.UZERO; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + return message; + }, + fromAmino(object: IdentifiedConnectionAmino): IdentifiedConnection { + const message = createBaseIdentifiedConnection(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; + if (object.state !== undefined && object.state !== null) { + message.state = stateFromJSON(object.state); + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } return message; + }, + toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { + const obj: any = {}; + obj.id = message.id; + obj.client_id = message.clientId; + if (message.versions) { + obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.versions = []; + } + obj.state = stateToJSON(message.state); + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + return obj; + }, + fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { + return IdentifiedConnection.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedConnection): IdentifiedConnectionAminoMsg { + return { + type: "cosmos-sdk/IdentifiedConnection", + value: IdentifiedConnection.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedConnectionProtoMsg): IdentifiedConnection { + return IdentifiedConnection.decode(message.value); + }, + toProto(message: IdentifiedConnection): Uint8Array { + return IdentifiedConnection.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedConnection): IdentifiedConnectionProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", + value: IdentifiedConnection.encode(message).finish() + }; } - }; - function createBaseCounterparty(): Counterparty { return { clientId: "", connectionId: "", - prefix: undefined + prefix: MerklePrefix.fromPartial({}) }; } - export const Counterparty = { - encode(message: Counterparty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.Counterparty", + encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.connectionId !== "") { writer.uint32(18).string(message.connectionId); } - if (message.prefix !== undefined) { MerklePrefix.encode(message.prefix, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Counterparty { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Counterparty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCounterparty(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.connectionId = reader.string(); break; - case 3: message.prefix = MerklePrefix.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Counterparty { + fromPartial(object: Partial): Counterparty { const message = createBaseCounterparty(); message.clientId = object.clientId ?? ""; message.connectionId = object.connectionId ?? ""; message.prefix = object.prefix !== undefined && object.prefix !== null ? MerklePrefix.fromPartial(object.prefix) : undefined; return message; + }, + fromAmino(object: CounterpartyAmino): Counterparty { + const message = createBaseCounterparty(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = MerklePrefix.fromAmino(object.prefix); + } + return message; + }, + toAmino(message: Counterparty): CounterpartyAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.connection_id = message.connectionId; + obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; + return obj; + }, + fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { + return Counterparty.fromAmino(object.value); + }, + toAminoMsg(message: Counterparty): CounterpartyAminoMsg { + return { + type: "cosmos-sdk/Counterparty", + value: Counterparty.toAmino(message) + }; + }, + fromProtoMsg(message: CounterpartyProtoMsg): Counterparty { + return Counterparty.decode(message.value); + }, + toProto(message: Counterparty): Uint8Array { + return Counterparty.encode(message).finish(); + }, + toProtoMsg(message: Counterparty): CounterpartyProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Counterparty", + value: Counterparty.encode(message).finish() + }; } - }; - function createBaseClientPaths(): ClientPaths { return { paths: [] }; } - export const ClientPaths = { - encode(message: ClientPaths, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.ClientPaths", + encode(message: ClientPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.paths) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientPaths { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientPaths { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientPaths(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.paths.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientPaths { + fromPartial(object: Partial): ClientPaths { + const message = createBaseClientPaths(); + message.paths = object.paths?.map(e => e) || []; + return message; + }, + fromAmino(object: ClientPathsAmino): ClientPaths { const message = createBaseClientPaths(); message.paths = object.paths?.map(e => e) || []; return message; + }, + toAmino(message: ClientPaths): ClientPathsAmino { + const obj: any = {}; + if (message.paths) { + obj.paths = message.paths.map(e => e); + } else { + obj.paths = []; + } + return obj; + }, + fromAminoMsg(object: ClientPathsAminoMsg): ClientPaths { + return ClientPaths.fromAmino(object.value); + }, + toAminoMsg(message: ClientPaths): ClientPathsAminoMsg { + return { + type: "cosmos-sdk/ClientPaths", + value: ClientPaths.toAmino(message) + }; + }, + fromProtoMsg(message: ClientPathsProtoMsg): ClientPaths { + return ClientPaths.decode(message.value); + }, + toProto(message: ClientPaths): Uint8Array { + return ClientPaths.encode(message).finish(); + }, + toProtoMsg(message: ClientPaths): ClientPathsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ClientPaths", + value: ClientPaths.encode(message).finish() + }; } - }; - function createBaseConnectionPaths(): ConnectionPaths { return { clientId: "", paths: [] }; } - export const ConnectionPaths = { - encode(message: ConnectionPaths, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths", + encode(message: ConnectionPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - for (const v of message.paths) { writer.uint32(18).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionPaths { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionPaths { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConnectionPaths(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.paths.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConnectionPaths { + fromPartial(object: Partial): ConnectionPaths { const message = createBaseConnectionPaths(); message.clientId = object.clientId ?? ""; message.paths = object.paths?.map(e => e) || []; return message; + }, + fromAmino(object: ConnectionPathsAmino): ConnectionPaths { + const message = createBaseConnectionPaths(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.paths = object.paths?.map(e => e) || []; + return message; + }, + toAmino(message: ConnectionPaths): ConnectionPathsAmino { + const obj: any = {}; + obj.client_id = message.clientId; + if (message.paths) { + obj.paths = message.paths.map(e => e); + } else { + obj.paths = []; + } + return obj; + }, + fromAminoMsg(object: ConnectionPathsAminoMsg): ConnectionPaths { + return ConnectionPaths.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionPaths): ConnectionPathsAminoMsg { + return { + type: "cosmos-sdk/ConnectionPaths", + value: ConnectionPaths.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionPathsProtoMsg): ConnectionPaths { + return ConnectionPaths.decode(message.value); + }, + toProto(message: ConnectionPaths): Uint8Array { + return ConnectionPaths.encode(message).finish(); + }, + toProtoMsg(message: ConnectionPaths): ConnectionPathsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths", + value: ConnectionPaths.encode(message).finish() + }; } - }; - function createBaseVersion(): Version { return { identifier: "", features: [] }; } - export const Version = { - encode(message: Version, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.Version", + encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); } - for (const v of message.features) { writer.uint32(18).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Version { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Version { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVersion(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.identifier = reader.string(); break; - case 2: message.features.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Version { + fromPartial(object: Partial): Version { const message = createBaseVersion(); message.identifier = object.identifier ?? ""; message.features = object.features?.map(e => e) || []; return message; + }, + fromAmino(object: VersionAmino): Version { + const message = createBaseVersion(); + if (object.identifier !== undefined && object.identifier !== null) { + message.identifier = object.identifier; + } + message.features = object.features?.map(e => e) || []; + return message; + }, + toAmino(message: Version): VersionAmino { + const obj: any = {}; + obj.identifier = message.identifier; + if (message.features) { + obj.features = message.features.map(e => e); + } else { + obj.features = []; + } + return obj; + }, + fromAminoMsg(object: VersionAminoMsg): Version { + return Version.fromAmino(object.value); + }, + toAminoMsg(message: Version): VersionAminoMsg { + return { + type: "cosmos-sdk/Version", + value: Version.toAmino(message) + }; + }, + fromProtoMsg(message: VersionProtoMsg): Version { + return Version.decode(message.value); + }, + toProto(message: Version): Uint8Array { + return Version.encode(message).finish(); + }, + toProtoMsg(message: Version): VersionProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Version", + value: Version.encode(message).finish() + }; } - }; - function createBaseParams(): Params { return { - maxExpectedTimePerBlock: Long.UZERO + maxExpectedTimePerBlock: BigInt(0) }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.maxExpectedTimePerBlock.isZero()) { + typeUrl: "/ibc.core.connection.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxExpectedTimePerBlock !== BigInt(0)) { writer.uint32(8).uint64(message.maxExpectedTimePerBlock); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.maxExpectedTimePerBlock = (reader.uint64() as Long); + message.maxExpectedTimePerBlock = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.maxExpectedTimePerBlock = object.maxExpectedTimePerBlock !== undefined && object.maxExpectedTimePerBlock !== null ? BigInt(object.maxExpectedTimePerBlock.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { const message = createBaseParams(); - message.maxExpectedTimePerBlock = object.maxExpectedTimePerBlock !== undefined && object.maxExpectedTimePerBlock !== null ? Long.fromValue(object.maxExpectedTimePerBlock) : Long.UZERO; + if (object.max_expected_time_per_block !== undefined && object.max_expected_time_per_block !== null) { + message.maxExpectedTimePerBlock = BigInt(object.max_expected_time_per_block); + } return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Params", + value: Params.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/genesis.ts b/src/codegen/ibc/core/connection/v1/genesis.ts index 46338aa..4c5f20d 100644 --- a/src/codegen/ibc/core/connection/v1/genesis.ts +++ b/src/codegen/ibc/core/connection/v1/genesis.ts @@ -1,98 +1,142 @@ -import { IdentifiedConnection, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsSDKType, Params, ParamsSDKType } from "./connection"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsAmino, ConnectionPathsSDKType, Params, ParamsAmino, ParamsSDKType } from "./connection"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** GenesisState defines the ibc connection submodule's genesis state. */ - export interface GenesisState { connections: IdentifiedConnection[]; clientConnectionPaths: ConnectionPaths[]; /** the sequence for the next generated connection identifier */ - - nextConnectionSequence: Long; - params?: Params; + nextConnectionSequence: bigint; + params: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.core.connection.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the ibc connection submodule's genesis state. */ +export interface GenesisStateAmino { + connections?: IdentifiedConnectionAmino[]; + client_connection_paths?: ConnectionPathsAmino[]; + /** the sequence for the next generated connection identifier */ + next_connection_sequence?: string; + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; } /** GenesisState defines the ibc connection submodule's genesis state. */ - export interface GenesisStateSDKType { connections: IdentifiedConnectionSDKType[]; client_connection_paths: ConnectionPathsSDKType[]; - /** the sequence for the next generated connection identifier */ - - next_connection_sequence: Long; - params?: ParamsSDKType; + next_connection_sequence: bigint; + params: ParamsSDKType; } - function createBaseGenesisState(): GenesisState { return { connections: [], clientConnectionPaths: [], - nextConnectionSequence: Long.UZERO, - params: undefined + nextConnectionSequence: BigInt(0), + params: Params.fromPartial({}) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connections) { IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.clientConnectionPaths) { ConnectionPaths.encode(v!, writer.uint32(18).fork()).ldelim(); } - - if (!message.nextConnectionSequence.isZero()) { + if (message.nextConnectionSequence !== BigInt(0)) { writer.uint32(24).uint64(message.nextConnectionSequence); } - if (message.params !== undefined) { Params.encode(message.params, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.connections.push(IdentifiedConnection.decode(reader, reader.uint32())); break; - case 2: message.clientConnectionPaths.push(ConnectionPaths.decode(reader, reader.uint32())); break; - case 3: - message.nextConnectionSequence = (reader.uint64() as Long); + message.nextConnectionSequence = reader.uint64(); break; - case 4: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.connections = object.connections?.map(e => IdentifiedConnection.fromPartial(e)) || []; message.clientConnectionPaths = object.clientConnectionPaths?.map(e => ConnectionPaths.fromPartial(e)) || []; - message.nextConnectionSequence = object.nextConnectionSequence !== undefined && object.nextConnectionSequence !== null ? Long.fromValue(object.nextConnectionSequence) : Long.UZERO; + message.nextConnectionSequence = object.nextConnectionSequence !== undefined && object.nextConnectionSequence !== null ? BigInt(object.nextConnectionSequence.toString()) : BigInt(0); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.connections = object.connections?.map(e => IdentifiedConnection.fromAmino(e)) || []; + message.clientConnectionPaths = object.client_connection_paths?.map(e => ConnectionPaths.fromAmino(e)) || []; + if (object.next_connection_sequence !== undefined && object.next_connection_sequence !== null) { + message.nextConnectionSequence = BigInt(object.next_connection_sequence); + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.connections) { + obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); + } else { + obj.connections = []; + } + if (message.clientConnectionPaths) { + obj.client_connection_paths = message.clientConnectionPaths.map(e => e ? ConnectionPaths.toAmino(e) : undefined); + } else { + obj.client_connection_paths = []; + } + obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/query.lcd.ts b/src/codegen/ibc/core/connection/v1/query.lcd.ts index 5f34519..30e10b8 100644 --- a/src/codegen/ibc/core/connection/v1/query.lcd.ts +++ b/src/codegen/ibc/core/connection/v1/query.lcd.ts @@ -1,9 +1,8 @@ import { setPaginationParams } from "../../../../helpers"; -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; import { QueryConnectionRequest, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -17,52 +16,39 @@ export class LCDQueryClient { this.connectionConsensusState = this.connectionConsensusState.bind(this); } /* Connection queries an IBC connection end. */ - - async connection(params: QueryConnectionRequest): Promise { const endpoint = `ibc/core/connection/v1/connections/${params.connectionId}`; return await this.req.get(endpoint); } /* Connections queries all the IBC connections of a chain. */ - - async connections(params: QueryConnectionsRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; - if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `ibc/core/connection/v1/connections`; return await this.req.get(endpoint, options); } /* ClientConnections queries the connection paths associated with a client state. */ - - async clientConnections(params: QueryClientConnectionsRequest): Promise { const endpoint = `ibc/core/connection/v1/client_connections/${params.clientId}`; return await this.req.get(endpoint); } /* ConnectionClientState queries the client state associated with the connection. */ - - async connectionClientState(params: QueryConnectionClientStateRequest): Promise { const endpoint = `ibc/core/connection/v1/connections/${params.connectionId}/client_state`; return await this.req.get(endpoint); } /* ConnectionConsensusState queries the consensus state associated with the connection. */ - - async connectionConsensusState(params: QueryConnectionConsensusStateRequest): Promise { - const endpoint = `ibc/core/connection/v1/connections/${params.connectionId}/consensus_state/revision/${params.revisionNumber}height/${params.revisionHeight}`; + const endpoint = `ibc/core/connection/v1/connections/${params.connectionId}/consensus_state/revision/${params.revisionNumber}/height/${params.revisionHeight}`; return await this.req.get(endpoint); } - } \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/query.rpc.Query.ts b/src/codegen/ibc/core/connection/v1/query.rpc.Query.ts index e3af26e..e702220 100644 --- a/src/codegen/ibc/core/connection/v1/query.rpc.Query.ts +++ b/src/codegen/ibc/core/connection/v1/query.rpc.Query.ts @@ -1,37 +1,31 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryConnectionRequest, QueryConnectionResponse, QueryConnectionsRequest, QueryConnectionsResponse, QueryClientConnectionsRequest, QueryClientConnectionsResponse, QueryConnectionClientStateRequest, QueryConnectionClientStateResponse, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateResponse } from "./query"; /** Query provides defines the gRPC querier service */ - export interface Query { /** Connection queries an IBC connection end. */ connection(request: QueryConnectionRequest): Promise; /** Connections queries all the IBC connections of a chain. */ - connections(request?: QueryConnectionsRequest): Promise; /** * ClientConnections queries the connection paths associated with a client * state. */ - clientConnections(request: QueryClientConnectionsRequest): Promise; /** * ConnectionClientState queries the client state associated with the * connection. */ - connectionClientState(request: QueryConnectionClientStateRequest): Promise; /** * ConnectionConsensusState queries the consensus state associated with the * connection. */ - connectionConsensusState(request: QueryConnectionConsensusStateRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.connection = this.connection.bind(this); @@ -40,39 +34,33 @@ export class QueryClientImpl implements Query { this.connectionClientState = this.connectionClientState.bind(this); this.connectionConsensusState = this.connectionConsensusState.bind(this); } - connection(request: QueryConnectionRequest): Promise { const data = QueryConnectionRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Query", "Connection", data); - return promise.then(data => QueryConnectionResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryConnectionResponse.decode(new BinaryReader(data))); } - connections(request: QueryConnectionsRequest = { pagination: undefined }): Promise { const data = QueryConnectionsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Query", "Connections", data); - return promise.then(data => QueryConnectionsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryConnectionsResponse.decode(new BinaryReader(data))); } - clientConnections(request: QueryClientConnectionsRequest): Promise { const data = QueryClientConnectionsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Query", "ClientConnections", data); - return promise.then(data => QueryClientConnectionsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryClientConnectionsResponse.decode(new BinaryReader(data))); } - connectionClientState(request: QueryConnectionClientStateRequest): Promise { const data = QueryConnectionClientStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Query", "ConnectionClientState", data); - return promise.then(data => QueryConnectionClientStateResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryConnectionClientStateResponse.decode(new BinaryReader(data))); } - connectionConsensusState(request: QueryConnectionConsensusStateRequest): Promise { const data = QueryConnectionConsensusStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Query", "ConnectionConsensusState", data); - return promise.then(data => QueryConnectionConsensusStateResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryConnectionConsensusStateResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -81,22 +69,17 @@ export const createRpcQueryExtension = (base: QueryClient) => { connection(request: QueryConnectionRequest): Promise { return queryService.connection(request); }, - connections(request?: QueryConnectionsRequest): Promise { return queryService.connections(request); }, - clientConnections(request: QueryClientConnectionsRequest): Promise { return queryService.clientConnections(request); }, - connectionClientState(request: QueryConnectionClientStateRequest): Promise { return queryService.connectionClientState(request); }, - connectionConsensusState(request: QueryConnectionConsensusStateRequest): Promise { return queryService.connectionConsensusState(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/query.ts b/src/codegen/ibc/core/connection/v1/query.ts index 3ca314c..98ff277 100644 --- a/src/codegen/ibc/core/connection/v1/query.ts +++ b/src/codegen/ibc/core/connection/v1/query.ts @@ -1,25 +1,38 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../../helpers"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * QueryConnectionRequest is the request type for the Query/Connection RPC * method */ - export interface QueryConnectionRequest { /** connection unique identifier */ connectionId: string; } +export interface QueryConnectionRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest"; + value: Uint8Array; +} /** * QueryConnectionRequest is the request type for the Query/Connection RPC * method */ - -export interface QueryConnectionRequestSDKType { +export interface QueryConnectionRequestAmino { /** connection unique identifier */ + connection_id?: string; +} +export interface QueryConnectionRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionRequest"; + value: QueryConnectionRequestAmino; +} +/** + * QueryConnectionRequest is the request type for the Query/Connection RPC + * method + */ +export interface QueryConnectionRequestSDKType { connection_id: string; } /** @@ -27,46 +40,71 @@ export interface QueryConnectionRequestSDKType { * method. Besides the connection end, it includes a proof and the height from * which the proof was retrieved. */ - export interface QueryConnectionResponse { /** connection associated with the request identifier */ connection?: ConnectionEnd; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryConnectionResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse"; + value: Uint8Array; } /** * QueryConnectionResponse is the response type for the Query/Connection RPC * method. Besides the connection end, it includes a proof and the height from * which the proof was retrieved. */ - -export interface QueryConnectionResponseSDKType { +export interface QueryConnectionResponseAmino { /** connection associated with the request identifier */ - connection?: ConnectionEndSDKType; + connection?: ConnectionEndAmino; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryConnectionResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionResponse"; + value: QueryConnectionResponseAmino; +} +/** + * QueryConnectionResponse is the response type for the Query/Connection RPC + * method. Besides the connection end, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryConnectionResponseSDKType { + connection?: ConnectionEndSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryConnectionsRequest is the request type for the Query/Connections RPC * method */ - export interface QueryConnectionsRequest { pagination?: PageRequest; } +export interface QueryConnectionsRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest"; + value: Uint8Array; +} +/** + * QueryConnectionsRequest is the request type for the Query/Connections RPC + * method + */ +export interface QueryConnectionsRequestAmino { + pagination?: PageRequestAmino; +} +export interface QueryConnectionsRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionsRequest"; + value: QueryConnectionsRequestAmino; +} /** * QueryConnectionsRequest is the request type for the Query/Connections RPC * method */ - export interface QueryConnectionsRequestSDKType { pagination?: PageRequestSDKType; } @@ -74,763 +112,1117 @@ export interface QueryConnectionsRequestSDKType { * QueryConnectionsResponse is the response type for the Query/Connections RPC * method. */ - export interface QueryConnectionsResponse { /** list of stored connections of the chain. */ connections: IdentifiedConnection[]; /** pagination response */ - pagination?: PageResponse; /** query block height */ - - height?: Height; + height: Height; +} +export interface QueryConnectionsResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse"; + value: Uint8Array; } /** * QueryConnectionsResponse is the response type for the Query/Connections RPC * method. */ - -export interface QueryConnectionsResponseSDKType { +export interface QueryConnectionsResponseAmino { /** list of stored connections of the chain. */ - connections: IdentifiedConnectionSDKType[]; + connections?: IdentifiedConnectionAmino[]; /** pagination response */ - - pagination?: PageResponseSDKType; + pagination?: PageResponseAmino; /** query block height */ - - height?: HeightSDKType; + height?: HeightAmino; +} +export interface QueryConnectionsResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionsResponse"; + value: QueryConnectionsResponseAmino; +} +/** + * QueryConnectionsResponse is the response type for the Query/Connections RPC + * method. + */ +export interface QueryConnectionsResponseSDKType { + connections: IdentifiedConnectionSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; } /** * QueryClientConnectionsRequest is the request type for the * Query/ClientConnections RPC method */ - export interface QueryClientConnectionsRequest { /** client identifier associated with a connection */ clientId: string; } +export interface QueryClientConnectionsRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest"; + value: Uint8Array; +} /** * QueryClientConnectionsRequest is the request type for the * Query/ClientConnections RPC method */ - -export interface QueryClientConnectionsRequestSDKType { +export interface QueryClientConnectionsRequestAmino { /** client identifier associated with a connection */ + client_id?: string; +} +export interface QueryClientConnectionsRequestAminoMsg { + type: "cosmos-sdk/QueryClientConnectionsRequest"; + value: QueryClientConnectionsRequestAmino; +} +/** + * QueryClientConnectionsRequest is the request type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsRequestSDKType { client_id: string; } /** * QueryClientConnectionsResponse is the response type for the * Query/ClientConnections RPC method */ - export interface QueryClientConnectionsResponse { /** slice of all the connection paths associated with a client. */ connectionPaths: string[]; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was generated */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryClientConnectionsResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse"; + value: Uint8Array; } /** * QueryClientConnectionsResponse is the response type for the * Query/ClientConnections RPC method */ - -export interface QueryClientConnectionsResponseSDKType { +export interface QueryClientConnectionsResponseAmino { /** slice of all the connection paths associated with a client. */ - connection_paths: string[]; + connection_paths?: string[]; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was generated */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryClientConnectionsResponseAminoMsg { + type: "cosmos-sdk/QueryClientConnectionsResponse"; + value: QueryClientConnectionsResponseAmino; +} +/** + * QueryClientConnectionsResponse is the response type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsResponseSDKType { + connection_paths: string[]; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryConnectionClientStateRequest is the request type for the * Query/ConnectionClientState RPC method */ - export interface QueryConnectionClientStateRequest { /** connection identifier */ connectionId: string; } +export interface QueryConnectionClientStateRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest"; + value: Uint8Array; +} /** * QueryConnectionClientStateRequest is the request type for the * Query/ConnectionClientState RPC method */ - -export interface QueryConnectionClientStateRequestSDKType { +export interface QueryConnectionClientStateRequestAmino { /** connection identifier */ + connection_id?: string; +} +export interface QueryConnectionClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionClientStateRequest"; + value: QueryConnectionClientStateRequestAmino; +} +/** + * QueryConnectionClientStateRequest is the request type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateRequestSDKType { connection_id: string; } /** * QueryConnectionClientStateResponse is the response type for the * Query/ConnectionClientState RPC method */ - export interface QueryConnectionClientStateResponse { /** client state associated with the channel */ identifiedClientState?: IdentifiedClientState; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryConnectionClientStateResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse"; + value: Uint8Array; } /** * QueryConnectionClientStateResponse is the response type for the * Query/ConnectionClientState RPC method */ - -export interface QueryConnectionClientStateResponseSDKType { +export interface QueryConnectionClientStateResponseAmino { /** client state associated with the channel */ - identified_client_state?: IdentifiedClientStateSDKType; + identified_client_state?: IdentifiedClientStateAmino; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryConnectionClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionClientStateResponse"; + value: QueryConnectionClientStateResponseAmino; +} +/** + * QueryConnectionClientStateResponse is the response type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateResponseSDKType { + identified_client_state?: IdentifiedClientStateSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; } /** * QueryConnectionConsensusStateRequest is the request type for the * Query/ConnectionConsensusState RPC method */ - export interface QueryConnectionConsensusStateRequest { /** connection identifier */ connectionId: string; - revisionNumber: Long; - revisionHeight: Long; + revisionNumber: bigint; + revisionHeight: bigint; +} +export interface QueryConnectionConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest"; + value: Uint8Array; } /** * QueryConnectionConsensusStateRequest is the request type for the * Query/ConnectionConsensusState RPC method */ - -export interface QueryConnectionConsensusStateRequestSDKType { +export interface QueryConnectionConsensusStateRequestAmino { /** connection identifier */ + connection_id?: string; + revision_number?: string; + revision_height?: string; +} +export interface QueryConnectionConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionConsensusStateRequest"; + value: QueryConnectionConsensusStateRequestAmino; +} +/** + * QueryConnectionConsensusStateRequest is the request type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateRequestSDKType { connection_id: string; - revision_number: Long; - revision_height: Long; + revision_number: bigint; + revision_height: bigint; } /** * QueryConnectionConsensusStateResponse is the response type for the * Query/ConnectionConsensusState RPC method */ - export interface QueryConnectionConsensusStateResponse { /** consensus state associated with the channel */ consensusState?: Any; /** client ID associated with the consensus state */ - clientId: string; /** merkle proof of existence */ - proof: Uint8Array; /** height at which the proof was retrieved */ - - proofHeight?: Height; + proofHeight: Height; +} +export interface QueryConnectionConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse"; + value: Uint8Array; } /** * QueryConnectionConsensusStateResponse is the response type for the * Query/ConnectionConsensusState RPC method */ - -export interface QueryConnectionConsensusStateResponseSDKType { +export interface QueryConnectionConsensusStateResponseAmino { /** consensus state associated with the channel */ - consensus_state?: AnySDKType; + consensus_state?: AnyAmino; /** client ID associated with the consensus state */ - - client_id: string; + client_id?: string; /** merkle proof of existence */ - - proof: Uint8Array; + proof?: string; /** height at which the proof was retrieved */ - - proof_height?: HeightSDKType; + proof_height?: HeightAmino; +} +export interface QueryConnectionConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionConsensusStateResponse"; + value: QueryConnectionConsensusStateResponseAmino; +} +/** + * QueryConnectionConsensusStateResponse is the response type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + client_id: string; + proof: Uint8Array; + proof_height: HeightSDKType; } - function createBaseQueryConnectionRequest(): QueryConnectionRequest { return { connectionId: "" }; } - export const QueryConnectionRequest = { - encode(message: QueryConnectionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", + encode(message: QueryConnectionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connectionId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionRequest { + fromPartial(object: Partial): QueryConnectionRequest { const message = createBaseQueryConnectionRequest(); message.connectionId = object.connectionId ?? ""; return message; + }, + fromAmino(object: QueryConnectionRequestAmino): QueryConnectionRequest { + const message = createBaseQueryConnectionRequest(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + return message; + }, + toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { + const obj: any = {}; + obj.connection_id = message.connectionId; + return obj; + }, + fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { + return QueryConnectionRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionRequest): QueryConnectionRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionRequest", + value: QueryConnectionRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionRequestProtoMsg): QueryConnectionRequest { + return QueryConnectionRequest.decode(message.value); + }, + toProto(message: QueryConnectionRequest): Uint8Array { + return QueryConnectionRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionRequest): QueryConnectionRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", + value: QueryConnectionRequest.encode(message).finish() + }; } - }; - function createBaseQueryConnectionResponse(): QueryConnectionResponse { return { connection: undefined, proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryConnectionResponse = { - encode(message: QueryConnectionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", + encode(message: QueryConnectionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connection !== undefined) { ConnectionEnd.encode(message.connection, writer.uint32(10).fork()).ldelim(); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connection = ConnectionEnd.decode(reader, reader.uint32()); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionResponse { + fromPartial(object: Partial): QueryConnectionResponse { const message = createBaseQueryConnectionResponse(); message.connection = object.connection !== undefined && object.connection !== null ? ConnectionEnd.fromPartial(object.connection) : undefined; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryConnectionResponseAmino): QueryConnectionResponse { + const message = createBaseQueryConnectionResponse(); + if (object.connection !== undefined && object.connection !== null) { + message.connection = ConnectionEnd.fromAmino(object.connection); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryConnectionResponse): QueryConnectionResponseAmino { + const obj: any = {}; + obj.connection = message.connection ? ConnectionEnd.toAmino(message.connection) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionResponseAminoMsg): QueryConnectionResponse { + return QueryConnectionResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionResponse): QueryConnectionResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionResponse", + value: QueryConnectionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionResponseProtoMsg): QueryConnectionResponse { + return QueryConnectionResponse.decode(message.value); + }, + toProto(message: QueryConnectionResponse): Uint8Array { + return QueryConnectionResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionResponse): QueryConnectionResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", + value: QueryConnectionResponse.encode(message).finish() + }; } - }; - function createBaseQueryConnectionsRequest(): QueryConnectionsRequest { return { pagination: undefined }; } - export const QueryConnectionsRequest = { - encode(message: QueryConnectionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest", + encode(message: QueryConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pagination = PageRequest.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionsRequest { + fromPartial(object: Partial): QueryConnectionsRequest { const message = createBaseQueryConnectionsRequest(); message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; + }, + fromAmino(object: QueryConnectionsRequestAmino): QueryConnectionsRequest { + const message = createBaseQueryConnectionsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConnectionsRequest): QueryConnectionsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConnectionsRequestAminoMsg): QueryConnectionsRequest { + return QueryConnectionsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionsRequest): QueryConnectionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionsRequest", + value: QueryConnectionsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionsRequestProtoMsg): QueryConnectionsRequest { + return QueryConnectionsRequest.decode(message.value); + }, + toProto(message: QueryConnectionsRequest): Uint8Array { + return QueryConnectionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionsRequest): QueryConnectionsRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest", + value: QueryConnectionsRequest.encode(message).finish() + }; } - }; - function createBaseQueryConnectionsResponse(): QueryConnectionsResponse { return { connections: [], pagination: undefined, - height: undefined + height: Height.fromPartial({}) }; } - export const QueryConnectionsResponse = { - encode(message: QueryConnectionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", + encode(message: QueryConnectionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connections) { IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } - if (message.height !== undefined) { Height.encode(message.height, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connections.push(IdentifiedConnection.decode(reader, reader.uint32())); break; - case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); break; - case 3: message.height = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionsResponse { + fromPartial(object: Partial): QueryConnectionsResponse { const message = createBaseQueryConnectionsResponse(); message.connections = object.connections?.map(e => IdentifiedConnection.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; + }, + fromAmino(object: QueryConnectionsResponseAmino): QueryConnectionsResponse { + const message = createBaseQueryConnectionsResponse(); + message.connections = object.connections?.map(e => IdentifiedConnection.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryConnectionsResponse): QueryConnectionsResponseAmino { + const obj: any = {}; + if (message.connections) { + obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); + } else { + obj.connections = []; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionsResponseAminoMsg): QueryConnectionsResponse { + return QueryConnectionsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionsResponse): QueryConnectionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionsResponse", + value: QueryConnectionsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionsResponseProtoMsg): QueryConnectionsResponse { + return QueryConnectionsResponse.decode(message.value); + }, + toProto(message: QueryConnectionsResponse): Uint8Array { + return QueryConnectionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionsResponse): QueryConnectionsResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", + value: QueryConnectionsResponse.encode(message).finish() + }; } - }; - function createBaseQueryClientConnectionsRequest(): QueryClientConnectionsRequest { return { clientId: "" }; } - export const QueryClientConnectionsRequest = { - encode(message: QueryClientConnectionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", + encode(message: QueryClientConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientConnectionsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientConnectionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientConnectionsRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientConnectionsRequest { + fromPartial(object: Partial): QueryClientConnectionsRequest { const message = createBaseQueryClientConnectionsRequest(); message.clientId = object.clientId ?? ""; return message; + }, + fromAmino(object: QueryClientConnectionsRequestAmino): QueryClientConnectionsRequest { + const message = createBaseQueryClientConnectionsRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + return message; + }, + toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + return obj; + }, + fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { + return QueryClientConnectionsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientConnectionsRequest", + value: QueryClientConnectionsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientConnectionsRequestProtoMsg): QueryClientConnectionsRequest { + return QueryClientConnectionsRequest.decode(message.value); + }, + toProto(message: QueryClientConnectionsRequest): Uint8Array { + return QueryClientConnectionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", + value: QueryClientConnectionsRequest.encode(message).finish() + }; } - }; - function createBaseQueryClientConnectionsResponse(): QueryClientConnectionsResponse { return { connectionPaths: [], proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryClientConnectionsResponse = { - encode(message: QueryClientConnectionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", + encode(message: QueryClientConnectionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connectionPaths) { writer.uint32(10).string(v!); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientConnectionsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientConnectionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryClientConnectionsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connectionPaths.push(reader.string()); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryClientConnectionsResponse { + fromPartial(object: Partial): QueryClientConnectionsResponse { const message = createBaseQueryClientConnectionsResponse(); message.connectionPaths = object.connectionPaths?.map(e => e) || []; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryClientConnectionsResponseAmino): QueryClientConnectionsResponse { + const message = createBaseQueryClientConnectionsResponse(); + message.connectionPaths = object.connection_paths?.map(e => e) || []; + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryClientConnectionsResponse): QueryClientConnectionsResponseAmino { + const obj: any = {}; + if (message.connectionPaths) { + obj.connection_paths = message.connectionPaths.map(e => e); + } else { + obj.connection_paths = []; + } + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryClientConnectionsResponseAminoMsg): QueryClientConnectionsResponse { + return QueryClientConnectionsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientConnectionsResponse): QueryClientConnectionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientConnectionsResponse", + value: QueryClientConnectionsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientConnectionsResponseProtoMsg): QueryClientConnectionsResponse { + return QueryClientConnectionsResponse.decode(message.value); + }, + toProto(message: QueryClientConnectionsResponse): Uint8Array { + return QueryClientConnectionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientConnectionsResponse): QueryClientConnectionsResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", + value: QueryClientConnectionsResponse.encode(message).finish() + }; } - }; - function createBaseQueryConnectionClientStateRequest(): QueryConnectionClientStateRequest { return { connectionId: "" }; } - export const QueryConnectionClientStateRequest = { - encode(message: QueryConnectionClientStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", + encode(message: QueryConnectionClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionClientStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionClientStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionClientStateRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connectionId = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionClientStateRequest { + fromPartial(object: Partial): QueryConnectionClientStateRequest { const message = createBaseQueryConnectionClientStateRequest(); message.connectionId = object.connectionId ?? ""; return message; + }, + fromAmino(object: QueryConnectionClientStateRequestAmino): QueryConnectionClientStateRequest { + const message = createBaseQueryConnectionClientStateRequest(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + return message; + }, + toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { + const obj: any = {}; + obj.connection_id = message.connectionId; + return obj; + }, + fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { + return QueryConnectionClientStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionClientStateRequest", + value: QueryConnectionClientStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionClientStateRequestProtoMsg): QueryConnectionClientStateRequest { + return QueryConnectionClientStateRequest.decode(message.value); + }, + toProto(message: QueryConnectionClientStateRequest): Uint8Array { + return QueryConnectionClientStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", + value: QueryConnectionClientStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryConnectionClientStateResponse(): QueryConnectionClientStateResponse { return { identifiedClientState: undefined, proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryConnectionClientStateResponse = { - encode(message: QueryConnectionClientStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", + encode(message: QueryConnectionClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifiedClientState !== undefined) { IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); } - if (message.proof.length !== 0) { writer.uint32(18).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionClientStateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionClientStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionClientStateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.identifiedClientState = IdentifiedClientState.decode(reader, reader.uint32()); break; - case 2: message.proof = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionClientStateResponse { + fromPartial(object: Partial): QueryConnectionClientStateResponse { const message = createBaseQueryConnectionClientStateResponse(); message.identifiedClientState = object.identifiedClientState !== undefined && object.identifiedClientState !== null ? IdentifiedClientState.fromPartial(object.identifiedClientState) : undefined; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryConnectionClientStateResponseAmino): QueryConnectionClientStateResponse { + const message = createBaseQueryConnectionClientStateResponse(); + if (object.identified_client_state !== undefined && object.identified_client_state !== null) { + message.identifiedClientState = IdentifiedClientState.fromAmino(object.identified_client_state); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryConnectionClientStateResponse): QueryConnectionClientStateResponseAmino { + const obj: any = {}; + obj.identified_client_state = message.identifiedClientState ? IdentifiedClientState.toAmino(message.identifiedClientState) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionClientStateResponseAminoMsg): QueryConnectionClientStateResponse { + return QueryConnectionClientStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionClientStateResponse): QueryConnectionClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionClientStateResponse", + value: QueryConnectionClientStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionClientStateResponseProtoMsg): QueryConnectionClientStateResponse { + return QueryConnectionClientStateResponse.decode(message.value); + }, + toProto(message: QueryConnectionClientStateResponse): Uint8Array { + return QueryConnectionClientStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionClientStateResponse): QueryConnectionClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", + value: QueryConnectionClientStateResponse.encode(message).finish() + }; } - }; - function createBaseQueryConnectionConsensusStateRequest(): QueryConnectionConsensusStateRequest { return { connectionId: "", - revisionNumber: Long.UZERO, - revisionHeight: Long.UZERO + revisionNumber: BigInt(0), + revisionHeight: BigInt(0) }; } - export const QueryConnectionConsensusStateRequest = { - encode(message: QueryConnectionConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", + encode(message: QueryConnectionConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } - - if (!message.revisionNumber.isZero()) { + if (message.revisionNumber !== BigInt(0)) { writer.uint32(16).uint64(message.revisionNumber); } - - if (!message.revisionHeight.isZero()) { + if (message.revisionHeight !== BigInt(0)) { writer.uint32(24).uint64(message.revisionHeight); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionConsensusStateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionConsensusStateRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connectionId = reader.string(); break; - case 2: - message.revisionNumber = (reader.uint64() as Long); + message.revisionNumber = reader.uint64(); break; - case 3: - message.revisionHeight = (reader.uint64() as Long); + message.revisionHeight = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionConsensusStateRequest { + fromPartial(object: Partial): QueryConnectionConsensusStateRequest { const message = createBaseQueryConnectionConsensusStateRequest(); message.connectionId = object.connectionId ?? ""; - message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? Long.fromValue(object.revisionNumber) : Long.UZERO; - message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? Long.fromValue(object.revisionHeight) : Long.UZERO; + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryConnectionConsensusStateRequestAmino): QueryConnectionConsensusStateRequest { + const message = createBaseQueryConnectionConsensusStateRequest(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.revision_number !== undefined && object.revision_number !== null) { + message.revisionNumber = BigInt(object.revision_number); + } + if (object.revision_height !== undefined && object.revision_height !== null) { + message.revisionHeight = BigInt(object.revision_height); + } return message; + }, + toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { + const obj: any = {}; + obj.connection_id = message.connectionId; + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { + return QueryConnectionConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionConsensusStateRequest", + value: QueryConnectionConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionConsensusStateRequestProtoMsg): QueryConnectionConsensusStateRequest { + return QueryConnectionConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryConnectionConsensusStateRequest): Uint8Array { + return QueryConnectionConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", + value: QueryConnectionConsensusStateRequest.encode(message).finish() + }; } - }; - function createBaseQueryConnectionConsensusStateResponse(): QueryConnectionConsensusStateResponse { return { consensusState: undefined, clientId: "", proof: new Uint8Array(), - proofHeight: undefined + proofHeight: Height.fromPartial({}) }; } - export const QueryConnectionConsensusStateResponse = { - encode(message: QueryConnectionConsensusStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", + encode(message: QueryConnectionConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); } - if (message.clientId !== "") { writer.uint32(18).string(message.clientId); } - if (message.proof.length !== 0) { writer.uint32(26).bytes(message.proof); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionConsensusStateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryConnectionConsensusStateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.consensusState = Any.decode(reader, reader.uint32()); break; - case 2: message.clientId = reader.string(); break; - case 3: message.proof = reader.bytes(); break; - case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryConnectionConsensusStateResponse { + fromPartial(object: Partial): QueryConnectionConsensusStateResponse { const message = createBaseQueryConnectionConsensusStateResponse(); message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.clientId = object.clientId ?? ""; message.proof = object.proof ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; + }, + fromAmino(object: QueryConnectionConsensusStateResponseAmino): QueryConnectionConsensusStateResponse { + const message = createBaseQueryConnectionConsensusStateResponse(); + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { + const obj: any = {}; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.client_id = message.clientId; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionConsensusStateResponseAminoMsg): QueryConnectionConsensusStateResponse { + return QueryConnectionConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionConsensusStateResponse", + value: QueryConnectionConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionConsensusStateResponseProtoMsg): QueryConnectionConsensusStateResponse { + return QueryConnectionConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryConnectionConsensusStateResponse): Uint8Array { + return QueryConnectionConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", + value: QueryConnectionConsensusStateResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/tx.amino.ts b/src/codegen/ibc/core/connection/v1/tx.amino.ts index cf870e6..1ad5770 100644 --- a/src/codegen/ibc/core/connection/v1/tx.amino.ts +++ b/src/codegen/ibc/core/connection/v1/tx.amino.ts @@ -1,343 +1,23 @@ -import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, Long, omitDefault } from "../../../../helpers"; import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm } from "./tx"; -export interface AminoMsgConnectionOpenInit extends AminoMsg { - type: "cosmos-sdk/MsgConnectionOpenInit"; - value: { - client_id: string; - counterparty: { - client_id: string; - connection_id: string; - prefix: { - key_prefix: Uint8Array; - }; - }; - version: { - identifier: string; - features: string[]; - }; - delay_period: string; - signer: string; - }; -} -export interface AminoMsgConnectionOpenTry extends AminoMsg { - type: "cosmos-sdk/MsgConnectionOpenTry"; - value: { - client_id: string; - previous_connection_id: string; - client_state: { - type_url: string; - value: Uint8Array; - }; - counterparty: { - client_id: string; - connection_id: string; - prefix: { - key_prefix: Uint8Array; - }; - }; - delay_period: string; - counterparty_versions: { - identifier: string; - features: string[]; - }[]; - proof_height: AminoHeight; - proof_init: Uint8Array; - proof_client: Uint8Array; - proof_consensus: Uint8Array; - consensus_height: AminoHeight; - signer: string; - }; -} -export interface AminoMsgConnectionOpenAck extends AminoMsg { - type: "cosmos-sdk/MsgConnectionOpenAck"; - value: { - connection_id: string; - counterparty_connection_id: string; - version: { - identifier: string; - features: string[]; - }; - client_state: { - type_url: string; - value: Uint8Array; - }; - proof_height: AminoHeight; - proof_try: Uint8Array; - proof_client: Uint8Array; - proof_consensus: Uint8Array; - consensus_height: AminoHeight; - signer: string; - }; -} -export interface AminoMsgConnectionOpenConfirm extends AminoMsg { - type: "cosmos-sdk/MsgConnectionOpenConfirm"; - value: { - connection_id: string; - proof_ack: Uint8Array; - proof_height: AminoHeight; - signer: string; - }; -} export const AminoConverter = { "/ibc.core.connection.v1.MsgConnectionOpenInit": { aminoType: "cosmos-sdk/MsgConnectionOpenInit", - toAmino: ({ - clientId, - counterparty, - version, - delayPeriod, - signer - }: MsgConnectionOpenInit): AminoMsgConnectionOpenInit["value"] => { - return { - client_id: clientId, - counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, - prefix: { - key_prefix: counterparty.prefix.keyPrefix - } - }, - version: { - identifier: version.identifier, - features: version.features - }, - delay_period: delayPeriod.toString(), - signer - }; - }, - fromAmino: ({ - client_id, - counterparty, - version, - delay_period, - signer - }: AminoMsgConnectionOpenInit["value"]): MsgConnectionOpenInit => { - return { - clientId: client_id, - counterparty: { - clientId: counterparty.client_id, - connectionId: counterparty.connection_id, - prefix: { - keyPrefix: counterparty.prefix.key_prefix - } - }, - version: { - identifier: version.identifier, - features: version.features - }, - delayPeriod: Long.fromString(delay_period), - signer - }; - } + toAmino: MsgConnectionOpenInit.toAmino, + fromAmino: MsgConnectionOpenInit.fromAmino }, "/ibc.core.connection.v1.MsgConnectionOpenTry": { aminoType: "cosmos-sdk/MsgConnectionOpenTry", - toAmino: ({ - clientId, - previousConnectionId, - clientState, - counterparty, - delayPeriod, - counterpartyVersions, - proofHeight, - proofInit, - proofClient, - proofConsensus, - consensusHeight, - signer - }: MsgConnectionOpenTry): AminoMsgConnectionOpenTry["value"] => { - return { - client_id: clientId, - previous_connection_id: previousConnectionId, - client_state: { - type_url: clientState.typeUrl, - value: clientState.value - }, - counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, - prefix: { - key_prefix: counterparty.prefix.keyPrefix - } - }, - delay_period: delayPeriod.toString(), - counterparty_versions: counterpartyVersions.map(el0 => ({ - identifier: el0.identifier, - features: el0.features - })), - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - proof_init: proofInit, - proof_client: proofClient, - proof_consensus: proofConsensus, - consensus_height: consensusHeight ? { - revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), - revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - client_id, - previous_connection_id, - client_state, - counterparty, - delay_period, - counterparty_versions, - proof_height, - proof_init, - proof_client, - proof_consensus, - consensus_height, - signer - }: AminoMsgConnectionOpenTry["value"]): MsgConnectionOpenTry => { - return { - clientId: client_id, - previousConnectionId: previous_connection_id, - clientState: { - typeUrl: client_state.type_url, - value: client_state.value - }, - counterparty: { - clientId: counterparty.client_id, - connectionId: counterparty.connection_id, - prefix: { - keyPrefix: counterparty.prefix.key_prefix - } - }, - delayPeriod: Long.fromString(delay_period), - counterpartyVersions: counterparty_versions.map(el0 => ({ - identifier: el0.identifier, - features: el0.features - })), - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - proofInit: proof_init, - proofClient: proof_client, - proofConsensus: proof_consensus, - consensusHeight: consensus_height ? { - revisionHeight: Long.fromString(consensus_height.revision_height || "0", true), - revisionNumber: Long.fromString(consensus_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgConnectionOpenTry.toAmino, + fromAmino: MsgConnectionOpenTry.fromAmino }, "/ibc.core.connection.v1.MsgConnectionOpenAck": { aminoType: "cosmos-sdk/MsgConnectionOpenAck", - toAmino: ({ - connectionId, - counterpartyConnectionId, - version, - clientState, - proofHeight, - proofTry, - proofClient, - proofConsensus, - consensusHeight, - signer - }: MsgConnectionOpenAck): AminoMsgConnectionOpenAck["value"] => { - return { - connection_id: connectionId, - counterparty_connection_id: counterpartyConnectionId, - version: { - identifier: version.identifier, - features: version.features - }, - client_state: { - type_url: clientState.typeUrl, - value: clientState.value - }, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - proof_try: proofTry, - proof_client: proofClient, - proof_consensus: proofConsensus, - consensus_height: consensusHeight ? { - revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), - revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - connection_id, - counterparty_connection_id, - version, - client_state, - proof_height, - proof_try, - proof_client, - proof_consensus, - consensus_height, - signer - }: AminoMsgConnectionOpenAck["value"]): MsgConnectionOpenAck => { - return { - connectionId: connection_id, - counterpartyConnectionId: counterparty_connection_id, - version: { - identifier: version.identifier, - features: version.features - }, - clientState: { - typeUrl: client_state.type_url, - value: client_state.value - }, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - proofTry: proof_try, - proofClient: proof_client, - proofConsensus: proof_consensus, - consensusHeight: consensus_height ? { - revisionHeight: Long.fromString(consensus_height.revision_height || "0", true), - revisionNumber: Long.fromString(consensus_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgConnectionOpenAck.toAmino, + fromAmino: MsgConnectionOpenAck.fromAmino }, "/ibc.core.connection.v1.MsgConnectionOpenConfirm": { aminoType: "cosmos-sdk/MsgConnectionOpenConfirm", - toAmino: ({ - connectionId, - proofAck, - proofHeight, - signer - }: MsgConnectionOpenConfirm): AminoMsgConnectionOpenConfirm["value"] => { - return { - connection_id: connectionId, - proof_ack: proofAck, - proof_height: proofHeight ? { - revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), - revision_number: omitDefault(proofHeight.revisionNumber)?.toString() - } : {}, - signer - }; - }, - fromAmino: ({ - connection_id, - proof_ack, - proof_height, - signer - }: AminoMsgConnectionOpenConfirm["value"]): MsgConnectionOpenConfirm => { - return { - connectionId: connection_id, - proofAck: proof_ack, - proofHeight: proof_height ? { - revisionHeight: Long.fromString(proof_height.revision_height || "0", true), - revisionNumber: Long.fromString(proof_height.revision_number || "0", true) - } : undefined, - signer - }; - } + toAmino: MsgConnectionOpenConfirm.toAmino, + fromAmino: MsgConnectionOpenConfirm.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/tx.registry.ts b/src/codegen/ibc/core/connection/v1/tx.registry.ts index 1cc79cf..2737361 100644 --- a/src/codegen/ibc/core/connection/v1/tx.registry.ts +++ b/src/codegen/ibc/core/connection/v1/tx.registry.ts @@ -14,28 +14,24 @@ export const MessageComposer = { value: MsgConnectionOpenInit.encode(value).finish() }; }, - connectionOpenTry(value: MsgConnectionOpenTry) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: MsgConnectionOpenTry.encode(value).finish() }; }, - connectionOpenAck(value: MsgConnectionOpenAck) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: MsgConnectionOpenAck.encode(value).finish() }; }, - connectionOpenConfirm(value: MsgConnectionOpenConfirm) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: MsgConnectionOpenConfirm.encode(value).finish() }; } - }, withTypeUrl: { connectionOpenInit(value: MsgConnectionOpenInit) { @@ -44,28 +40,24 @@ export const MessageComposer = { value }; }, - connectionOpenTry(value: MsgConnectionOpenTry) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value }; }, - connectionOpenAck(value: MsgConnectionOpenAck) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value }; }, - connectionOpenConfirm(value: MsgConnectionOpenConfirm) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value }; } - }, fromPartial: { connectionOpenInit(value: MsgConnectionOpenInit) { @@ -74,27 +66,23 @@ export const MessageComposer = { value: MsgConnectionOpenInit.fromPartial(value) }; }, - connectionOpenTry(value: MsgConnectionOpenTry) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: MsgConnectionOpenTry.fromPartial(value) }; }, - connectionOpenAck(value: MsgConnectionOpenAck) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: MsgConnectionOpenAck.fromPartial(value) }; }, - connectionOpenConfirm(value: MsgConnectionOpenConfirm) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: MsgConnectionOpenConfirm.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/tx.rpc.msg.ts b/src/codegen/ibc/core/connection/v1/tx.rpc.msg.ts index bfda3f8..d5a2127 100644 --- a/src/codegen/ibc/core/connection/v1/tx.rpc.msg.ts +++ b/src/codegen/ibc/core/connection/v1/tx.rpc.msg.ts @@ -1,27 +1,22 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { MsgConnectionOpenInit, MsgConnectionOpenInitResponse, MsgConnectionOpenTry, MsgConnectionOpenTryResponse, MsgConnectionOpenAck, MsgConnectionOpenAckResponse, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmResponse } from "./tx"; /** Msg defines the ibc/connection Msg service. */ - export interface Msg { /** ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. */ connectionOpenInit(request: MsgConnectionOpenInit): Promise; /** ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. */ - connectionOpenTry(request: MsgConnectionOpenTry): Promise; /** ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. */ - connectionOpenAck(request: MsgConnectionOpenAck): Promise; /** * ConnectionOpenConfirm defines a rpc handler method for * MsgConnectionOpenConfirm. */ - connectionOpenConfirm(request: MsgConnectionOpenConfirm): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.connectionOpenInit = this.connectionOpenInit.bind(this); @@ -29,29 +24,24 @@ export class MsgClientImpl implements Msg { this.connectionOpenAck = this.connectionOpenAck.bind(this); this.connectionOpenConfirm = this.connectionOpenConfirm.bind(this); } - connectionOpenInit(request: MsgConnectionOpenInit): Promise { const data = MsgConnectionOpenInit.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenInit", data); - return promise.then(data => MsgConnectionOpenInitResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgConnectionOpenInitResponse.decode(new BinaryReader(data))); } - connectionOpenTry(request: MsgConnectionOpenTry): Promise { const data = MsgConnectionOpenTry.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenTry", data); - return promise.then(data => MsgConnectionOpenTryResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgConnectionOpenTryResponse.decode(new BinaryReader(data))); } - connectionOpenAck(request: MsgConnectionOpenAck): Promise { const data = MsgConnectionOpenAck.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenAck", data); - return promise.then(data => MsgConnectionOpenAckResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgConnectionOpenAckResponse.decode(new BinaryReader(data))); } - connectionOpenConfirm(request: MsgConnectionOpenConfirm): Promise { const data = MsgConnectionOpenConfirm.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenConfirm", data); - return promise.then(data => MsgConnectionOpenConfirmResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgConnectionOpenConfirmResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/ibc/core/connection/v1/tx.ts b/src/codegen/ibc/core/connection/v1/tx.ts index 912e37a..148f614 100644 --- a/src/codegen/ibc/core/connection/v1/tx.ts +++ b/src/codegen/ibc/core/connection/v1/tx.ts @@ -1,475 +1,600 @@ -import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { Height, HeightSDKType } from "../../client/v1/client"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { Counterparty, CounterpartyAmino, CounterpartySDKType, Version, VersionAmino, VersionSDKType } from "./connection"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to * initialize a connection with Chain B. */ - export interface MsgConnectionOpenInit { clientId: string; - counterparty?: Counterparty; + counterparty: Counterparty; version?: Version; - delayPeriod: Long; + delayPeriod: bigint; signer: string; } +export interface MsgConnectionOpenInitProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit"; + value: Uint8Array; +} +/** + * MsgConnectionOpenInit defines the msg sent by an account on Chain A to + * initialize a connection with Chain B. + */ +export interface MsgConnectionOpenInitAmino { + client_id?: string; + counterparty?: CounterpartyAmino; + version?: VersionAmino; + delay_period?: string; + signer?: string; +} +export interface MsgConnectionOpenInitAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenInit"; + value: MsgConnectionOpenInitAmino; +} /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to * initialize a connection with Chain B. */ - export interface MsgConnectionOpenInitSDKType { client_id: string; - counterparty?: CounterpartySDKType; + counterparty: CounterpartySDKType; version?: VersionSDKType; - delay_period: Long; + delay_period: bigint; signer: string; } /** * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response * type. */ - export interface MsgConnectionOpenInitResponse {} +export interface MsgConnectionOpenInitResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse"; + value: Uint8Array; +} +/** + * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + * type. + */ +export interface MsgConnectionOpenInitResponseAmino {} +export interface MsgConnectionOpenInitResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenInitResponse"; + value: MsgConnectionOpenInitResponseAmino; +} /** * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response * type. */ - export interface MsgConnectionOpenInitResponseSDKType {} /** * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a * connection on Chain B. */ - export interface MsgConnectionOpenTry { clientId: string; /** * in the case of crossing hello's, when both chains call OpenInit, we need * the connection identifier of the previous connection in state INIT */ - previousConnectionId: string; clientState?: Any; - counterparty?: Counterparty; - delayPeriod: Long; + counterparty: Counterparty; + delayPeriod: bigint; counterpartyVersions: Version[]; - proofHeight?: Height; + proofHeight: Height; /** * proof of the initialization the connection on Chain A: `UNITIALIZED -> * INIT` */ - proofInit: Uint8Array; /** proof of client state included in message */ - proofClient: Uint8Array; /** proof of client consensus state */ - proofConsensus: Uint8Array; - consensusHeight?: Height; + consensusHeight: Height; signer: string; } +export interface MsgConnectionOpenTryProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry"; + value: Uint8Array; +} /** * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a * connection on Chain B. */ - -export interface MsgConnectionOpenTrySDKType { - client_id: string; +export interface MsgConnectionOpenTryAmino { + client_id?: string; /** * in the case of crossing hello's, when both chains call OpenInit, we need * the connection identifier of the previous connection in state INIT */ - - previous_connection_id: string; - client_state?: AnySDKType; - counterparty?: CounterpartySDKType; - delay_period: Long; - counterparty_versions: VersionSDKType[]; - proof_height?: HeightSDKType; + previous_connection_id?: string; + client_state?: AnyAmino; + counterparty?: CounterpartyAmino; + delay_period?: string; + counterparty_versions?: VersionAmino[]; + proof_height?: HeightAmino; /** * proof of the initialization the connection on Chain A: `UNITIALIZED -> * INIT` */ - - proof_init: Uint8Array; + proof_init?: string; /** proof of client state included in message */ - - proof_client: Uint8Array; + proof_client?: string; /** proof of client consensus state */ - + proof_consensus?: string; + consensus_height?: HeightAmino; + signer?: string; +} +export interface MsgConnectionOpenTryAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenTry"; + value: MsgConnectionOpenTryAmino; +} +/** + * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + * connection on Chain B. + */ +export interface MsgConnectionOpenTrySDKType { + client_id: string; + previous_connection_id: string; + client_state?: AnySDKType; + counterparty: CounterpartySDKType; + delay_period: bigint; + counterparty_versions: VersionSDKType[]; + proof_height: HeightSDKType; + proof_init: Uint8Array; + proof_client: Uint8Array; proof_consensus: Uint8Array; - consensus_height?: HeightSDKType; + consensus_height: HeightSDKType; signer: string; } /** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ - export interface MsgConnectionOpenTryResponse {} +export interface MsgConnectionOpenTryResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse"; + value: Uint8Array; +} +/** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ +export interface MsgConnectionOpenTryResponseAmino {} +export interface MsgConnectionOpenTryResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenTryResponse"; + value: MsgConnectionOpenTryResponseAmino; +} /** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ - export interface MsgConnectionOpenTryResponseSDKType {} /** * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to * acknowledge the change of connection state to TRYOPEN on Chain B. */ - export interface MsgConnectionOpenAck { connectionId: string; counterpartyConnectionId: string; version?: Version; clientState?: Any; - proofHeight?: Height; + proofHeight: Height; /** * proof of the initialization the connection on Chain B: `UNITIALIZED -> * TRYOPEN` */ - proofTry: Uint8Array; /** proof of client state included in message */ - proofClient: Uint8Array; /** proof of client consensus state */ - proofConsensus: Uint8Array; - consensusHeight?: Height; + consensusHeight: Height; signer: string; } +export interface MsgConnectionOpenAckProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck"; + value: Uint8Array; +} +/** + * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + * acknowledge the change of connection state to TRYOPEN on Chain B. + */ +export interface MsgConnectionOpenAckAmino { + connection_id?: string; + counterparty_connection_id?: string; + version?: VersionAmino; + client_state?: AnyAmino; + proof_height?: HeightAmino; + /** + * proof of the initialization the connection on Chain B: `UNITIALIZED -> + * TRYOPEN` + */ + proof_try?: string; + /** proof of client state included in message */ + proof_client?: string; + /** proof of client consensus state */ + proof_consensus?: string; + consensus_height?: HeightAmino; + signer?: string; +} +export interface MsgConnectionOpenAckAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenAck"; + value: MsgConnectionOpenAckAmino; +} /** * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to * acknowledge the change of connection state to TRYOPEN on Chain B. */ - export interface MsgConnectionOpenAckSDKType { connection_id: string; counterparty_connection_id: string; version?: VersionSDKType; client_state?: AnySDKType; - proof_height?: HeightSDKType; - /** - * proof of the initialization the connection on Chain B: `UNITIALIZED -> - * TRYOPEN` - */ - + proof_height: HeightSDKType; proof_try: Uint8Array; - /** proof of client state included in message */ - proof_client: Uint8Array; - /** proof of client consensus state */ - proof_consensus: Uint8Array; - consensus_height?: HeightSDKType; + consensus_height: HeightSDKType; signer: string; } /** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ - export interface MsgConnectionOpenAckResponse {} +export interface MsgConnectionOpenAckResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse"; + value: Uint8Array; +} +/** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ +export interface MsgConnectionOpenAckResponseAmino {} +export interface MsgConnectionOpenAckResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenAckResponse"; + value: MsgConnectionOpenAckResponseAmino; +} /** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ - export interface MsgConnectionOpenAckResponseSDKType {} /** * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to * acknowledge the change of connection state to OPEN on Chain A. */ - export interface MsgConnectionOpenConfirm { connectionId: string; /** proof for the change of the connection state on Chain A: `INIT -> OPEN` */ - proofAck: Uint8Array; - proofHeight?: Height; + proofHeight: Height; signer: string; } +export interface MsgConnectionOpenConfirmProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm"; + value: Uint8Array; +} +/** + * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of connection state to OPEN on Chain A. + */ +export interface MsgConnectionOpenConfirmAmino { + connection_id?: string; + /** proof for the change of the connection state on Chain A: `INIT -> OPEN` */ + proof_ack?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgConnectionOpenConfirmAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenConfirm"; + value: MsgConnectionOpenConfirmAmino; +} /** * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to * acknowledge the change of connection state to OPEN on Chain A. */ - export interface MsgConnectionOpenConfirmSDKType { connection_id: string; - /** proof for the change of the connection state on Chain A: `INIT -> OPEN` */ - proof_ack: Uint8Array; - proof_height?: HeightSDKType; + proof_height: HeightSDKType; signer: string; } /** * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm * response type. */ - export interface MsgConnectionOpenConfirmResponse {} +export interface MsgConnectionOpenConfirmResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse"; + value: Uint8Array; +} +/** + * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + * response type. + */ +export interface MsgConnectionOpenConfirmResponseAmino {} +export interface MsgConnectionOpenConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenConfirmResponse"; + value: MsgConnectionOpenConfirmResponseAmino; +} /** * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm * response type. */ - export interface MsgConnectionOpenConfirmResponseSDKType {} - function createBaseMsgConnectionOpenInit(): MsgConnectionOpenInit { return { clientId: "", - counterparty: undefined, + counterparty: Counterparty.fromPartial({}), version: undefined, - delayPeriod: Long.UZERO, + delayPeriod: BigInt(0), signer: "" }; } - export const MsgConnectionOpenInit = { - encode(message: MsgConnectionOpenInit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + encode(message: MsgConnectionOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(18).fork()).ldelim(); } - if (message.version !== undefined) { Version.encode(message.version, writer.uint32(26).fork()).ldelim(); } - - if (!message.delayPeriod.isZero()) { + if (message.delayPeriod !== BigInt(0)) { writer.uint32(32).uint64(message.delayPeriod); } - if (message.signer !== "") { writer.uint32(42).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgConnectionOpenInit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgConnectionOpenInit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; - case 3: message.version = Version.decode(reader, reader.uint32()); break; - case 4: - message.delayPeriod = (reader.uint64() as Long); + message.delayPeriod = reader.uint64(); break; - case 5: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgConnectionOpenInit { + fromPartial(object: Partial): MsgConnectionOpenInit { const message = createBaseMsgConnectionOpenInit(); message.clientId = object.clientId ?? ""; message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; - message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? Long.fromValue(object.delayPeriod) : Long.UZERO; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgConnectionOpenInitAmino): MsgConnectionOpenInit { + const message = createBaseMsgConnectionOpenInit(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.version !== undefined && object.version !== null) { + message.version = Version.fromAmino(object.version); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.version = message.version ? Version.toAmino(message.version) : undefined; + obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { + return MsgConnectionOpenInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenInit): MsgConnectionOpenInitAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenInit", + value: MsgConnectionOpenInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenInitProtoMsg): MsgConnectionOpenInit { + return MsgConnectionOpenInit.decode(message.value); + }, + toProto(message: MsgConnectionOpenInit): Uint8Array { + return MsgConnectionOpenInit.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenInit): MsgConnectionOpenInitProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + value: MsgConnectionOpenInit.encode(message).finish() + }; } - }; - function createBaseMsgConnectionOpenInitResponse(): MsgConnectionOpenInitResponse { return {}; } - export const MsgConnectionOpenInitResponse = { - encode(_: MsgConnectionOpenInitResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", + encode(_: MsgConnectionOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgConnectionOpenInitResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgConnectionOpenInitResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgConnectionOpenInitResponse { + fromPartial(_: Partial): MsgConnectionOpenInitResponse { const message = createBaseMsgConnectionOpenInitResponse(); return message; + }, + fromAmino(_: MsgConnectionOpenInitResponseAmino): MsgConnectionOpenInitResponse { + const message = createBaseMsgConnectionOpenInitResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenInitResponseAminoMsg): MsgConnectionOpenInitResponse { + return MsgConnectionOpenInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenInitResponse", + value: MsgConnectionOpenInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenInitResponseProtoMsg): MsgConnectionOpenInitResponse { + return MsgConnectionOpenInitResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenInitResponse): Uint8Array { + return MsgConnectionOpenInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", + value: MsgConnectionOpenInitResponse.encode(message).finish() + }; } - }; - function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { return { clientId: "", previousConnectionId: "", clientState: undefined, - counterparty: undefined, - delayPeriod: Long.UZERO, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0), counterpartyVersions: [], - proofHeight: undefined, + proofHeight: Height.fromPartial({}), proofInit: new Uint8Array(), proofClient: new Uint8Array(), proofConsensus: new Uint8Array(), - consensusHeight: undefined, + consensusHeight: Height.fromPartial({}), signer: "" }; } - export const MsgConnectionOpenTry = { - encode(message: MsgConnectionOpenTry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + encode(message: MsgConnectionOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.previousConnectionId !== "") { writer.uint32(18).string(message.previousConnectionId); } - if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(26).fork()).ldelim(); } - if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); } - - if (!message.delayPeriod.isZero()) { + if (message.delayPeriod !== BigInt(0)) { writer.uint32(40).uint64(message.delayPeriod); } - for (const v of message.counterpartyVersions) { Version.encode(v!, writer.uint32(50).fork()).ldelim(); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(58).fork()).ldelim(); } - if (message.proofInit.length !== 0) { writer.uint32(66).bytes(message.proofInit); } - if (message.proofClient.length !== 0) { writer.uint32(74).bytes(message.proofClient); } - if (message.proofConsensus.length !== 0) { writer.uint32(82).bytes(message.proofConsensus); } - if (message.consensusHeight !== undefined) { Height.encode(message.consensusHeight, writer.uint32(90).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(98).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgConnectionOpenTry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenTry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgConnectionOpenTry(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.previousConnectionId = reader.string(); break; - case 3: message.clientState = Any.decode(reader, reader.uint32()); break; - case 4: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; - case 5: - message.delayPeriod = (reader.uint64() as Long); + message.delayPeriod = reader.uint64(); break; - case 6: message.counterpartyVersions.push(Version.decode(reader, reader.uint32())); break; - case 7: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 8: message.proofInit = reader.bytes(); break; - case 9: message.proofClient = reader.bytes(); break; - case 10: message.proofConsensus = reader.bytes(); break; - case 11: message.consensusHeight = Height.decode(reader, reader.uint32()); break; - case 12: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgConnectionOpenTry { + fromPartial(object: Partial): MsgConnectionOpenTry { const message = createBaseMsgConnectionOpenTry(); message.clientId = object.clientId ?? ""; message.previousConnectionId = object.previousConnectionId ?? ""; message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; - message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? Long.fromValue(object.delayPeriod) : Long.UZERO; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); message.counterpartyVersions = object.counterpartyVersions?.map(e => Version.fromPartial(e)) || []; message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.proofInit = object.proofInit ?? new Uint8Array(); @@ -478,163 +603,237 @@ export const MsgConnectionOpenTry = { message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgConnectionOpenTryAmino): MsgConnectionOpenTry { + const message = createBaseMsgConnectionOpenTry(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.previous_connection_id !== undefined && object.previous_connection_id !== null) { + message.previousConnectionId = object.previous_connection_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + message.counterpartyVersions = object.counterparty_versions?.map(e => Version.fromAmino(e)) || []; + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_client !== undefined && object.proof_client !== null) { + message.proofClient = bytesFromBase64(object.proof_client); + } + if (object.proof_consensus !== undefined && object.proof_consensus !== null) { + message.proofConsensus = bytesFromBase64(object.proof_consensus); + } + if (object.consensus_height !== undefined && object.consensus_height !== null) { + message.consensusHeight = Height.fromAmino(object.consensus_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.previous_connection_id = message.previousConnectionId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + if (message.counterpartyVersions) { + obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.counterparty_versions = []; + } + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; + obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; + obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { + return MsgConnectionOpenTry.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenTry): MsgConnectionOpenTryAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenTry", + value: MsgConnectionOpenTry.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenTryProtoMsg): MsgConnectionOpenTry { + return MsgConnectionOpenTry.decode(message.value); + }, + toProto(message: MsgConnectionOpenTry): Uint8Array { + return MsgConnectionOpenTry.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenTry): MsgConnectionOpenTryProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + value: MsgConnectionOpenTry.encode(message).finish() + }; } - }; - function createBaseMsgConnectionOpenTryResponse(): MsgConnectionOpenTryResponse { return {}; } - export const MsgConnectionOpenTryResponse = { - encode(_: MsgConnectionOpenTryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", + encode(_: MsgConnectionOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgConnectionOpenTryResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenTryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgConnectionOpenTryResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgConnectionOpenTryResponse { + fromPartial(_: Partial): MsgConnectionOpenTryResponse { const message = createBaseMsgConnectionOpenTryResponse(); return message; + }, + fromAmino(_: MsgConnectionOpenTryResponseAmino): MsgConnectionOpenTryResponse { + const message = createBaseMsgConnectionOpenTryResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenTryResponseAminoMsg): MsgConnectionOpenTryResponse { + return MsgConnectionOpenTryResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenTryResponse", + value: MsgConnectionOpenTryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenTryResponseProtoMsg): MsgConnectionOpenTryResponse { + return MsgConnectionOpenTryResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenTryResponse): Uint8Array { + return MsgConnectionOpenTryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", + value: MsgConnectionOpenTryResponse.encode(message).finish() + }; } - }; - function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { return { connectionId: "", counterpartyConnectionId: "", version: undefined, clientState: undefined, - proofHeight: undefined, + proofHeight: Height.fromPartial({}), proofTry: new Uint8Array(), proofClient: new Uint8Array(), proofConsensus: new Uint8Array(), - consensusHeight: undefined, + consensusHeight: Height.fromPartial({}), signer: "" }; } - export const MsgConnectionOpenAck = { - encode(message: MsgConnectionOpenAck, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + encode(message: MsgConnectionOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } - if (message.counterpartyConnectionId !== "") { writer.uint32(18).string(message.counterpartyConnectionId); } - if (message.version !== undefined) { Version.encode(message.version, writer.uint32(26).fork()).ldelim(); } - if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(34).fork()).ldelim(); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(42).fork()).ldelim(); } - if (message.proofTry.length !== 0) { writer.uint32(50).bytes(message.proofTry); } - if (message.proofClient.length !== 0) { writer.uint32(58).bytes(message.proofClient); } - if (message.proofConsensus.length !== 0) { writer.uint32(66).bytes(message.proofConsensus); } - if (message.consensusHeight !== undefined) { Height.encode(message.consensusHeight, writer.uint32(74).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(82).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgConnectionOpenAck { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgConnectionOpenAck(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connectionId = reader.string(); break; - case 2: message.counterpartyConnectionId = reader.string(); break; - case 3: message.version = Version.decode(reader, reader.uint32()); break; - case 4: message.clientState = Any.decode(reader, reader.uint32()); break; - case 5: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 6: message.proofTry = reader.bytes(); break; - case 7: message.proofClient = reader.bytes(); break; - case 8: message.proofConsensus = reader.bytes(); break; - case 9: message.consensusHeight = Height.decode(reader, reader.uint32()); break; - case 10: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgConnectionOpenAck { + fromPartial(object: Partial): MsgConnectionOpenAck { const message = createBaseMsgConnectionOpenAck(); message.connectionId = object.connectionId ?? ""; message.counterpartyConnectionId = object.counterpartyConnectionId ?? ""; @@ -647,149 +846,291 @@ export const MsgConnectionOpenAck = { message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgConnectionOpenAckAmino): MsgConnectionOpenAck { + const message = createBaseMsgConnectionOpenAck(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.counterparty_connection_id !== undefined && object.counterparty_connection_id !== null) { + message.counterpartyConnectionId = object.counterparty_connection_id; + } + if (object.version !== undefined && object.version !== null) { + message.version = Version.fromAmino(object.version); + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.proof_try !== undefined && object.proof_try !== null) { + message.proofTry = bytesFromBase64(object.proof_try); + } + if (object.proof_client !== undefined && object.proof_client !== null) { + message.proofClient = bytesFromBase64(object.proof_client); + } + if (object.proof_consensus !== undefined && object.proof_consensus !== null) { + message.proofConsensus = bytesFromBase64(object.proof_consensus); + } + if (object.consensus_height !== undefined && object.consensus_height !== null) { + message.consensusHeight = Height.fromAmino(object.consensus_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { + const obj: any = {}; + obj.connection_id = message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.version = message.version ? Version.toAmino(message.version) : undefined; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; + obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; + obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; + obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { + return MsgConnectionOpenAck.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenAck): MsgConnectionOpenAckAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenAck", + value: MsgConnectionOpenAck.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenAckProtoMsg): MsgConnectionOpenAck { + return MsgConnectionOpenAck.decode(message.value); + }, + toProto(message: MsgConnectionOpenAck): Uint8Array { + return MsgConnectionOpenAck.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenAck): MsgConnectionOpenAckProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + value: MsgConnectionOpenAck.encode(message).finish() + }; } - }; - function createBaseMsgConnectionOpenAckResponse(): MsgConnectionOpenAckResponse { return {}; } - export const MsgConnectionOpenAckResponse = { - encode(_: MsgConnectionOpenAckResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", + encode(_: MsgConnectionOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgConnectionOpenAckResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenAckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgConnectionOpenAckResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgConnectionOpenAckResponse { + fromPartial(_: Partial): MsgConnectionOpenAckResponse { + const message = createBaseMsgConnectionOpenAckResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenAckResponseAmino): MsgConnectionOpenAckResponse { const message = createBaseMsgConnectionOpenAckResponse(); return message; + }, + toAmino(_: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenAckResponseAminoMsg): MsgConnectionOpenAckResponse { + return MsgConnectionOpenAckResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenAckResponse", + value: MsgConnectionOpenAckResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenAckResponseProtoMsg): MsgConnectionOpenAckResponse { + return MsgConnectionOpenAckResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenAckResponse): Uint8Array { + return MsgConnectionOpenAckResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", + value: MsgConnectionOpenAckResponse.encode(message).finish() + }; } - }; - function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { return { connectionId: "", proofAck: new Uint8Array(), - proofHeight: undefined, + proofHeight: Height.fromPartial({}), signer: "" }; } - export const MsgConnectionOpenConfirm = { - encode(message: MsgConnectionOpenConfirm, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + encode(message: MsgConnectionOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } - if (message.proofAck.length !== 0) { writer.uint32(18).bytes(message.proofAck); } - if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - if (message.signer !== "") { writer.uint32(34).string(message.signer); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgConnectionOpenConfirm { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgConnectionOpenConfirm(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.connectionId = reader.string(); break; - case 2: message.proofAck = reader.bytes(); break; - case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; - case 4: message.signer = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgConnectionOpenConfirm { + fromPartial(object: Partial): MsgConnectionOpenConfirm { const message = createBaseMsgConnectionOpenConfirm(); message.connectionId = object.connectionId ?? ""; message.proofAck = object.proofAck ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; + }, + fromAmino(object: MsgConnectionOpenConfirmAmino): MsgConnectionOpenConfirm { + const message = createBaseMsgConnectionOpenConfirm(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.proof_ack !== undefined && object.proof_ack !== null) { + message.proofAck = bytesFromBase64(object.proof_ack); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { + const obj: any = {}; + obj.connection_id = message.connectionId; + obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { + return MsgConnectionOpenConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenConfirm", + value: MsgConnectionOpenConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenConfirmProtoMsg): MsgConnectionOpenConfirm { + return MsgConnectionOpenConfirm.decode(message.value); + }, + toProto(message: MsgConnectionOpenConfirm): Uint8Array { + return MsgConnectionOpenConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + value: MsgConnectionOpenConfirm.encode(message).finish() + }; } - }; - function createBaseMsgConnectionOpenConfirmResponse(): MsgConnectionOpenConfirmResponse { return {}; } - export const MsgConnectionOpenConfirmResponse = { - encode(_: MsgConnectionOpenConfirmResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", + encode(_: MsgConnectionOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgConnectionOpenConfirmResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgConnectionOpenConfirmResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgConnectionOpenConfirmResponse { + fromPartial(_: Partial): MsgConnectionOpenConfirmResponse { + const message = createBaseMsgConnectionOpenConfirmResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenConfirmResponseAmino): MsgConnectionOpenConfirmResponse { const message = createBaseMsgConnectionOpenConfirmResponse(); return message; + }, + toAmino(_: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenConfirmResponseAminoMsg): MsgConnectionOpenConfirmResponse { + return MsgConnectionOpenConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenConfirmResponse", + value: MsgConnectionOpenConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenConfirmResponseProtoMsg): MsgConnectionOpenConfirmResponse { + return MsgConnectionOpenConfirmResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenConfirmResponse): Uint8Array { + return MsgConnectionOpenConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", + value: MsgConnectionOpenConfirmResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/port/v1/query.rpc.Query.ts b/src/codegen/ibc/core/port/v1/query.rpc.Query.ts index df3c124..e62ec17 100644 --- a/src/codegen/ibc/core/port/v1/query.rpc.Query.ts +++ b/src/codegen/ibc/core/port/v1/query.rpc.Query.ts @@ -1,27 +1,23 @@ import { Rpc } from "../../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAppVersionRequest, QueryAppVersionResponse } from "./query"; /** Query defines the gRPC querier service */ - export interface Query { /** AppVersion queries an IBC Port and determines the appropriate application version to be used */ appVersion(request: QueryAppVersionRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.appVersion = this.appVersion.bind(this); } - appVersion(request: QueryAppVersionRequest): Promise { const data = QueryAppVersionRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.port.v1.Query", "AppVersion", data); - return promise.then(data => QueryAppVersionResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAppVersionResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -30,6 +26,5 @@ export const createRpcQueryExtension = (base: QueryClient) => { appVersion(request: QueryAppVersionRequest): Promise { return queryService.appVersion(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/ibc/core/port/v1/query.ts b/src/codegen/ibc/core/port/v1/query.ts index 63a27e0..01cccba 100644 --- a/src/codegen/ibc/core/port/v1/query.ts +++ b/src/codegen/ibc/core/port/v1/query.ts @@ -1,61 +1,74 @@ -import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { Order, Counterparty, CounterpartyAmino, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** QueryAppVersionRequest is the request type for the Query/AppVersion RPC method */ - export interface QueryAppVersionRequest { /** port unique identifier */ portId: string; /** connection unique identifier */ - connectionId: string; /** whether the channel is ordered or unordered */ - ordering: Order; /** counterparty channel end */ - counterparty?: Counterparty; /** proposed version */ - proposedVersion: string; } +export interface QueryAppVersionRequestProtoMsg { + typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest"; + value: Uint8Array; +} /** QueryAppVersionRequest is the request type for the Query/AppVersion RPC method */ - -export interface QueryAppVersionRequestSDKType { +export interface QueryAppVersionRequestAmino { /** port unique identifier */ - port_id: string; + port_id?: string; /** connection unique identifier */ - - connection_id: string; + connection_id?: string; /** whether the channel is ordered or unordered */ - - ordering: OrderSDKType; + ordering?: Order; /** counterparty channel end */ - - counterparty?: CounterpartySDKType; + counterparty?: CounterpartyAmino; /** proposed version */ - + proposed_version?: string; +} +export interface QueryAppVersionRequestAminoMsg { + type: "cosmos-sdk/QueryAppVersionRequest"; + value: QueryAppVersionRequestAmino; +} +/** QueryAppVersionRequest is the request type for the Query/AppVersion RPC method */ +export interface QueryAppVersionRequestSDKType { + port_id: string; + connection_id: string; + ordering: Order; + counterparty?: CounterpartySDKType; proposed_version: string; } /** QueryAppVersionResponse is the response type for the Query/AppVersion RPC method. */ - export interface QueryAppVersionResponse { /** port id associated with the request identifiers */ portId: string; /** supported app version */ - version: string; } +export interface QueryAppVersionResponseProtoMsg { + typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse"; + value: Uint8Array; +} /** QueryAppVersionResponse is the response type for the Query/AppVersion RPC method. */ - -export interface QueryAppVersionResponseSDKType { +export interface QueryAppVersionResponseAmino { /** port id associated with the request identifiers */ - port_id: string; + port_id?: string; /** supported app version */ - + version?: string; +} +export interface QueryAppVersionResponseAminoMsg { + type: "cosmos-sdk/QueryAppVersionResponse"; + value: QueryAppVersionResponseAmino; +} +/** QueryAppVersionResponse is the response type for the Query/AppVersion RPC method. */ +export interface QueryAppVersionResponseSDKType { + port_id: string; version: string; } - function createBaseQueryAppVersionRequest(): QueryAppVersionRequest { return { portId: "", @@ -65,71 +78,56 @@ function createBaseQueryAppVersionRequest(): QueryAppVersionRequest { proposedVersion: "" }; } - export const QueryAppVersionRequest = { - encode(message: QueryAppVersionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", + encode(message: QueryAppVersionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.connectionId !== "") { writer.uint32(18).string(message.connectionId); } - if (message.ordering !== 0) { writer.uint32(24).int32(message.ordering); } - if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); } - if (message.proposedVersion !== "") { writer.uint32(42).string(message.proposedVersion); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAppVersionRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppVersionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAppVersionRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.connectionId = reader.string(); break; - case 3: message.ordering = (reader.int32() as any); break; - case 4: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; - case 5: message.proposedVersion = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAppVersionRequest { + fromPartial(object: Partial): QueryAppVersionRequest { const message = createBaseQueryAppVersionRequest(); message.portId = object.portId ?? ""; message.connectionId = object.connectionId ?? ""; @@ -137,61 +135,135 @@ export const QueryAppVersionRequest = { message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; message.proposedVersion = object.proposedVersion ?? ""; return message; + }, + fromAmino(object: QueryAppVersionRequestAmino): QueryAppVersionRequest { + const message = createBaseQueryAppVersionRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.ordering !== undefined && object.ordering !== null) { + message.ordering = orderFromJSON(object.ordering); + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.proposed_version !== undefined && object.proposed_version !== null) { + message.proposedVersion = object.proposed_version; + } + return message; + }, + toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.connection_id = message.connectionId; + obj.ordering = orderToJSON(message.ordering); + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.proposed_version = message.proposedVersion; + return obj; + }, + fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { + return QueryAppVersionRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAppVersionRequest): QueryAppVersionRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAppVersionRequest", + value: QueryAppVersionRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAppVersionRequestProtoMsg): QueryAppVersionRequest { + return QueryAppVersionRequest.decode(message.value); + }, + toProto(message: QueryAppVersionRequest): Uint8Array { + return QueryAppVersionRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAppVersionRequest): QueryAppVersionRequestProtoMsg { + return { + typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", + value: QueryAppVersionRequest.encode(message).finish() + }; } - }; - function createBaseQueryAppVersionResponse(): QueryAppVersionResponse { return { portId: "", version: "" }; } - export const QueryAppVersionResponse = { - encode(message: QueryAppVersionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse", + encode(message: QueryAppVersionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.version !== "") { writer.uint32(18).string(message.version); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAppVersionResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppVersionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAppVersionResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.portId = reader.string(); break; - case 2: message.version = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAppVersionResponse { + fromPartial(object: Partial): QueryAppVersionResponse { const message = createBaseQueryAppVersionResponse(); message.portId = object.portId ?? ""; message.version = object.version ?? ""; return message; + }, + fromAmino(object: QueryAppVersionResponseAmino): QueryAppVersionResponse { + const message = createBaseQueryAppVersionResponse(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + return message; + }, + toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { + const obj: any = {}; + obj.port_id = message.portId; + obj.version = message.version; + return obj; + }, + fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { + return QueryAppVersionResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAppVersionResponse): QueryAppVersionResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAppVersionResponse", + value: QueryAppVersionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAppVersionResponseProtoMsg): QueryAppVersionResponse { + return QueryAppVersionResponse.decode(message.value); + }, + toProto(message: QueryAppVersionResponse): Uint8Array { + return QueryAppVersionResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAppVersionResponse): QueryAppVersionResponseProtoMsg { + return { + typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse", + value: QueryAppVersionResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/core/types/v1/genesis.ts b/src/codegen/ibc/core/types/v1/genesis.ts index 128462d..0731bc1 100644 --- a/src/codegen/ibc/core/types/v1/genesis.ts +++ b/src/codegen/ibc/core/types/v1/genesis.ts @@ -1,97 +1,135 @@ import { GenesisState as GenesisState1 } from "../../client/v1/genesis"; +import { GenesisStateAmino as GenesisState1Amino } from "../../client/v1/genesis"; import { GenesisStateSDKType as GenesisState1SDKType } from "../../client/v1/genesis"; import { GenesisState as GenesisState2 } from "../../connection/v1/genesis"; +import { GenesisStateAmino as GenesisState2Amino } from "../../connection/v1/genesis"; import { GenesisStateSDKType as GenesisState2SDKType } from "../../connection/v1/genesis"; import { GenesisState as GenesisState3 } from "../../channel/v1/genesis"; +import { GenesisStateAmino as GenesisState3Amino } from "../../channel/v1/genesis"; import { GenesisStateSDKType as GenesisState3SDKType } from "../../channel/v1/genesis"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** GenesisState defines the ibc module's genesis state. */ - export interface GenesisState { /** ICS002 - Clients genesis state */ - clientGenesis?: GenesisState1; + clientGenesis: GenesisState1; /** ICS003 - Connections genesis state */ - - connectionGenesis?: GenesisState2; + connectionGenesis: GenesisState2; /** ICS004 - Channel genesis state */ - - channelGenesis?: GenesisState3; + channelGenesis: GenesisState3; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.core.types.v1.GenesisState"; + value: Uint8Array; } /** GenesisState defines the ibc module's genesis state. */ - -export interface GenesisStateSDKType { +export interface GenesisStateAmino { /** ICS002 - Clients genesis state */ - client_genesis?: GenesisState1SDKType; + client_genesis?: GenesisState1Amino; /** ICS003 - Connections genesis state */ - - connection_genesis?: GenesisState2SDKType; + connection_genesis?: GenesisState2Amino; /** ICS004 - Channel genesis state */ - - channel_genesis?: GenesisState3SDKType; + channel_genesis?: GenesisState3Amino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the ibc module's genesis state. */ +export interface GenesisStateSDKType { + client_genesis: GenesisState1SDKType; + connection_genesis: GenesisState2SDKType; + channel_genesis: GenesisState3SDKType; } - function createBaseGenesisState(): GenesisState { return { - clientGenesis: undefined, - connectionGenesis: undefined, - channelGenesis: undefined + clientGenesis: GenesisState1.fromPartial({}), + connectionGenesis: GenesisState2.fromPartial({}), + channelGenesis: GenesisState3.fromPartial({}) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.core.types.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientGenesis !== undefined) { GenesisState1.encode(message.clientGenesis, writer.uint32(10).fork()).ldelim(); } - if (message.connectionGenesis !== undefined) { GenesisState2.encode(message.connectionGenesis, writer.uint32(18).fork()).ldelim(); } - if (message.channelGenesis !== undefined) { GenesisState3.encode(message.channelGenesis, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.clientGenesis = GenesisState1.decode(reader, reader.uint32()); break; - case 2: message.connectionGenesis = GenesisState2.decode(reader, reader.uint32()); break; - case 3: message.channelGenesis = GenesisState3.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.clientGenesis = object.clientGenesis !== undefined && object.clientGenesis !== null ? GenesisState1.fromPartial(object.clientGenesis) : undefined; message.connectionGenesis = object.connectionGenesis !== undefined && object.connectionGenesis !== null ? GenesisState2.fromPartial(object.connectionGenesis) : undefined; message.channelGenesis = object.channelGenesis !== undefined && object.channelGenesis !== null ? GenesisState3.fromPartial(object.channelGenesis) : undefined; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.client_genesis !== undefined && object.client_genesis !== null) { + message.clientGenesis = GenesisState1.fromAmino(object.client_genesis); + } + if (object.connection_genesis !== undefined && object.connection_genesis !== null) { + message.connectionGenesis = GenesisState2.fromAmino(object.connection_genesis); + } + if (object.channel_genesis !== undefined && object.channel_genesis !== null) { + message.channelGenesis = GenesisState3.fromAmino(object.channel_genesis); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.client_genesis = message.clientGenesis ? GenesisState1.toAmino(message.clientGenesis) : undefined; + obj.connection_genesis = message.connectionGenesis ? GenesisState2.toAmino(message.connectionGenesis) : undefined; + obj.channel_genesis = message.channelGenesis ? GenesisState3.toAmino(message.channelGenesis) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.core.types.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/lcd.ts b/src/codegen/ibc/lcd.ts index 100c9f9..c4a32f4 100644 --- a/src/codegen/ibc/lcd.ts +++ b/src/codegen/ibc/lcd.ts @@ -1,4 +1,4 @@ -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; export const createLCDClient = async ({ restEndpoint }: { diff --git a/src/codegen/ibc/lightclients/localhost/v1/localhost.ts b/src/codegen/ibc/lightclients/localhost/v1/localhost.ts index 17942c7..7e11793 100644 --- a/src/codegen/ibc/lightclients/localhost/v1/localhost.ts +++ b/src/codegen/ibc/lightclients/localhost/v1/localhost.ts @@ -1,82 +1,119 @@ -import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../../helpers"; +import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) * access to keys outside the client prefix. */ - export interface ClientState { /** self chain ID */ chainId: string; /** self latest block height */ - - height?: Height; + height: Height; +} +export interface ClientStateProtoMsg { + typeUrl: "/ibc.lightclients.localhost.v1.ClientState"; + value: Uint8Array; } /** * ClientState defines a loopback (localhost) client. It requires (read-only) * access to keys outside the client prefix. */ - -export interface ClientStateSDKType { +export interface ClientStateAmino { /** self chain ID */ - chain_id: string; + chain_id?: string; /** self latest block height */ - - height?: HeightSDKType; + height?: HeightAmino; +} +export interface ClientStateAminoMsg { + type: "cosmos-sdk/ClientState"; + value: ClientStateAmino; +} +/** + * ClientState defines a loopback (localhost) client. It requires (read-only) + * access to keys outside the client prefix. + */ +export interface ClientStateSDKType { + chain_id: string; + height: HeightSDKType; } - function createBaseClientState(): ClientState { return { chainId: "", - height: undefined + height: Height.fromPartial({}) }; } - export const ClientState = { - encode(message: ClientState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.localhost.v1.ClientState", + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chainId !== "") { writer.uint32(10).string(message.chainId); } - if (message.height !== undefined) { Height.encode(message.height, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.chainId = reader.string(); break; - case 2: message.height = Height.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientState { + fromPartial(object: Partial): ClientState { const message = createBaseClientState(); message.chainId = object.chainId ?? ""; message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; + }, + fromAmino(object: ClientStateAmino): ClientState { + const message = createBaseClientState(); + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: ClientState): ClientStateAmino { + const obj: any = {}; + obj.chain_id = message.chainId; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: ClientStateAminoMsg): ClientState { + return ClientState.fromAmino(object.value); + }, + toAminoMsg(message: ClientState): ClientStateAminoMsg { + return { + type: "cosmos-sdk/ClientState", + value: ClientState.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.localhost.v1.ClientState", + value: ClientState.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/lightclients/solomachine/v1/solomachine.ts b/src/codegen/ibc/lightclients/solomachine/v1/solomachine.ts index f2e06ee..db1f42d 100644 --- a/src/codegen/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/src/codegen/ibc/lightclients/solomachine/v1/solomachine.ts @@ -1,124 +1,69 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; -import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; +import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * DataType defines the type of solo machine proof being created. This is done * to preserve uniqueness of different data sign byte encodings. */ - export enum DataType { /** DATA_TYPE_UNINITIALIZED_UNSPECIFIED - Default State */ DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0, - /** DATA_TYPE_CLIENT_STATE - Data type for client state verification */ DATA_TYPE_CLIENT_STATE = 1, - /** DATA_TYPE_CONSENSUS_STATE - Data type for consensus state verification */ DATA_TYPE_CONSENSUS_STATE = 2, - /** DATA_TYPE_CONNECTION_STATE - Data type for connection state verification */ DATA_TYPE_CONNECTION_STATE = 3, - /** DATA_TYPE_CHANNEL_STATE - Data type for channel state verification */ DATA_TYPE_CHANNEL_STATE = 4, - /** DATA_TYPE_PACKET_COMMITMENT - Data type for packet commitment verification */ DATA_TYPE_PACKET_COMMITMENT = 5, - /** DATA_TYPE_PACKET_ACKNOWLEDGEMENT - Data type for packet acknowledgement verification */ DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6, - /** DATA_TYPE_PACKET_RECEIPT_ABSENCE - Data type for packet receipt absence verification */ DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7, - /** DATA_TYPE_NEXT_SEQUENCE_RECV - Data type for next sequence recv verification */ DATA_TYPE_NEXT_SEQUENCE_RECV = 8, - - /** DATA_TYPE_HEADER - Data type for header verification */ - DATA_TYPE_HEADER = 9, - UNRECOGNIZED = -1, -} -/** - * DataType defines the type of solo machine proof being created. This is done - * to preserve uniqueness of different data sign byte encodings. - */ - -export enum DataTypeSDKType { - /** DATA_TYPE_UNINITIALIZED_UNSPECIFIED - Default State */ - DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0, - - /** DATA_TYPE_CLIENT_STATE - Data type for client state verification */ - DATA_TYPE_CLIENT_STATE = 1, - - /** DATA_TYPE_CONSENSUS_STATE - Data type for consensus state verification */ - DATA_TYPE_CONSENSUS_STATE = 2, - - /** DATA_TYPE_CONNECTION_STATE - Data type for connection state verification */ - DATA_TYPE_CONNECTION_STATE = 3, - - /** DATA_TYPE_CHANNEL_STATE - Data type for channel state verification */ - DATA_TYPE_CHANNEL_STATE = 4, - - /** DATA_TYPE_PACKET_COMMITMENT - Data type for packet commitment verification */ - DATA_TYPE_PACKET_COMMITMENT = 5, - - /** DATA_TYPE_PACKET_ACKNOWLEDGEMENT - Data type for packet acknowledgement verification */ - DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6, - - /** DATA_TYPE_PACKET_RECEIPT_ABSENCE - Data type for packet receipt absence verification */ - DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7, - - /** DATA_TYPE_NEXT_SEQUENCE_RECV - Data type for next sequence recv verification */ - DATA_TYPE_NEXT_SEQUENCE_RECV = 8, - /** DATA_TYPE_HEADER - Data type for header verification */ DATA_TYPE_HEADER = 9, UNRECOGNIZED = -1, } +export const DataTypeSDKType = DataType; +export const DataTypeAmino = DataType; export function dataTypeFromJSON(object: any): DataType { switch (object) { case 0: case "DATA_TYPE_UNINITIALIZED_UNSPECIFIED": return DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED; - case 1: case "DATA_TYPE_CLIENT_STATE": return DataType.DATA_TYPE_CLIENT_STATE; - case 2: case "DATA_TYPE_CONSENSUS_STATE": return DataType.DATA_TYPE_CONSENSUS_STATE; - case 3: case "DATA_TYPE_CONNECTION_STATE": return DataType.DATA_TYPE_CONNECTION_STATE; - case 4: case "DATA_TYPE_CHANNEL_STATE": return DataType.DATA_TYPE_CHANNEL_STATE; - case 5: case "DATA_TYPE_PACKET_COMMITMENT": return DataType.DATA_TYPE_PACKET_COMMITMENT; - case 6: case "DATA_TYPE_PACKET_ACKNOWLEDGEMENT": return DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT; - case 7: case "DATA_TYPE_PACKET_RECEIPT_ABSENCE": return DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE; - case 8: case "DATA_TYPE_NEXT_SEQUENCE_RECV": return DataType.DATA_TYPE_NEXT_SEQUENCE_RECV; - case 9: case "DATA_TYPE_HEADER": return DataType.DATA_TYPE_HEADER; - case -1: case "UNRECOGNIZED": default: @@ -129,34 +74,24 @@ export function dataTypeToJSON(object: DataType): string { switch (object) { case DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED: return "DATA_TYPE_UNINITIALIZED_UNSPECIFIED"; - case DataType.DATA_TYPE_CLIENT_STATE: return "DATA_TYPE_CLIENT_STATE"; - case DataType.DATA_TYPE_CONSENSUS_STATE: return "DATA_TYPE_CONSENSUS_STATE"; - case DataType.DATA_TYPE_CONNECTION_STATE: return "DATA_TYPE_CONNECTION_STATE"; - case DataType.DATA_TYPE_CHANNEL_STATE: return "DATA_TYPE_CHANNEL_STATE"; - case DataType.DATA_TYPE_PACKET_COMMITMENT: return "DATA_TYPE_PACKET_COMMITMENT"; - case DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT: return "DATA_TYPE_PACKET_ACKNOWLEDGEMENT"; - case DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE: return "DATA_TYPE_PACKET_RECEIPT_ABSENCE"; - case DataType.DATA_TYPE_NEXT_SEQUENCE_RECV: return "DATA_TYPE_NEXT_SEQUENCE_RECV"; - case DataType.DATA_TYPE_HEADER: return "DATA_TYPE_HEADER"; - case DataType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -166,38 +101,50 @@ export function dataTypeToJSON(object: DataType): string { * ClientState defines a solo machine client that tracks the current consensus * state and if the client is frozen. */ - export interface ClientState { /** latest sequence of the client state */ - sequence: Long; + sequence: bigint; /** frozen sequence of the solo machine */ - - frozenSequence: Long; + frozenSequence: bigint; consensusState?: ConsensusState; /** * when set to true, will allow governance to update a solo machine client. * The client will be unfrozen if it is frozen. */ - allowUpdateAfterProposal: boolean; } +export interface ClientStateProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.ClientState"; + value: Uint8Array; +} /** * ClientState defines a solo machine client that tracks the current consensus * state and if the client is frozen. */ - -export interface ClientStateSDKType { +export interface ClientStateAmino { /** latest sequence of the client state */ - sequence: Long; + sequence?: string; /** frozen sequence of the solo machine */ - - frozen_sequence: Long; - consensus_state?: ConsensusStateSDKType; + frozen_sequence?: string; + consensus_state?: ConsensusStateAmino; /** * when set to true, will allow governance to update a solo machine client. * The client will be unfrozen if it is frozen. */ - + allow_update_after_proposal?: boolean; +} +export interface ClientStateAminoMsg { + type: "cosmos-sdk/ClientState"; + value: ClientStateAmino; +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientStateSDKType { + sequence: bigint; + frozen_sequence: bigint; + consensus_state?: ConsensusStateSDKType; allow_update_after_proposal: boolean; } /** @@ -205,7 +152,6 @@ export interface ClientStateSDKType { * consensus state is contained in the "height" key used in storing the * consensus state. */ - export interface ConsensusState { /** public key of the solo machine */ publicKey?: Any; @@ -214,44 +160,73 @@ export interface ConsensusState { * machine clients (potentially on different chains) without being considered * misbehaviour. */ - diversifier: string; - timestamp: Long; + timestamp: bigint; +} +export interface ConsensusStateProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusState"; + value: Uint8Array; } /** * ConsensusState defines a solo machine consensus state. The sequence of a * consensus state is contained in the "height" key used in storing the * consensus state. */ - -export interface ConsensusStateSDKType { +export interface ConsensusStateAmino { /** public key of the solo machine */ - public_key?: AnySDKType; + public_key?: AnyAmino; /** * diversifier allows the same public key to be re-used across different solo * machine clients (potentially on different chains) without being considered * misbehaviour. */ - + diversifier?: string; + timestamp?: string; +} +export interface ConsensusStateAminoMsg { + type: "cosmos-sdk/ConsensusState"; + value: ConsensusStateAmino; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusStateSDKType { + public_key?: AnySDKType; diversifier: string; - timestamp: Long; + timestamp: bigint; } /** Header defines a solo machine consensus header */ - export interface Header { /** sequence to update solo machine public key at */ - sequence: Long; - timestamp: Long; + sequence: bigint; + timestamp: bigint; signature: Uint8Array; newPublicKey?: Any; newDiversifier: string; } +export interface HeaderProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.Header"; + value: Uint8Array; +} /** Header defines a solo machine consensus header */ - -export interface HeaderSDKType { +export interface HeaderAmino { /** sequence to update solo machine public key at */ - sequence: Long; - timestamp: Long; + sequence?: string; + timestamp?: string; + signature?: string; + new_public_key?: AnyAmino; + new_diversifier?: string; +} +export interface HeaderAminoMsg { + type: "cosmos-sdk/Header"; + value: HeaderAmino; +} +/** Header defines a solo machine consensus header */ +export interface HeaderSDKType { + sequence: bigint; + timestamp: bigint; signature: Uint8Array; new_public_key?: AnySDKType; new_diversifier: string; @@ -260,21 +235,37 @@ export interface HeaderSDKType { * Misbehaviour defines misbehaviour for a solo machine which consists * of a sequence and two signatures over different messages at that sequence. */ - export interface Misbehaviour { clientId: string; - sequence: Long; + sequence: bigint; signatureOne?: SignatureAndData; signatureTwo?: SignatureAndData; } +export interface MisbehaviourProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour"; + value: Uint8Array; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface MisbehaviourAmino { + client_id?: string; + sequence?: string; + signature_one?: SignatureAndDataAmino; + signature_two?: SignatureAndDataAmino; +} +export interface MisbehaviourAminoMsg { + type: "cosmos-sdk/Misbehaviour"; + value: MisbehaviourAmino; +} /** * Misbehaviour defines misbehaviour for a solo machine which consists * of a sequence and two signatures over different messages at that sequence. */ - export interface MisbehaviourSDKType { client_id: string; - sequence: Long; + sequence: bigint; signature_one?: SignatureAndDataSDKType; signature_two?: SignatureAndDataSDKType; } @@ -282,94 +273,154 @@ export interface MisbehaviourSDKType { * SignatureAndData contains a signature and the data signed over to create that * signature. */ - export interface SignatureAndData { signature: Uint8Array; dataType: DataType; data: Uint8Array; - timestamp: Long; + timestamp: bigint; +} +export interface SignatureAndDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.SignatureAndData"; + value: Uint8Array; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndDataAmino { + signature?: string; + data_type?: DataType; + data?: string; + timestamp?: string; +} +export interface SignatureAndDataAminoMsg { + type: "cosmos-sdk/SignatureAndData"; + value: SignatureAndDataAmino; } /** * SignatureAndData contains a signature and the data signed over to create that * signature. */ - export interface SignatureAndDataSDKType { signature: Uint8Array; - data_type: DataTypeSDKType; + data_type: DataType; data: Uint8Array; - timestamp: Long; + timestamp: bigint; } /** * TimestampedSignatureData contains the signature data and the timestamp of the * signature. */ - export interface TimestampedSignatureData { signatureData: Uint8Array; - timestamp: Long; + timestamp: bigint; +} +export interface TimestampedSignatureDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.TimestampedSignatureData"; + value: Uint8Array; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureDataAmino { + signature_data?: string; + timestamp?: string; +} +export interface TimestampedSignatureDataAminoMsg { + type: "cosmos-sdk/TimestampedSignatureData"; + value: TimestampedSignatureDataAmino; } /** * TimestampedSignatureData contains the signature data and the timestamp of the * signature. */ - export interface TimestampedSignatureDataSDKType { signature_data: Uint8Array; - timestamp: Long; + timestamp: bigint; } /** SignBytes defines the signed bytes used for signature verification. */ - export interface SignBytes { - sequence: Long; - timestamp: Long; + sequence: bigint; + timestamp: bigint; diversifier: string; /** type of the data used */ - dataType: DataType; /** marshaled data */ - data: Uint8Array; } +export interface SignBytesProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes"; + value: Uint8Array; +} /** SignBytes defines the signed bytes used for signature verification. */ - -export interface SignBytesSDKType { - sequence: Long; - timestamp: Long; - diversifier: string; +export interface SignBytesAmino { + sequence?: string; + timestamp?: string; + diversifier?: string; /** type of the data used */ - - data_type: DataTypeSDKType; + data_type?: DataType; /** marshaled data */ - + data?: string; +} +export interface SignBytesAminoMsg { + type: "cosmos-sdk/SignBytes"; + value: SignBytesAmino; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytesSDKType { + sequence: bigint; + timestamp: bigint; + diversifier: string; + data_type: DataType; data: Uint8Array; } /** HeaderData returns the SignBytes data for update verification. */ - export interface HeaderData { /** header public key */ newPubKey?: Any; /** header diversifier */ - newDiversifier: string; } +export interface HeaderDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.HeaderData"; + value: Uint8Array; +} /** HeaderData returns the SignBytes data for update verification. */ - -export interface HeaderDataSDKType { +export interface HeaderDataAmino { /** header public key */ - new_pub_key?: AnySDKType; + new_pub_key?: AnyAmino; /** header diversifier */ - + new_diversifier?: string; +} +export interface HeaderDataAminoMsg { + type: "cosmos-sdk/HeaderData"; + value: HeaderDataAmino; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderDataSDKType { + new_pub_key?: AnySDKType; new_diversifier: string; } /** ClientStateData returns the SignBytes data for client state verification. */ - export interface ClientStateData { path: Uint8Array; clientState?: Any; } +export interface ClientStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.ClientStateData"; + value: Uint8Array; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateDataAmino { + path?: string; + client_state?: AnyAmino; +} +export interface ClientStateDataAminoMsg { + type: "cosmos-sdk/ClientStateData"; + value: ClientStateDataAmino; +} /** ClientStateData returns the SignBytes data for client state verification. */ - export interface ClientStateDataSDKType { path: Uint8Array; client_state?: AnySDKType; @@ -378,16 +429,30 @@ export interface ClientStateDataSDKType { * ConsensusStateData returns the SignBytes data for consensus state * verification. */ - export interface ConsensusStateData { path: Uint8Array; consensusState?: Any; } +export interface ConsensusStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusStateData"; + value: Uint8Array; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateDataAmino { + path?: string; + consensus_state?: AnyAmino; +} +export interface ConsensusStateDataAminoMsg { + type: "cosmos-sdk/ConsensusStateData"; + value: ConsensusStateDataAmino; +} /** * ConsensusStateData returns the SignBytes data for consensus state * verification. */ - export interface ConsensusStateDataSDKType { path: Uint8Array; consensus_state?: AnySDKType; @@ -396,16 +461,30 @@ export interface ConsensusStateDataSDKType { * ConnectionStateData returns the SignBytes data for connection state * verification. */ - export interface ConnectionStateData { path: Uint8Array; connection?: ConnectionEnd; } +export interface ConnectionStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.ConnectionStateData"; + value: Uint8Array; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateDataAmino { + path?: string; + connection?: ConnectionEndAmino; +} +export interface ConnectionStateDataAminoMsg { + type: "cosmos-sdk/ConnectionStateData"; + value: ConnectionStateDataAmino; +} /** * ConnectionStateData returns the SignBytes data for connection state * verification. */ - export interface ConnectionStateDataSDKType { path: Uint8Array; connection?: ConnectionEndSDKType; @@ -414,16 +493,30 @@ export interface ConnectionStateDataSDKType { * ChannelStateData returns the SignBytes data for channel state * verification. */ - export interface ChannelStateData { path: Uint8Array; channel?: Channel; } +export interface ChannelStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.ChannelStateData"; + value: Uint8Array; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateDataAmino { + path?: string; + channel?: ChannelAmino; +} +export interface ChannelStateDataAminoMsg { + type: "cosmos-sdk/ChannelStateData"; + value: ChannelStateDataAmino; +} /** * ChannelStateData returns the SignBytes data for channel state * verification. */ - export interface ChannelStateDataSDKType { path: Uint8Array; channel?: ChannelSDKType; @@ -432,16 +525,30 @@ export interface ChannelStateDataSDKType { * PacketCommitmentData returns the SignBytes data for packet commitment * verification. */ - export interface PacketCommitmentData { path: Uint8Array; commitment: Uint8Array; } +export interface PacketCommitmentDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketCommitmentData"; + value: Uint8Array; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentDataAmino { + path?: string; + commitment?: string; +} +export interface PacketCommitmentDataAminoMsg { + type: "cosmos-sdk/PacketCommitmentData"; + value: PacketCommitmentDataAmino; +} /** * PacketCommitmentData returns the SignBytes data for packet commitment * verification. */ - export interface PacketCommitmentDataSDKType { path: Uint8Array; commitment: Uint8Array; @@ -450,16 +557,30 @@ export interface PacketCommitmentDataSDKType { * PacketAcknowledgementData returns the SignBytes data for acknowledgement * verification. */ - export interface PacketAcknowledgementData { path: Uint8Array; acknowledgement: Uint8Array; } +export interface PacketAcknowledgementDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketAcknowledgementData"; + value: Uint8Array; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementDataAmino { + path?: string; + acknowledgement?: string; +} +export interface PacketAcknowledgementDataAminoMsg { + type: "cosmos-sdk/PacketAcknowledgementData"; + value: PacketAcknowledgementDataAmino; +} /** * PacketAcknowledgementData returns the SignBytes data for acknowledgement * verification. */ - export interface PacketAcknowledgementDataSDKType { path: Uint8Array; acknowledgement: Uint8Array; @@ -468,15 +589,28 @@ export interface PacketAcknowledgementDataSDKType { * PacketReceiptAbsenceData returns the SignBytes data for * packet receipt absence verification. */ - export interface PacketReceiptAbsenceData { path: Uint8Array; } +export interface PacketReceiptAbsenceDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData"; + value: Uint8Array; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceDataAmino { + path?: string; +} +export interface PacketReceiptAbsenceDataAminoMsg { + type: "cosmos-sdk/PacketReceiptAbsenceData"; + value: PacketReceiptAbsenceDataAmino; +} /** * PacketReceiptAbsenceData returns the SignBytes data for * packet receipt absence verification. */ - export interface PacketReceiptAbsenceDataSDKType { path: Uint8Array; } @@ -484,1017 +618,1471 @@ export interface PacketReceiptAbsenceDataSDKType { * NextSequenceRecvData returns the SignBytes data for verification of the next * sequence to be received. */ - export interface NextSequenceRecvData { path: Uint8Array; - nextSeqRecv: Long; + nextSeqRecv: bigint; +} +export interface NextSequenceRecvDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v1.NextSequenceRecvData"; + value: Uint8Array; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvDataAmino { + path?: string; + next_seq_recv?: string; +} +export interface NextSequenceRecvDataAminoMsg { + type: "cosmos-sdk/NextSequenceRecvData"; + value: NextSequenceRecvDataAmino; } /** * NextSequenceRecvData returns the SignBytes data for verification of the next * sequence to be received. */ - export interface NextSequenceRecvDataSDKType { path: Uint8Array; - next_seq_recv: Long; + next_seq_recv: bigint; } - function createBaseClientState(): ClientState { return { - sequence: Long.UZERO, - frozenSequence: Long.UZERO, + sequence: BigInt(0), + frozenSequence: BigInt(0), consensusState: undefined, allowUpdateAfterProposal: false }; } - export const ClientState = { - encode(message: ClientState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.sequence.isZero()) { + typeUrl: "/ibc.lightclients.solomachine.v1.ClientState", + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - - if (!message.frozenSequence.isZero()) { + if (message.frozenSequence !== BigInt(0)) { writer.uint32(16).uint64(message.frozenSequence); } - if (message.consensusState !== undefined) { ConsensusState.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); } - if (message.allowUpdateAfterProposal === true) { writer.uint32(32).bool(message.allowUpdateAfterProposal); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 2: - message.frozenSequence = (reader.uint64() as Long); + message.frozenSequence = reader.uint64(); break; - case 3: message.consensusState = ConsensusState.decode(reader, reader.uint32()); break; - case 4: message.allowUpdateAfterProposal = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientState { + fromPartial(object: Partial): ClientState { const message = createBaseClientState(); - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; - message.frozenSequence = object.frozenSequence !== undefined && object.frozenSequence !== null ? Long.fromValue(object.frozenSequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.frozenSequence = object.frozenSequence !== undefined && object.frozenSequence !== null ? BigInt(object.frozenSequence.toString()) : BigInt(0); message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? ConsensusState.fromPartial(object.consensusState) : undefined; message.allowUpdateAfterProposal = object.allowUpdateAfterProposal ?? false; return message; + }, + fromAmino(object: ClientStateAmino): ClientState { + const message = createBaseClientState(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.frozen_sequence !== undefined && object.frozen_sequence !== null) { + message.frozenSequence = BigInt(object.frozen_sequence); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = ConsensusState.fromAmino(object.consensus_state); + } + if (object.allow_update_after_proposal !== undefined && object.allow_update_after_proposal !== null) { + message.allowUpdateAfterProposal = object.allow_update_after_proposal; + } + return message; + }, + toAmino(message: ClientState): ClientStateAmino { + const obj: any = {}; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + return obj; + }, + fromAminoMsg(object: ClientStateAminoMsg): ClientState { + return ClientState.fromAmino(object.value); + }, + toAminoMsg(message: ClientState): ClientStateAminoMsg { + return { + type: "cosmos-sdk/ClientState", + value: ClientState.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.ClientState", + value: ClientState.encode(message).finish() + }; } - }; - function createBaseConsensusState(): ConsensusState { return { publicKey: undefined, diversifier: "", - timestamp: Long.UZERO + timestamp: BigInt(0) }; } - export const ConsensusState = { - encode(message: ConsensusState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusState", + encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); } - if (message.diversifier !== "") { writer.uint32(18).string(message.diversifier); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(24).uint64(message.timestamp); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensusState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.publicKey = Any.decode(reader, reader.uint32()); break; - case 2: message.diversifier = reader.string(); break; - case 3: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConsensusState { + fromPartial(object: Partial): ConsensusState { const message = createBaseConsensusState(); message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; message.diversifier = object.diversifier ?? ""; - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConsensusStateAmino): ConsensusState { + const message = createBaseConsensusState(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.diversifier !== undefined && object.diversifier !== null) { + message.diversifier = object.diversifier; + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } return message; + }, + toAmino(message: ConsensusState): ConsensusStateAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.diversifier = message.diversifier; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { + return ConsensusState.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusState): ConsensusStateAminoMsg { + return { + type: "cosmos-sdk/ConsensusState", + value: ConsensusState.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusState", + value: ConsensusState.encode(message).finish() + }; } - }; - function createBaseHeader(): Header { return { - sequence: Long.UZERO, - timestamp: Long.UZERO, + sequence: BigInt(0), + timestamp: BigInt(0), signature: new Uint8Array(), newPublicKey: undefined, newDiversifier: "" }; } - export const Header = { - encode(message: Header, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.sequence.isZero()) { + typeUrl: "/ibc.lightclients.solomachine.v1.Header", + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - if (message.signature.length !== 0) { writer.uint32(26).bytes(message.signature); } - if (message.newPublicKey !== undefined) { Any.encode(message.newPublicKey, writer.uint32(34).fork()).ldelim(); } - if (message.newDiversifier !== "") { writer.uint32(42).string(message.newDiversifier); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Header { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHeader(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 2: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - case 3: message.signature = reader.bytes(); break; - case 4: message.newPublicKey = Any.decode(reader, reader.uint32()); break; - case 5: message.newDiversifier = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial
): Header { + fromPartial(object: Partial
): Header { const message = createBaseHeader(); - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.signature = object.signature ?? new Uint8Array(); message.newPublicKey = object.newPublicKey !== undefined && object.newPublicKey !== null ? Any.fromPartial(object.newPublicKey) : undefined; message.newDiversifier = object.newDiversifier ?? ""; return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.new_public_key !== undefined && object.new_public_key !== null) { + message.newPublicKey = Any.fromAmino(object.new_public_key); + } + if (object.new_diversifier !== undefined && object.new_diversifier !== null) { + message.newDiversifier = object.new_diversifier; + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; + obj.new_diversifier = message.newDiversifier; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + toAminoMsg(message: Header): HeaderAminoMsg { + return { + type: "cosmos-sdk/Header", + value: Header.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.Header", + value: Header.encode(message).finish() + }; } - }; - function createBaseMisbehaviour(): Misbehaviour { return { clientId: "", - sequence: Long.UZERO, + sequence: BigInt(0), signatureOne: undefined, signatureTwo: undefined }; } - export const Misbehaviour = { - encode(message: Misbehaviour, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour", + encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(16).uint64(message.sequence); } - if (message.signatureOne !== undefined) { SignatureAndData.encode(message.signatureOne, writer.uint32(26).fork()).ldelim(); } - if (message.signatureTwo !== undefined) { SignatureAndData.encode(message.signatureTwo, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Misbehaviour { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMisbehaviour(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 3: message.signatureOne = SignatureAndData.decode(reader, reader.uint32()); break; - case 4: message.signatureTwo = SignatureAndData.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Misbehaviour { + fromPartial(object: Partial): Misbehaviour { const message = createBaseMisbehaviour(); message.clientId = object.clientId ?? ""; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.signatureOne = object.signatureOne !== undefined && object.signatureOne !== null ? SignatureAndData.fromPartial(object.signatureOne) : undefined; message.signatureTwo = object.signatureTwo !== undefined && object.signatureTwo !== null ? SignatureAndData.fromPartial(object.signatureTwo) : undefined; return message; + }, + fromAmino(object: MisbehaviourAmino): Misbehaviour { + const message = createBaseMisbehaviour(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.signature_one !== undefined && object.signature_one !== null) { + message.signatureOne = SignatureAndData.fromAmino(object.signature_one); + } + if (object.signature_two !== undefined && object.signature_two !== null) { + message.signatureTwo = SignatureAndData.fromAmino(object.signature_two); + } + return message; + }, + toAmino(message: Misbehaviour): MisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; + obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviourAminoMsg): Misbehaviour { + return Misbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: Misbehaviour): MisbehaviourAminoMsg { + return { + type: "cosmos-sdk/Misbehaviour", + value: Misbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour", + value: Misbehaviour.encode(message).finish() + }; } - }; - function createBaseSignatureAndData(): SignatureAndData { return { signature: new Uint8Array(), dataType: 0, data: new Uint8Array(), - timestamp: Long.UZERO + timestamp: BigInt(0) }; } - export const SignatureAndData = { - encode(message: SignatureAndData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.SignatureAndData", + encode(message: SignatureAndData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signature.length !== 0) { writer.uint32(10).bytes(message.signature); } - if (message.dataType !== 0) { writer.uint32(16).int32(message.dataType); } - if (message.data.length !== 0) { writer.uint32(26).bytes(message.data); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(32).uint64(message.timestamp); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignatureAndData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignatureAndData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignatureAndData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signature = reader.bytes(); break; - case 2: message.dataType = (reader.int32() as any); break; - case 3: message.data = reader.bytes(); break; - case 4: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignatureAndData { + fromPartial(object: Partial): SignatureAndData { const message = createBaseSignatureAndData(); message.signature = object.signature ?? new Uint8Array(); message.dataType = object.dataType ?? 0; message.data = object.data ?? new Uint8Array(); - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; + }, + fromAmino(object: SignatureAndDataAmino): SignatureAndData { + const message = createBaseSignatureAndData(); + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.data_type !== undefined && object.data_type !== null) { + message.dataType = dataTypeFromJSON(object.data_type); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: SignatureAndData): SignatureAndDataAmino { + const obj: any = {}; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.data_type = dataTypeToJSON(message.dataType); + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { + return SignatureAndData.fromAmino(object.value); + }, + toAminoMsg(message: SignatureAndData): SignatureAndDataAminoMsg { + return { + type: "cosmos-sdk/SignatureAndData", + value: SignatureAndData.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureAndDataProtoMsg): SignatureAndData { + return SignatureAndData.decode(message.value); + }, + toProto(message: SignatureAndData): Uint8Array { + return SignatureAndData.encode(message).finish(); + }, + toProtoMsg(message: SignatureAndData): SignatureAndDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.SignatureAndData", + value: SignatureAndData.encode(message).finish() + }; } - }; - function createBaseTimestampedSignatureData(): TimestampedSignatureData { return { signatureData: new Uint8Array(), - timestamp: Long.UZERO + timestamp: BigInt(0) }; } - export const TimestampedSignatureData = { - encode(message: TimestampedSignatureData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.TimestampedSignatureData", + encode(message: TimestampedSignatureData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signatureData.length !== 0) { writer.uint32(10).bytes(message.signatureData); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TimestampedSignatureData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TimestampedSignatureData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTimestampedSignatureData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signatureData = reader.bytes(); break; - case 2: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TimestampedSignatureData { + fromPartial(object: Partial): TimestampedSignatureData { const message = createBaseTimestampedSignatureData(); message.signatureData = object.signatureData ?? new Uint8Array(); - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: TimestampedSignatureDataAmino): TimestampedSignatureData { + const message = createBaseTimestampedSignatureData(); + if (object.signature_data !== undefined && object.signature_data !== null) { + message.signatureData = bytesFromBase64(object.signature_data); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } return message; + }, + toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { + const obj: any = {}; + obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { + return TimestampedSignatureData.fromAmino(object.value); + }, + toAminoMsg(message: TimestampedSignatureData): TimestampedSignatureDataAminoMsg { + return { + type: "cosmos-sdk/TimestampedSignatureData", + value: TimestampedSignatureData.toAmino(message) + }; + }, + fromProtoMsg(message: TimestampedSignatureDataProtoMsg): TimestampedSignatureData { + return TimestampedSignatureData.decode(message.value); + }, + toProto(message: TimestampedSignatureData): Uint8Array { + return TimestampedSignatureData.encode(message).finish(); + }, + toProtoMsg(message: TimestampedSignatureData): TimestampedSignatureDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.TimestampedSignatureData", + value: TimestampedSignatureData.encode(message).finish() + }; } - }; - function createBaseSignBytes(): SignBytes { return { - sequence: Long.UZERO, - timestamp: Long.UZERO, + sequence: BigInt(0), + timestamp: BigInt(0), diversifier: "", dataType: 0, data: new Uint8Array() }; } - export const SignBytes = { - encode(message: SignBytes, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.sequence.isZero()) { + typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes", + encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - if (message.diversifier !== "") { writer.uint32(26).string(message.diversifier); } - if (message.dataType !== 0) { writer.uint32(32).int32(message.dataType); } - if (message.data.length !== 0) { writer.uint32(42).bytes(message.data); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignBytes { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignBytes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignBytes(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 2: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - case 3: message.diversifier = reader.string(); break; - case 4: message.dataType = (reader.int32() as any); break; - case 5: message.data = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignBytes { + fromPartial(object: Partial): SignBytes { const message = createBaseSignBytes(); - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.diversifier = object.diversifier ?? ""; message.dataType = object.dataType ?? 0; message.data = object.data ?? new Uint8Array(); return message; + }, + fromAmino(object: SignBytesAmino): SignBytes { + const message = createBaseSignBytes(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + if (object.diversifier !== undefined && object.diversifier !== null) { + message.diversifier = object.diversifier; + } + if (object.data_type !== undefined && object.data_type !== null) { + message.dataType = dataTypeFromJSON(object.data_type); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: SignBytes): SignBytesAmino { + const obj: any = {}; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = message.diversifier; + obj.data_type = dataTypeToJSON(message.dataType); + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: SignBytesAminoMsg): SignBytes { + return SignBytes.fromAmino(object.value); + }, + toAminoMsg(message: SignBytes): SignBytesAminoMsg { + return { + type: "cosmos-sdk/SignBytes", + value: SignBytes.toAmino(message) + }; + }, + fromProtoMsg(message: SignBytesProtoMsg): SignBytes { + return SignBytes.decode(message.value); + }, + toProto(message: SignBytes): Uint8Array { + return SignBytes.encode(message).finish(); + }, + toProtoMsg(message: SignBytes): SignBytesProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes", + value: SignBytes.encode(message).finish() + }; } - }; - function createBaseHeaderData(): HeaderData { return { newPubKey: undefined, newDiversifier: "" }; } - export const HeaderData = { - encode(message: HeaderData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.HeaderData", + encode(message: HeaderData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newPubKey !== undefined) { Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); } - if (message.newDiversifier !== "") { writer.uint32(18).string(message.newDiversifier); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): HeaderData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): HeaderData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHeaderData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.newPubKey = Any.decode(reader, reader.uint32()); break; - case 2: message.newDiversifier = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): HeaderData { + fromPartial(object: Partial): HeaderData { const message = createBaseHeaderData(); message.newPubKey = object.newPubKey !== undefined && object.newPubKey !== null ? Any.fromPartial(object.newPubKey) : undefined; message.newDiversifier = object.newDiversifier ?? ""; return message; + }, + fromAmino(object: HeaderDataAmino): HeaderData { + const message = createBaseHeaderData(); + if (object.new_pub_key !== undefined && object.new_pub_key !== null) { + message.newPubKey = Any.fromAmino(object.new_pub_key); + } + if (object.new_diversifier !== undefined && object.new_diversifier !== null) { + message.newDiversifier = object.new_diversifier; + } + return message; + }, + toAmino(message: HeaderData): HeaderDataAmino { + const obj: any = {}; + obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; + obj.new_diversifier = message.newDiversifier; + return obj; + }, + fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { + return HeaderData.fromAmino(object.value); + }, + toAminoMsg(message: HeaderData): HeaderDataAminoMsg { + return { + type: "cosmos-sdk/HeaderData", + value: HeaderData.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderDataProtoMsg): HeaderData { + return HeaderData.decode(message.value); + }, + toProto(message: HeaderData): Uint8Array { + return HeaderData.encode(message).finish(); + }, + toProtoMsg(message: HeaderData): HeaderDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.HeaderData", + value: HeaderData.encode(message).finish() + }; } - }; - function createBaseClientStateData(): ClientStateData { return { path: new Uint8Array(), clientState: undefined }; } - export const ClientStateData = { - encode(message: ClientStateData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.ClientStateData", + encode(message: ClientStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientStateData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientStateData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.clientState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientStateData { + fromPartial(object: Partial): ClientStateData { const message = createBaseClientStateData(); message.path = object.path ?? new Uint8Array(); message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; return message; + }, + fromAmino(object: ClientStateDataAmino): ClientStateData { + const message = createBaseClientStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + return message; + }, + toAmino(message: ClientStateData): ClientStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + return obj; + }, + fromAminoMsg(object: ClientStateDataAminoMsg): ClientStateData { + return ClientStateData.fromAmino(object.value); + }, + toAminoMsg(message: ClientStateData): ClientStateDataAminoMsg { + return { + type: "cosmos-sdk/ClientStateData", + value: ClientStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateDataProtoMsg): ClientStateData { + return ClientStateData.decode(message.value); + }, + toProto(message: ClientStateData): Uint8Array { + return ClientStateData.encode(message).finish(); + }, + toProtoMsg(message: ClientStateData): ClientStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.ClientStateData", + value: ClientStateData.encode(message).finish() + }; } - }; - function createBaseConsensusStateData(): ConsensusStateData { return { path: new Uint8Array(), consensusState: undefined }; } - export const ConsensusStateData = { - encode(message: ConsensusStateData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusStateData", + encode(message: ConsensusStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusStateData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensusStateData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.consensusState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConsensusStateData { + fromPartial(object: Partial): ConsensusStateData { const message = createBaseConsensusStateData(); message.path = object.path ?? new Uint8Array(); message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; return message; + }, + fromAmino(object: ConsensusStateDataAmino): ConsensusStateData { + const message = createBaseConsensusStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + return message; + }, + toAmino(message: ConsensusStateData): ConsensusStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateDataAminoMsg): ConsensusStateData { + return ConsensusStateData.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusStateData): ConsensusStateDataAminoMsg { + return { + type: "cosmos-sdk/ConsensusStateData", + value: ConsensusStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateDataProtoMsg): ConsensusStateData { + return ConsensusStateData.decode(message.value); + }, + toProto(message: ConsensusStateData): Uint8Array { + return ConsensusStateData.encode(message).finish(); + }, + toProtoMsg(message: ConsensusStateData): ConsensusStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusStateData", + value: ConsensusStateData.encode(message).finish() + }; } - }; - function createBaseConnectionStateData(): ConnectionStateData { return { path: new Uint8Array(), connection: undefined }; } - export const ConnectionStateData = { - encode(message: ConnectionStateData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.ConnectionStateData", + encode(message: ConnectionStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.connection !== undefined) { ConnectionEnd.encode(message.connection, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionStateData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConnectionStateData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.connection = ConnectionEnd.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConnectionStateData { + fromPartial(object: Partial): ConnectionStateData { const message = createBaseConnectionStateData(); message.path = object.path ?? new Uint8Array(); message.connection = object.connection !== undefined && object.connection !== null ? ConnectionEnd.fromPartial(object.connection) : undefined; return message; + }, + fromAmino(object: ConnectionStateDataAmino): ConnectionStateData { + const message = createBaseConnectionStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.connection !== undefined && object.connection !== null) { + message.connection = ConnectionEnd.fromAmino(object.connection); + } + return message; + }, + toAmino(message: ConnectionStateData): ConnectionStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.connection = message.connection ? ConnectionEnd.toAmino(message.connection) : undefined; + return obj; + }, + fromAminoMsg(object: ConnectionStateDataAminoMsg): ConnectionStateData { + return ConnectionStateData.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionStateData): ConnectionStateDataAminoMsg { + return { + type: "cosmos-sdk/ConnectionStateData", + value: ConnectionStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionStateDataProtoMsg): ConnectionStateData { + return ConnectionStateData.decode(message.value); + }, + toProto(message: ConnectionStateData): Uint8Array { + return ConnectionStateData.encode(message).finish(); + }, + toProtoMsg(message: ConnectionStateData): ConnectionStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.ConnectionStateData", + value: ConnectionStateData.encode(message).finish() + }; } - }; - function createBaseChannelStateData(): ChannelStateData { return { path: new Uint8Array(), channel: undefined }; } - export const ChannelStateData = { - encode(message: ChannelStateData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.ChannelStateData", + encode(message: ChannelStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ChannelStateData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ChannelStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseChannelStateData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.channel = Channel.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ChannelStateData { + fromPartial(object: Partial): ChannelStateData { const message = createBaseChannelStateData(); message.path = object.path ?? new Uint8Array(); message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; return message; + }, + fromAmino(object: ChannelStateDataAmino): ChannelStateData { + const message = createBaseChannelStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + return message; + }, + toAmino(message: ChannelStateData): ChannelStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + return obj; + }, + fromAminoMsg(object: ChannelStateDataAminoMsg): ChannelStateData { + return ChannelStateData.fromAmino(object.value); + }, + toAminoMsg(message: ChannelStateData): ChannelStateDataAminoMsg { + return { + type: "cosmos-sdk/ChannelStateData", + value: ChannelStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ChannelStateDataProtoMsg): ChannelStateData { + return ChannelStateData.decode(message.value); + }, + toProto(message: ChannelStateData): Uint8Array { + return ChannelStateData.encode(message).finish(); + }, + toProtoMsg(message: ChannelStateData): ChannelStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.ChannelStateData", + value: ChannelStateData.encode(message).finish() + }; } - }; - function createBasePacketCommitmentData(): PacketCommitmentData { return { path: new Uint8Array(), commitment: new Uint8Array() }; } - export const PacketCommitmentData = { - encode(message: PacketCommitmentData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketCommitmentData", + encode(message: PacketCommitmentData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.commitment.length !== 0) { writer.uint32(18).bytes(message.commitment); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PacketCommitmentData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PacketCommitmentData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacketCommitmentData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.commitment = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PacketCommitmentData { + fromPartial(object: Partial): PacketCommitmentData { const message = createBasePacketCommitmentData(); message.path = object.path ?? new Uint8Array(); message.commitment = object.commitment ?? new Uint8Array(); return message; + }, + fromAmino(object: PacketCommitmentDataAmino): PacketCommitmentData { + const message = createBasePacketCommitmentData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.commitment !== undefined && object.commitment !== null) { + message.commitment = bytesFromBase64(object.commitment); + } + return message; + }, + toAmino(message: PacketCommitmentData): PacketCommitmentDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.commitment = message.commitment ? base64FromBytes(message.commitment) : undefined; + return obj; + }, + fromAminoMsg(object: PacketCommitmentDataAminoMsg): PacketCommitmentData { + return PacketCommitmentData.fromAmino(object.value); + }, + toAminoMsg(message: PacketCommitmentData): PacketCommitmentDataAminoMsg { + return { + type: "cosmos-sdk/PacketCommitmentData", + value: PacketCommitmentData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketCommitmentDataProtoMsg): PacketCommitmentData { + return PacketCommitmentData.decode(message.value); + }, + toProto(message: PacketCommitmentData): Uint8Array { + return PacketCommitmentData.encode(message).finish(); + }, + toProtoMsg(message: PacketCommitmentData): PacketCommitmentDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketCommitmentData", + value: PacketCommitmentData.encode(message).finish() + }; } - }; - function createBasePacketAcknowledgementData(): PacketAcknowledgementData { return { path: new Uint8Array(), acknowledgement: new Uint8Array() }; } - export const PacketAcknowledgementData = { - encode(message: PacketAcknowledgementData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketAcknowledgementData", + encode(message: PacketAcknowledgementData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.acknowledgement.length !== 0) { writer.uint32(18).bytes(message.acknowledgement); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PacketAcknowledgementData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PacketAcknowledgementData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacketAcknowledgementData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.acknowledgement = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PacketAcknowledgementData { + fromPartial(object: Partial): PacketAcknowledgementData { const message = createBasePacketAcknowledgementData(); message.path = object.path ?? new Uint8Array(); message.acknowledgement = object.acknowledgement ?? new Uint8Array(); return message; + }, + fromAmino(object: PacketAcknowledgementDataAmino): PacketAcknowledgementData { + const message = createBasePacketAcknowledgementData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = bytesFromBase64(object.acknowledgement); + } + return message; + }, + toAmino(message: PacketAcknowledgementData): PacketAcknowledgementDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; + return obj; + }, + fromAminoMsg(object: PacketAcknowledgementDataAminoMsg): PacketAcknowledgementData { + return PacketAcknowledgementData.fromAmino(object.value); + }, + toAminoMsg(message: PacketAcknowledgementData): PacketAcknowledgementDataAminoMsg { + return { + type: "cosmos-sdk/PacketAcknowledgementData", + value: PacketAcknowledgementData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketAcknowledgementDataProtoMsg): PacketAcknowledgementData { + return PacketAcknowledgementData.decode(message.value); + }, + toProto(message: PacketAcknowledgementData): Uint8Array { + return PacketAcknowledgementData.encode(message).finish(); + }, + toProtoMsg(message: PacketAcknowledgementData): PacketAcknowledgementDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketAcknowledgementData", + value: PacketAcknowledgementData.encode(message).finish() + }; } - }; - function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { return { path: new Uint8Array() }; } - export const PacketReceiptAbsenceData = { - encode(message: PacketReceiptAbsenceData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData", + encode(message: PacketReceiptAbsenceData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PacketReceiptAbsenceData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PacketReceiptAbsenceData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacketReceiptAbsenceData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PacketReceiptAbsenceData { + fromPartial(object: Partial): PacketReceiptAbsenceData { const message = createBasePacketReceiptAbsenceData(); message.path = object.path ?? new Uint8Array(); return message; + }, + fromAmino(object: PacketReceiptAbsenceDataAmino): PacketReceiptAbsenceData { + const message = createBasePacketReceiptAbsenceData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + return message; + }, + toAmino(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + return obj; + }, + fromAminoMsg(object: PacketReceiptAbsenceDataAminoMsg): PacketReceiptAbsenceData { + return PacketReceiptAbsenceData.fromAmino(object.value); + }, + toAminoMsg(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataAminoMsg { + return { + type: "cosmos-sdk/PacketReceiptAbsenceData", + value: PacketReceiptAbsenceData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketReceiptAbsenceDataProtoMsg): PacketReceiptAbsenceData { + return PacketReceiptAbsenceData.decode(message.value); + }, + toProto(message: PacketReceiptAbsenceData): Uint8Array { + return PacketReceiptAbsenceData.encode(message).finish(); + }, + toProtoMsg(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData", + value: PacketReceiptAbsenceData.encode(message).finish() + }; } - }; - function createBaseNextSequenceRecvData(): NextSequenceRecvData { return { path: new Uint8Array(), - nextSeqRecv: Long.UZERO + nextSeqRecv: BigInt(0) }; } - export const NextSequenceRecvData = { - encode(message: NextSequenceRecvData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v1.NextSequenceRecvData", + encode(message: NextSequenceRecvData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - - if (!message.nextSeqRecv.isZero()) { + if (message.nextSeqRecv !== BigInt(0)) { writer.uint32(16).uint64(message.nextSeqRecv); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): NextSequenceRecvData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): NextSequenceRecvData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNextSequenceRecvData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: - message.nextSeqRecv = (reader.uint64() as Long); + message.nextSeqRecv = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): NextSequenceRecvData { + fromPartial(object: Partial): NextSequenceRecvData { const message = createBaseNextSequenceRecvData(); message.path = object.path ?? new Uint8Array(); - message.nextSeqRecv = object.nextSeqRecv !== undefined && object.nextSeqRecv !== null ? Long.fromValue(object.nextSeqRecv) : Long.UZERO; + message.nextSeqRecv = object.nextSeqRecv !== undefined && object.nextSeqRecv !== null ? BigInt(object.nextSeqRecv.toString()) : BigInt(0); + return message; + }, + fromAmino(object: NextSequenceRecvDataAmino): NextSequenceRecvData { + const message = createBaseNextSequenceRecvData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.next_seq_recv !== undefined && object.next_seq_recv !== null) { + message.nextSeqRecv = BigInt(object.next_seq_recv); + } return message; + }, + toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + return obj; + }, + fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { + return NextSequenceRecvData.fromAmino(object.value); + }, + toAminoMsg(message: NextSequenceRecvData): NextSequenceRecvDataAminoMsg { + return { + type: "cosmos-sdk/NextSequenceRecvData", + value: NextSequenceRecvData.toAmino(message) + }; + }, + fromProtoMsg(message: NextSequenceRecvDataProtoMsg): NextSequenceRecvData { + return NextSequenceRecvData.decode(message.value); + }, + toProto(message: NextSequenceRecvData): Uint8Array { + return NextSequenceRecvData.encode(message).finish(); + }, + toProtoMsg(message: NextSequenceRecvData): NextSequenceRecvDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v1.NextSequenceRecvData", + value: NextSequenceRecvData.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/lightclients/solomachine/v2/solomachine.ts b/src/codegen/ibc/lightclients/solomachine/v2/solomachine.ts index 9c2d99b..0e06050 100644 --- a/src/codegen/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/src/codegen/ibc/lightclients/solomachine/v2/solomachine.ts @@ -1,124 +1,69 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; -import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../../helpers"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; +import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * DataType defines the type of solo machine proof being created. This is done * to preserve uniqueness of different data sign byte encodings. */ - export enum DataType { /** DATA_TYPE_UNINITIALIZED_UNSPECIFIED - Default State */ DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0, - /** DATA_TYPE_CLIENT_STATE - Data type for client state verification */ DATA_TYPE_CLIENT_STATE = 1, - /** DATA_TYPE_CONSENSUS_STATE - Data type for consensus state verification */ DATA_TYPE_CONSENSUS_STATE = 2, - /** DATA_TYPE_CONNECTION_STATE - Data type for connection state verification */ DATA_TYPE_CONNECTION_STATE = 3, - /** DATA_TYPE_CHANNEL_STATE - Data type for channel state verification */ DATA_TYPE_CHANNEL_STATE = 4, - /** DATA_TYPE_PACKET_COMMITMENT - Data type for packet commitment verification */ DATA_TYPE_PACKET_COMMITMENT = 5, - /** DATA_TYPE_PACKET_ACKNOWLEDGEMENT - Data type for packet acknowledgement verification */ DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6, - /** DATA_TYPE_PACKET_RECEIPT_ABSENCE - Data type for packet receipt absence verification */ DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7, - /** DATA_TYPE_NEXT_SEQUENCE_RECV - Data type for next sequence recv verification */ DATA_TYPE_NEXT_SEQUENCE_RECV = 8, - - /** DATA_TYPE_HEADER - Data type for header verification */ - DATA_TYPE_HEADER = 9, - UNRECOGNIZED = -1, -} -/** - * DataType defines the type of solo machine proof being created. This is done - * to preserve uniqueness of different data sign byte encodings. - */ - -export enum DataTypeSDKType { - /** DATA_TYPE_UNINITIALIZED_UNSPECIFIED - Default State */ - DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0, - - /** DATA_TYPE_CLIENT_STATE - Data type for client state verification */ - DATA_TYPE_CLIENT_STATE = 1, - - /** DATA_TYPE_CONSENSUS_STATE - Data type for consensus state verification */ - DATA_TYPE_CONSENSUS_STATE = 2, - - /** DATA_TYPE_CONNECTION_STATE - Data type for connection state verification */ - DATA_TYPE_CONNECTION_STATE = 3, - - /** DATA_TYPE_CHANNEL_STATE - Data type for channel state verification */ - DATA_TYPE_CHANNEL_STATE = 4, - - /** DATA_TYPE_PACKET_COMMITMENT - Data type for packet commitment verification */ - DATA_TYPE_PACKET_COMMITMENT = 5, - - /** DATA_TYPE_PACKET_ACKNOWLEDGEMENT - Data type for packet acknowledgement verification */ - DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6, - - /** DATA_TYPE_PACKET_RECEIPT_ABSENCE - Data type for packet receipt absence verification */ - DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7, - - /** DATA_TYPE_NEXT_SEQUENCE_RECV - Data type for next sequence recv verification */ - DATA_TYPE_NEXT_SEQUENCE_RECV = 8, - /** DATA_TYPE_HEADER - Data type for header verification */ DATA_TYPE_HEADER = 9, UNRECOGNIZED = -1, } +export const DataTypeSDKType = DataType; +export const DataTypeAmino = DataType; export function dataTypeFromJSON(object: any): DataType { switch (object) { case 0: case "DATA_TYPE_UNINITIALIZED_UNSPECIFIED": return DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED; - case 1: case "DATA_TYPE_CLIENT_STATE": return DataType.DATA_TYPE_CLIENT_STATE; - case 2: case "DATA_TYPE_CONSENSUS_STATE": return DataType.DATA_TYPE_CONSENSUS_STATE; - case 3: case "DATA_TYPE_CONNECTION_STATE": return DataType.DATA_TYPE_CONNECTION_STATE; - case 4: case "DATA_TYPE_CHANNEL_STATE": return DataType.DATA_TYPE_CHANNEL_STATE; - case 5: case "DATA_TYPE_PACKET_COMMITMENT": return DataType.DATA_TYPE_PACKET_COMMITMENT; - case 6: case "DATA_TYPE_PACKET_ACKNOWLEDGEMENT": return DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT; - case 7: case "DATA_TYPE_PACKET_RECEIPT_ABSENCE": return DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE; - case 8: case "DATA_TYPE_NEXT_SEQUENCE_RECV": return DataType.DATA_TYPE_NEXT_SEQUENCE_RECV; - case 9: case "DATA_TYPE_HEADER": return DataType.DATA_TYPE_HEADER; - case -1: case "UNRECOGNIZED": default: @@ -129,34 +74,24 @@ export function dataTypeToJSON(object: DataType): string { switch (object) { case DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED: return "DATA_TYPE_UNINITIALIZED_UNSPECIFIED"; - case DataType.DATA_TYPE_CLIENT_STATE: return "DATA_TYPE_CLIENT_STATE"; - case DataType.DATA_TYPE_CONSENSUS_STATE: return "DATA_TYPE_CONSENSUS_STATE"; - case DataType.DATA_TYPE_CONNECTION_STATE: return "DATA_TYPE_CONNECTION_STATE"; - case DataType.DATA_TYPE_CHANNEL_STATE: return "DATA_TYPE_CHANNEL_STATE"; - case DataType.DATA_TYPE_PACKET_COMMITMENT: return "DATA_TYPE_PACKET_COMMITMENT"; - case DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT: return "DATA_TYPE_PACKET_ACKNOWLEDGEMENT"; - case DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE: return "DATA_TYPE_PACKET_RECEIPT_ABSENCE"; - case DataType.DATA_TYPE_NEXT_SEQUENCE_RECV: return "DATA_TYPE_NEXT_SEQUENCE_RECV"; - case DataType.DATA_TYPE_HEADER: return "DATA_TYPE_HEADER"; - case DataType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -166,38 +101,50 @@ export function dataTypeToJSON(object: DataType): string { * ClientState defines a solo machine client that tracks the current consensus * state and if the client is frozen. */ - export interface ClientState { /** latest sequence of the client state */ - sequence: Long; + sequence: bigint; /** frozen sequence of the solo machine */ - isFrozen: boolean; consensusState?: ConsensusState; /** * when set to true, will allow governance to update a solo machine client. * The client will be unfrozen if it is frozen. */ - allowUpdateAfterProposal: boolean; } +export interface ClientStateProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientState"; + value: Uint8Array; +} /** * ClientState defines a solo machine client that tracks the current consensus * state and if the client is frozen. */ - -export interface ClientStateSDKType { +export interface ClientStateAmino { /** latest sequence of the client state */ - sequence: Long; + sequence?: string; /** frozen sequence of the solo machine */ - - is_frozen: boolean; - consensus_state?: ConsensusStateSDKType; + is_frozen?: boolean; + consensus_state?: ConsensusStateAmino; /** * when set to true, will allow governance to update a solo machine client. * The client will be unfrozen if it is frozen. */ - + allow_update_after_proposal?: boolean; +} +export interface ClientStateAminoMsg { + type: "cosmos-sdk/ClientState"; + value: ClientStateAmino; +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientStateSDKType { + sequence: bigint; + is_frozen: boolean; + consensus_state?: ConsensusStateSDKType; allow_update_after_proposal: boolean; } /** @@ -205,7 +152,6 @@ export interface ClientStateSDKType { * consensus state is contained in the "height" key used in storing the * consensus state. */ - export interface ConsensusState { /** public key of the solo machine */ publicKey?: Any; @@ -214,44 +160,73 @@ export interface ConsensusState { * machine clients (potentially on different chains) without being considered * misbehaviour. */ - diversifier: string; - timestamp: Long; + timestamp: bigint; +} +export interface ConsensusStateProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState"; + value: Uint8Array; } /** * ConsensusState defines a solo machine consensus state. The sequence of a * consensus state is contained in the "height" key used in storing the * consensus state. */ - -export interface ConsensusStateSDKType { +export interface ConsensusStateAmino { /** public key of the solo machine */ - public_key?: AnySDKType; + public_key?: AnyAmino; /** * diversifier allows the same public key to be re-used across different solo * machine clients (potentially on different chains) without being considered * misbehaviour. */ - + diversifier?: string; + timestamp?: string; +} +export interface ConsensusStateAminoMsg { + type: "cosmos-sdk/ConsensusState"; + value: ConsensusStateAmino; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusStateSDKType { + public_key?: AnySDKType; diversifier: string; - timestamp: Long; + timestamp: bigint; } /** Header defines a solo machine consensus header */ - export interface Header { /** sequence to update solo machine public key at */ - sequence: Long; - timestamp: Long; + sequence: bigint; + timestamp: bigint; signature: Uint8Array; newPublicKey?: Any; newDiversifier: string; } +export interface HeaderProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.Header"; + value: Uint8Array; +} /** Header defines a solo machine consensus header */ - -export interface HeaderSDKType { +export interface HeaderAmino { /** sequence to update solo machine public key at */ - sequence: Long; - timestamp: Long; + sequence?: string; + timestamp?: string; + signature?: string; + new_public_key?: AnyAmino; + new_diversifier?: string; +} +export interface HeaderAminoMsg { + type: "cosmos-sdk/Header"; + value: HeaderAmino; +} +/** Header defines a solo machine consensus header */ +export interface HeaderSDKType { + sequence: bigint; + timestamp: bigint; signature: Uint8Array; new_public_key?: AnySDKType; new_diversifier: string; @@ -260,21 +235,37 @@ export interface HeaderSDKType { * Misbehaviour defines misbehaviour for a solo machine which consists * of a sequence and two signatures over different messages at that sequence. */ - export interface Misbehaviour { clientId: string; - sequence: Long; + sequence: bigint; signatureOne?: SignatureAndData; signatureTwo?: SignatureAndData; } +export interface MisbehaviourProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour"; + value: Uint8Array; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface MisbehaviourAmino { + client_id?: string; + sequence?: string; + signature_one?: SignatureAndDataAmino; + signature_two?: SignatureAndDataAmino; +} +export interface MisbehaviourAminoMsg { + type: "cosmos-sdk/Misbehaviour"; + value: MisbehaviourAmino; +} /** * Misbehaviour defines misbehaviour for a solo machine which consists * of a sequence and two signatures over different messages at that sequence. */ - export interface MisbehaviourSDKType { client_id: string; - sequence: Long; + sequence: bigint; signature_one?: SignatureAndDataSDKType; signature_two?: SignatureAndDataSDKType; } @@ -282,94 +273,154 @@ export interface MisbehaviourSDKType { * SignatureAndData contains a signature and the data signed over to create that * signature. */ - export interface SignatureAndData { signature: Uint8Array; dataType: DataType; data: Uint8Array; - timestamp: Long; + timestamp: bigint; +} +export interface SignatureAndDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData"; + value: Uint8Array; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndDataAmino { + signature?: string; + data_type?: DataType; + data?: string; + timestamp?: string; +} +export interface SignatureAndDataAminoMsg { + type: "cosmos-sdk/SignatureAndData"; + value: SignatureAndDataAmino; } /** * SignatureAndData contains a signature and the data signed over to create that * signature. */ - export interface SignatureAndDataSDKType { signature: Uint8Array; - data_type: DataTypeSDKType; + data_type: DataType; data: Uint8Array; - timestamp: Long; + timestamp: bigint; } /** * TimestampedSignatureData contains the signature data and the timestamp of the * signature. */ - export interface TimestampedSignatureData { signatureData: Uint8Array; - timestamp: Long; + timestamp: bigint; +} +export interface TimestampedSignatureDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData"; + value: Uint8Array; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureDataAmino { + signature_data?: string; + timestamp?: string; +} +export interface TimestampedSignatureDataAminoMsg { + type: "cosmos-sdk/TimestampedSignatureData"; + value: TimestampedSignatureDataAmino; } /** * TimestampedSignatureData contains the signature data and the timestamp of the * signature. */ - export interface TimestampedSignatureDataSDKType { signature_data: Uint8Array; - timestamp: Long; + timestamp: bigint; } /** SignBytes defines the signed bytes used for signature verification. */ - export interface SignBytes { - sequence: Long; - timestamp: Long; + sequence: bigint; + timestamp: bigint; diversifier: string; /** type of the data used */ - dataType: DataType; /** marshaled data */ - data: Uint8Array; } +export interface SignBytesProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes"; + value: Uint8Array; +} /** SignBytes defines the signed bytes used for signature verification. */ - -export interface SignBytesSDKType { - sequence: Long; - timestamp: Long; - diversifier: string; +export interface SignBytesAmino { + sequence?: string; + timestamp?: string; + diversifier?: string; /** type of the data used */ - - data_type: DataTypeSDKType; + data_type?: DataType; /** marshaled data */ - + data?: string; +} +export interface SignBytesAminoMsg { + type: "cosmos-sdk/SignBytes"; + value: SignBytesAmino; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytesSDKType { + sequence: bigint; + timestamp: bigint; + diversifier: string; + data_type: DataType; data: Uint8Array; } /** HeaderData returns the SignBytes data for update verification. */ - export interface HeaderData { /** header public key */ newPubKey?: Any; /** header diversifier */ - newDiversifier: string; } +export interface HeaderDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData"; + value: Uint8Array; +} /** HeaderData returns the SignBytes data for update verification. */ - -export interface HeaderDataSDKType { +export interface HeaderDataAmino { /** header public key */ - new_pub_key?: AnySDKType; + new_pub_key?: AnyAmino; /** header diversifier */ - + new_diversifier?: string; +} +export interface HeaderDataAminoMsg { + type: "cosmos-sdk/HeaderData"; + value: HeaderDataAmino; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderDataSDKType { + new_pub_key?: AnySDKType; new_diversifier: string; } /** ClientStateData returns the SignBytes data for client state verification. */ - export interface ClientStateData { path: Uint8Array; clientState?: Any; } +export interface ClientStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData"; + value: Uint8Array; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateDataAmino { + path?: string; + client_state?: AnyAmino; +} +export interface ClientStateDataAminoMsg { + type: "cosmos-sdk/ClientStateData"; + value: ClientStateDataAmino; +} /** ClientStateData returns the SignBytes data for client state verification. */ - export interface ClientStateDataSDKType { path: Uint8Array; client_state?: AnySDKType; @@ -378,16 +429,30 @@ export interface ClientStateDataSDKType { * ConsensusStateData returns the SignBytes data for consensus state * verification. */ - export interface ConsensusStateData { path: Uint8Array; consensusState?: Any; } +export interface ConsensusStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData"; + value: Uint8Array; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateDataAmino { + path?: string; + consensus_state?: AnyAmino; +} +export interface ConsensusStateDataAminoMsg { + type: "cosmos-sdk/ConsensusStateData"; + value: ConsensusStateDataAmino; +} /** * ConsensusStateData returns the SignBytes data for consensus state * verification. */ - export interface ConsensusStateDataSDKType { path: Uint8Array; consensus_state?: AnySDKType; @@ -396,16 +461,30 @@ export interface ConsensusStateDataSDKType { * ConnectionStateData returns the SignBytes data for connection state * verification. */ - export interface ConnectionStateData { path: Uint8Array; connection?: ConnectionEnd; } +export interface ConnectionStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData"; + value: Uint8Array; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateDataAmino { + path?: string; + connection?: ConnectionEndAmino; +} +export interface ConnectionStateDataAminoMsg { + type: "cosmos-sdk/ConnectionStateData"; + value: ConnectionStateDataAmino; +} /** * ConnectionStateData returns the SignBytes data for connection state * verification. */ - export interface ConnectionStateDataSDKType { path: Uint8Array; connection?: ConnectionEndSDKType; @@ -414,16 +493,30 @@ export interface ConnectionStateDataSDKType { * ChannelStateData returns the SignBytes data for channel state * verification. */ - export interface ChannelStateData { path: Uint8Array; channel?: Channel; } +export interface ChannelStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData"; + value: Uint8Array; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateDataAmino { + path?: string; + channel?: ChannelAmino; +} +export interface ChannelStateDataAminoMsg { + type: "cosmos-sdk/ChannelStateData"; + value: ChannelStateDataAmino; +} /** * ChannelStateData returns the SignBytes data for channel state * verification. */ - export interface ChannelStateDataSDKType { path: Uint8Array; channel?: ChannelSDKType; @@ -432,16 +525,30 @@ export interface ChannelStateDataSDKType { * PacketCommitmentData returns the SignBytes data for packet commitment * verification. */ - export interface PacketCommitmentData { path: Uint8Array; commitment: Uint8Array; } +export interface PacketCommitmentDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData"; + value: Uint8Array; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentDataAmino { + path?: string; + commitment?: string; +} +export interface PacketCommitmentDataAminoMsg { + type: "cosmos-sdk/PacketCommitmentData"; + value: PacketCommitmentDataAmino; +} /** * PacketCommitmentData returns the SignBytes data for packet commitment * verification. */ - export interface PacketCommitmentDataSDKType { path: Uint8Array; commitment: Uint8Array; @@ -450,16 +557,30 @@ export interface PacketCommitmentDataSDKType { * PacketAcknowledgementData returns the SignBytes data for acknowledgement * verification. */ - export interface PacketAcknowledgementData { path: Uint8Array; acknowledgement: Uint8Array; } +export interface PacketAcknowledgementDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData"; + value: Uint8Array; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementDataAmino { + path?: string; + acknowledgement?: string; +} +export interface PacketAcknowledgementDataAminoMsg { + type: "cosmos-sdk/PacketAcknowledgementData"; + value: PacketAcknowledgementDataAmino; +} /** * PacketAcknowledgementData returns the SignBytes data for acknowledgement * verification. */ - export interface PacketAcknowledgementDataSDKType { path: Uint8Array; acknowledgement: Uint8Array; @@ -468,15 +589,28 @@ export interface PacketAcknowledgementDataSDKType { * PacketReceiptAbsenceData returns the SignBytes data for * packet receipt absence verification. */ - export interface PacketReceiptAbsenceData { path: Uint8Array; } +export interface PacketReceiptAbsenceDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData"; + value: Uint8Array; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceDataAmino { + path?: string; +} +export interface PacketReceiptAbsenceDataAminoMsg { + type: "cosmos-sdk/PacketReceiptAbsenceData"; + value: PacketReceiptAbsenceDataAmino; +} /** * PacketReceiptAbsenceData returns the SignBytes data for * packet receipt absence verification. */ - export interface PacketReceiptAbsenceDataSDKType { path: Uint8Array; } @@ -484,1017 +618,1471 @@ export interface PacketReceiptAbsenceDataSDKType { * NextSequenceRecvData returns the SignBytes data for verification of the next * sequence to be received. */ - export interface NextSequenceRecvData { path: Uint8Array; - nextSeqRecv: Long; + nextSeqRecv: bigint; +} +export interface NextSequenceRecvDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData"; + value: Uint8Array; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvDataAmino { + path?: string; + next_seq_recv?: string; +} +export interface NextSequenceRecvDataAminoMsg { + type: "cosmos-sdk/NextSequenceRecvData"; + value: NextSequenceRecvDataAmino; } /** * NextSequenceRecvData returns the SignBytes data for verification of the next * sequence to be received. */ - export interface NextSequenceRecvDataSDKType { path: Uint8Array; - next_seq_recv: Long; + next_seq_recv: bigint; } - function createBaseClientState(): ClientState { return { - sequence: Long.UZERO, + sequence: BigInt(0), isFrozen: false, consensusState: undefined, allowUpdateAfterProposal: false }; } - export const ClientState = { - encode(message: ClientState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.sequence.isZero()) { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.isFrozen === true) { writer.uint32(16).bool(message.isFrozen); } - if (message.consensusState !== undefined) { ConsensusState.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); } - if (message.allowUpdateAfterProposal === true) { writer.uint32(32).bool(message.allowUpdateAfterProposal); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 2: message.isFrozen = reader.bool(); break; - case 3: message.consensusState = ConsensusState.decode(reader, reader.uint32()); break; - case 4: message.allowUpdateAfterProposal = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientState { + fromPartial(object: Partial): ClientState { const message = createBaseClientState(); - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.isFrozen = object.isFrozen ?? false; message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? ConsensusState.fromPartial(object.consensusState) : undefined; message.allowUpdateAfterProposal = object.allowUpdateAfterProposal ?? false; return message; + }, + fromAmino(object: ClientStateAmino): ClientState { + const message = createBaseClientState(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.is_frozen !== undefined && object.is_frozen !== null) { + message.isFrozen = object.is_frozen; + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = ConsensusState.fromAmino(object.consensus_state); + } + if (object.allow_update_after_proposal !== undefined && object.allow_update_after_proposal !== null) { + message.allowUpdateAfterProposal = object.allow_update_after_proposal; + } + return message; + }, + toAmino(message: ClientState): ClientStateAmino { + const obj: any = {}; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.is_frozen = message.isFrozen; + obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + return obj; + }, + fromAminoMsg(object: ClientStateAminoMsg): ClientState { + return ClientState.fromAmino(object.value); + }, + toAminoMsg(message: ClientState): ClientStateAminoMsg { + return { + type: "cosmos-sdk/ClientState", + value: ClientState.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", + value: ClientState.encode(message).finish() + }; } - }; - function createBaseConsensusState(): ConsensusState { return { publicKey: undefined, diversifier: "", - timestamp: Long.UZERO + timestamp: BigInt(0) }; } - export const ConsensusState = { - encode(message: ConsensusState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState", + encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); } - if (message.diversifier !== "") { writer.uint32(18).string(message.diversifier); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(24).uint64(message.timestamp); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensusState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.publicKey = Any.decode(reader, reader.uint32()); break; - case 2: message.diversifier = reader.string(); break; - case 3: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConsensusState { + fromPartial(object: Partial): ConsensusState { const message = createBaseConsensusState(); message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; message.diversifier = object.diversifier ?? ""; - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConsensusStateAmino): ConsensusState { + const message = createBaseConsensusState(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.diversifier !== undefined && object.diversifier !== null) { + message.diversifier = object.diversifier; + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } return message; + }, + toAmino(message: ConsensusState): ConsensusStateAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.diversifier = message.diversifier; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { + return ConsensusState.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusState): ConsensusStateAminoMsg { + return { + type: "cosmos-sdk/ConsensusState", + value: ConsensusState.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState", + value: ConsensusState.encode(message).finish() + }; } - }; - function createBaseHeader(): Header { return { - sequence: Long.UZERO, - timestamp: Long.UZERO, + sequence: BigInt(0), + timestamp: BigInt(0), signature: new Uint8Array(), newPublicKey: undefined, newDiversifier: "" }; } - export const Header = { - encode(message: Header, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.sequence.isZero()) { + typeUrl: "/ibc.lightclients.solomachine.v2.Header", + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - if (message.signature.length !== 0) { writer.uint32(26).bytes(message.signature); } - if (message.newPublicKey !== undefined) { Any.encode(message.newPublicKey, writer.uint32(34).fork()).ldelim(); } - if (message.newDiversifier !== "") { writer.uint32(42).string(message.newDiversifier); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Header { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHeader(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 2: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - case 3: message.signature = reader.bytes(); break; - case 4: message.newPublicKey = Any.decode(reader, reader.uint32()); break; - case 5: message.newDiversifier = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial
): Header { + fromPartial(object: Partial
): Header { const message = createBaseHeader(); - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.signature = object.signature ?? new Uint8Array(); message.newPublicKey = object.newPublicKey !== undefined && object.newPublicKey !== null ? Any.fromPartial(object.newPublicKey) : undefined; message.newDiversifier = object.newDiversifier ?? ""; return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.new_public_key !== undefined && object.new_public_key !== null) { + message.newPublicKey = Any.fromAmino(object.new_public_key); + } + if (object.new_diversifier !== undefined && object.new_diversifier !== null) { + message.newDiversifier = object.new_diversifier; + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; + obj.new_diversifier = message.newDiversifier; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + toAminoMsg(message: Header): HeaderAminoMsg { + return { + type: "cosmos-sdk/Header", + value: Header.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.Header", + value: Header.encode(message).finish() + }; } - }; - function createBaseMisbehaviour(): Misbehaviour { return { clientId: "", - sequence: Long.UZERO, + sequence: BigInt(0), signatureOne: undefined, signatureTwo: undefined }; } - export const Misbehaviour = { - encode(message: Misbehaviour, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", + encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - - if (!message.sequence.isZero()) { + if (message.sequence !== BigInt(0)) { writer.uint32(16).uint64(message.sequence); } - if (message.signatureOne !== undefined) { SignatureAndData.encode(message.signatureOne, writer.uint32(26).fork()).ldelim(); } - if (message.signatureTwo !== undefined) { SignatureAndData.encode(message.signatureTwo, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Misbehaviour { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMisbehaviour(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 3: message.signatureOne = SignatureAndData.decode(reader, reader.uint32()); break; - case 4: message.signatureTwo = SignatureAndData.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Misbehaviour { + fromPartial(object: Partial): Misbehaviour { const message = createBaseMisbehaviour(); message.clientId = object.clientId ?? ""; - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.signatureOne = object.signatureOne !== undefined && object.signatureOne !== null ? SignatureAndData.fromPartial(object.signatureOne) : undefined; message.signatureTwo = object.signatureTwo !== undefined && object.signatureTwo !== null ? SignatureAndData.fromPartial(object.signatureTwo) : undefined; return message; + }, + fromAmino(object: MisbehaviourAmino): Misbehaviour { + const message = createBaseMisbehaviour(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.signature_one !== undefined && object.signature_one !== null) { + message.signatureOne = SignatureAndData.fromAmino(object.signature_one); + } + if (object.signature_two !== undefined && object.signature_two !== null) { + message.signatureTwo = SignatureAndData.fromAmino(object.signature_two); + } + return message; + }, + toAmino(message: Misbehaviour): MisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; + obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviourAminoMsg): Misbehaviour { + return Misbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: Misbehaviour): MisbehaviourAminoMsg { + return { + type: "cosmos-sdk/Misbehaviour", + value: Misbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", + value: Misbehaviour.encode(message).finish() + }; } - }; - function createBaseSignatureAndData(): SignatureAndData { return { signature: new Uint8Array(), dataType: 0, data: new Uint8Array(), - timestamp: Long.UZERO + timestamp: BigInt(0) }; } - export const SignatureAndData = { - encode(message: SignatureAndData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData", + encode(message: SignatureAndData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signature.length !== 0) { writer.uint32(10).bytes(message.signature); } - if (message.dataType !== 0) { writer.uint32(16).int32(message.dataType); } - if (message.data.length !== 0) { writer.uint32(26).bytes(message.data); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(32).uint64(message.timestamp); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignatureAndData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignatureAndData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignatureAndData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signature = reader.bytes(); break; - case 2: message.dataType = (reader.int32() as any); break; - case 3: message.data = reader.bytes(); break; - case 4: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignatureAndData { + fromPartial(object: Partial): SignatureAndData { const message = createBaseSignatureAndData(); message.signature = object.signature ?? new Uint8Array(); message.dataType = object.dataType ?? 0; message.data = object.data ?? new Uint8Array(); - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; + }, + fromAmino(object: SignatureAndDataAmino): SignatureAndData { + const message = createBaseSignatureAndData(); + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.data_type !== undefined && object.data_type !== null) { + message.dataType = dataTypeFromJSON(object.data_type); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: SignatureAndData): SignatureAndDataAmino { + const obj: any = {}; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.data_type = dataTypeToJSON(message.dataType); + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { + return SignatureAndData.fromAmino(object.value); + }, + toAminoMsg(message: SignatureAndData): SignatureAndDataAminoMsg { + return { + type: "cosmos-sdk/SignatureAndData", + value: SignatureAndData.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureAndDataProtoMsg): SignatureAndData { + return SignatureAndData.decode(message.value); + }, + toProto(message: SignatureAndData): Uint8Array { + return SignatureAndData.encode(message).finish(); + }, + toProtoMsg(message: SignatureAndData): SignatureAndDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData", + value: SignatureAndData.encode(message).finish() + }; } - }; - function createBaseTimestampedSignatureData(): TimestampedSignatureData { return { signatureData: new Uint8Array(), - timestamp: Long.UZERO + timestamp: BigInt(0) }; } - export const TimestampedSignatureData = { - encode(message: TimestampedSignatureData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData", + encode(message: TimestampedSignatureData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signatureData.length !== 0) { writer.uint32(10).bytes(message.signatureData); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TimestampedSignatureData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TimestampedSignatureData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTimestampedSignatureData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signatureData = reader.bytes(); break; - case 2: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TimestampedSignatureData { + fromPartial(object: Partial): TimestampedSignatureData { const message = createBaseTimestampedSignatureData(); message.signatureData = object.signatureData ?? new Uint8Array(); - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; + }, + fromAmino(object: TimestampedSignatureDataAmino): TimestampedSignatureData { + const message = createBaseTimestampedSignatureData(); + if (object.signature_data !== undefined && object.signature_data !== null) { + message.signatureData = bytesFromBase64(object.signature_data); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { + const obj: any = {}; + obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { + return TimestampedSignatureData.fromAmino(object.value); + }, + toAminoMsg(message: TimestampedSignatureData): TimestampedSignatureDataAminoMsg { + return { + type: "cosmos-sdk/TimestampedSignatureData", + value: TimestampedSignatureData.toAmino(message) + }; + }, + fromProtoMsg(message: TimestampedSignatureDataProtoMsg): TimestampedSignatureData { + return TimestampedSignatureData.decode(message.value); + }, + toProto(message: TimestampedSignatureData): Uint8Array { + return TimestampedSignatureData.encode(message).finish(); + }, + toProtoMsg(message: TimestampedSignatureData): TimestampedSignatureDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData", + value: TimestampedSignatureData.encode(message).finish() + }; } - }; - function createBaseSignBytes(): SignBytes { return { - sequence: Long.UZERO, - timestamp: Long.UZERO, + sequence: BigInt(0), + timestamp: BigInt(0), diversifier: "", dataType: 0, data: new Uint8Array() }; } - export const SignBytes = { - encode(message: SignBytes, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.sequence.isZero()) { + typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", + encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - if (message.diversifier !== "") { writer.uint32(26).string(message.diversifier); } - if (message.dataType !== 0) { writer.uint32(32).int32(message.dataType); } - if (message.data.length !== 0) { writer.uint32(42).bytes(message.data); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignBytes { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignBytes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignBytes(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.sequence = (reader.uint64() as Long); + message.sequence = reader.uint64(); break; - case 2: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - case 3: message.diversifier = reader.string(); break; - case 4: message.dataType = (reader.int32() as any); break; - case 5: message.data = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignBytes { + fromPartial(object: Partial): SignBytes { const message = createBaseSignBytes(); - message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.diversifier = object.diversifier ?? ""; message.dataType = object.dataType ?? 0; message.data = object.data ?? new Uint8Array(); return message; + }, + fromAmino(object: SignBytesAmino): SignBytes { + const message = createBaseSignBytes(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + if (object.diversifier !== undefined && object.diversifier !== null) { + message.diversifier = object.diversifier; + } + if (object.data_type !== undefined && object.data_type !== null) { + message.dataType = dataTypeFromJSON(object.data_type); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: SignBytes): SignBytesAmino { + const obj: any = {}; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = message.diversifier; + obj.data_type = dataTypeToJSON(message.dataType); + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: SignBytesAminoMsg): SignBytes { + return SignBytes.fromAmino(object.value); + }, + toAminoMsg(message: SignBytes): SignBytesAminoMsg { + return { + type: "cosmos-sdk/SignBytes", + value: SignBytes.toAmino(message) + }; + }, + fromProtoMsg(message: SignBytesProtoMsg): SignBytes { + return SignBytes.decode(message.value); + }, + toProto(message: SignBytes): Uint8Array { + return SignBytes.encode(message).finish(); + }, + toProtoMsg(message: SignBytes): SignBytesProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", + value: SignBytes.encode(message).finish() + }; } - }; - function createBaseHeaderData(): HeaderData { return { newPubKey: undefined, newDiversifier: "" }; } - export const HeaderData = { - encode(message: HeaderData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData", + encode(message: HeaderData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newPubKey !== undefined) { Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); } - if (message.newDiversifier !== "") { writer.uint32(18).string(message.newDiversifier); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): HeaderData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): HeaderData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHeaderData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.newPubKey = Any.decode(reader, reader.uint32()); break; - case 2: message.newDiversifier = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): HeaderData { + fromPartial(object: Partial): HeaderData { const message = createBaseHeaderData(); message.newPubKey = object.newPubKey !== undefined && object.newPubKey !== null ? Any.fromPartial(object.newPubKey) : undefined; message.newDiversifier = object.newDiversifier ?? ""; return message; + }, + fromAmino(object: HeaderDataAmino): HeaderData { + const message = createBaseHeaderData(); + if (object.new_pub_key !== undefined && object.new_pub_key !== null) { + message.newPubKey = Any.fromAmino(object.new_pub_key); + } + if (object.new_diversifier !== undefined && object.new_diversifier !== null) { + message.newDiversifier = object.new_diversifier; + } + return message; + }, + toAmino(message: HeaderData): HeaderDataAmino { + const obj: any = {}; + obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; + obj.new_diversifier = message.newDiversifier; + return obj; + }, + fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { + return HeaderData.fromAmino(object.value); + }, + toAminoMsg(message: HeaderData): HeaderDataAminoMsg { + return { + type: "cosmos-sdk/HeaderData", + value: HeaderData.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderDataProtoMsg): HeaderData { + return HeaderData.decode(message.value); + }, + toProto(message: HeaderData): Uint8Array { + return HeaderData.encode(message).finish(); + }, + toProtoMsg(message: HeaderData): HeaderDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData", + value: HeaderData.encode(message).finish() + }; } - }; - function createBaseClientStateData(): ClientStateData { return { path: new Uint8Array(), clientState: undefined }; } - export const ClientStateData = { - encode(message: ClientStateData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData", + encode(message: ClientStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientStateData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientStateData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.clientState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientStateData { + fromPartial(object: Partial): ClientStateData { const message = createBaseClientStateData(); message.path = object.path ?? new Uint8Array(); message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; return message; + }, + fromAmino(object: ClientStateDataAmino): ClientStateData { + const message = createBaseClientStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + return message; + }, + toAmino(message: ClientStateData): ClientStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + return obj; + }, + fromAminoMsg(object: ClientStateDataAminoMsg): ClientStateData { + return ClientStateData.fromAmino(object.value); + }, + toAminoMsg(message: ClientStateData): ClientStateDataAminoMsg { + return { + type: "cosmos-sdk/ClientStateData", + value: ClientStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateDataProtoMsg): ClientStateData { + return ClientStateData.decode(message.value); + }, + toProto(message: ClientStateData): Uint8Array { + return ClientStateData.encode(message).finish(); + }, + toProtoMsg(message: ClientStateData): ClientStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData", + value: ClientStateData.encode(message).finish() + }; } - }; - function createBaseConsensusStateData(): ConsensusStateData { return { path: new Uint8Array(), consensusState: undefined }; } - export const ConsensusStateData = { - encode(message: ConsensusStateData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData", + encode(message: ConsensusStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusStateData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensusStateData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.consensusState = Any.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConsensusStateData { + fromPartial(object: Partial): ConsensusStateData { const message = createBaseConsensusStateData(); message.path = object.path ?? new Uint8Array(); message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; return message; + }, + fromAmino(object: ConsensusStateDataAmino): ConsensusStateData { + const message = createBaseConsensusStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + return message; + }, + toAmino(message: ConsensusStateData): ConsensusStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateDataAminoMsg): ConsensusStateData { + return ConsensusStateData.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusStateData): ConsensusStateDataAminoMsg { + return { + type: "cosmos-sdk/ConsensusStateData", + value: ConsensusStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateDataProtoMsg): ConsensusStateData { + return ConsensusStateData.decode(message.value); + }, + toProto(message: ConsensusStateData): Uint8Array { + return ConsensusStateData.encode(message).finish(); + }, + toProtoMsg(message: ConsensusStateData): ConsensusStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData", + value: ConsensusStateData.encode(message).finish() + }; } - }; - function createBaseConnectionStateData(): ConnectionStateData { return { path: new Uint8Array(), connection: undefined }; } - export const ConnectionStateData = { - encode(message: ConnectionStateData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData", + encode(message: ConnectionStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.connection !== undefined) { ConnectionEnd.encode(message.connection, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionStateData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConnectionStateData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.connection = ConnectionEnd.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConnectionStateData { + fromPartial(object: Partial): ConnectionStateData { const message = createBaseConnectionStateData(); message.path = object.path ?? new Uint8Array(); message.connection = object.connection !== undefined && object.connection !== null ? ConnectionEnd.fromPartial(object.connection) : undefined; return message; + }, + fromAmino(object: ConnectionStateDataAmino): ConnectionStateData { + const message = createBaseConnectionStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.connection !== undefined && object.connection !== null) { + message.connection = ConnectionEnd.fromAmino(object.connection); + } + return message; + }, + toAmino(message: ConnectionStateData): ConnectionStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.connection = message.connection ? ConnectionEnd.toAmino(message.connection) : undefined; + return obj; + }, + fromAminoMsg(object: ConnectionStateDataAminoMsg): ConnectionStateData { + return ConnectionStateData.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionStateData): ConnectionStateDataAminoMsg { + return { + type: "cosmos-sdk/ConnectionStateData", + value: ConnectionStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionStateDataProtoMsg): ConnectionStateData { + return ConnectionStateData.decode(message.value); + }, + toProto(message: ConnectionStateData): Uint8Array { + return ConnectionStateData.encode(message).finish(); + }, + toProtoMsg(message: ConnectionStateData): ConnectionStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData", + value: ConnectionStateData.encode(message).finish() + }; } - }; - function createBaseChannelStateData(): ChannelStateData { return { path: new Uint8Array(), channel: undefined }; } - export const ChannelStateData = { - encode(message: ChannelStateData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData", + encode(message: ChannelStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ChannelStateData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ChannelStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseChannelStateData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.channel = Channel.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ChannelStateData { + fromPartial(object: Partial): ChannelStateData { const message = createBaseChannelStateData(); message.path = object.path ?? new Uint8Array(); message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; return message; + }, + fromAmino(object: ChannelStateDataAmino): ChannelStateData { + const message = createBaseChannelStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + return message; + }, + toAmino(message: ChannelStateData): ChannelStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + return obj; + }, + fromAminoMsg(object: ChannelStateDataAminoMsg): ChannelStateData { + return ChannelStateData.fromAmino(object.value); + }, + toAminoMsg(message: ChannelStateData): ChannelStateDataAminoMsg { + return { + type: "cosmos-sdk/ChannelStateData", + value: ChannelStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ChannelStateDataProtoMsg): ChannelStateData { + return ChannelStateData.decode(message.value); + }, + toProto(message: ChannelStateData): Uint8Array { + return ChannelStateData.encode(message).finish(); + }, + toProtoMsg(message: ChannelStateData): ChannelStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData", + value: ChannelStateData.encode(message).finish() + }; } - }; - function createBasePacketCommitmentData(): PacketCommitmentData { return { path: new Uint8Array(), commitment: new Uint8Array() }; } - export const PacketCommitmentData = { - encode(message: PacketCommitmentData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData", + encode(message: PacketCommitmentData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.commitment.length !== 0) { writer.uint32(18).bytes(message.commitment); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PacketCommitmentData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PacketCommitmentData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacketCommitmentData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.commitment = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PacketCommitmentData { + fromPartial(object: Partial): PacketCommitmentData { const message = createBasePacketCommitmentData(); message.path = object.path ?? new Uint8Array(); message.commitment = object.commitment ?? new Uint8Array(); return message; + }, + fromAmino(object: PacketCommitmentDataAmino): PacketCommitmentData { + const message = createBasePacketCommitmentData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.commitment !== undefined && object.commitment !== null) { + message.commitment = bytesFromBase64(object.commitment); + } + return message; + }, + toAmino(message: PacketCommitmentData): PacketCommitmentDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.commitment = message.commitment ? base64FromBytes(message.commitment) : undefined; + return obj; + }, + fromAminoMsg(object: PacketCommitmentDataAminoMsg): PacketCommitmentData { + return PacketCommitmentData.fromAmino(object.value); + }, + toAminoMsg(message: PacketCommitmentData): PacketCommitmentDataAminoMsg { + return { + type: "cosmos-sdk/PacketCommitmentData", + value: PacketCommitmentData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketCommitmentDataProtoMsg): PacketCommitmentData { + return PacketCommitmentData.decode(message.value); + }, + toProto(message: PacketCommitmentData): Uint8Array { + return PacketCommitmentData.encode(message).finish(); + }, + toProtoMsg(message: PacketCommitmentData): PacketCommitmentDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData", + value: PacketCommitmentData.encode(message).finish() + }; } - }; - function createBasePacketAcknowledgementData(): PacketAcknowledgementData { return { path: new Uint8Array(), acknowledgement: new Uint8Array() }; } - export const PacketAcknowledgementData = { - encode(message: PacketAcknowledgementData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData", + encode(message: PacketAcknowledgementData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.acknowledgement.length !== 0) { writer.uint32(18).bytes(message.acknowledgement); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PacketAcknowledgementData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PacketAcknowledgementData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacketAcknowledgementData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: message.acknowledgement = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PacketAcknowledgementData { + fromPartial(object: Partial): PacketAcknowledgementData { const message = createBasePacketAcknowledgementData(); message.path = object.path ?? new Uint8Array(); message.acknowledgement = object.acknowledgement ?? new Uint8Array(); return message; + }, + fromAmino(object: PacketAcknowledgementDataAmino): PacketAcknowledgementData { + const message = createBasePacketAcknowledgementData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = bytesFromBase64(object.acknowledgement); + } + return message; + }, + toAmino(message: PacketAcknowledgementData): PacketAcknowledgementDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; + return obj; + }, + fromAminoMsg(object: PacketAcknowledgementDataAminoMsg): PacketAcknowledgementData { + return PacketAcknowledgementData.fromAmino(object.value); + }, + toAminoMsg(message: PacketAcknowledgementData): PacketAcknowledgementDataAminoMsg { + return { + type: "cosmos-sdk/PacketAcknowledgementData", + value: PacketAcknowledgementData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketAcknowledgementDataProtoMsg): PacketAcknowledgementData { + return PacketAcknowledgementData.decode(message.value); + }, + toProto(message: PacketAcknowledgementData): Uint8Array { + return PacketAcknowledgementData.encode(message).finish(); + }, + toProtoMsg(message: PacketAcknowledgementData): PacketAcknowledgementDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData", + value: PacketAcknowledgementData.encode(message).finish() + }; } - }; - function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { return { path: new Uint8Array() }; } - export const PacketReceiptAbsenceData = { - encode(message: PacketReceiptAbsenceData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData", + encode(message: PacketReceiptAbsenceData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PacketReceiptAbsenceData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PacketReceiptAbsenceData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePacketReceiptAbsenceData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PacketReceiptAbsenceData { + fromPartial(object: Partial): PacketReceiptAbsenceData { const message = createBasePacketReceiptAbsenceData(); message.path = object.path ?? new Uint8Array(); return message; + }, + fromAmino(object: PacketReceiptAbsenceDataAmino): PacketReceiptAbsenceData { + const message = createBasePacketReceiptAbsenceData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + return message; + }, + toAmino(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + return obj; + }, + fromAminoMsg(object: PacketReceiptAbsenceDataAminoMsg): PacketReceiptAbsenceData { + return PacketReceiptAbsenceData.fromAmino(object.value); + }, + toAminoMsg(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataAminoMsg { + return { + type: "cosmos-sdk/PacketReceiptAbsenceData", + value: PacketReceiptAbsenceData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketReceiptAbsenceDataProtoMsg): PacketReceiptAbsenceData { + return PacketReceiptAbsenceData.decode(message.value); + }, + toProto(message: PacketReceiptAbsenceData): Uint8Array { + return PacketReceiptAbsenceData.encode(message).finish(); + }, + toProtoMsg(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData", + value: PacketReceiptAbsenceData.encode(message).finish() + }; } - }; - function createBaseNextSequenceRecvData(): NextSequenceRecvData { return { path: new Uint8Array(), - nextSeqRecv: Long.UZERO + nextSeqRecv: BigInt(0) }; } - export const NextSequenceRecvData = { - encode(message: NextSequenceRecvData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData", + encode(message: NextSequenceRecvData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - - if (!message.nextSeqRecv.isZero()) { + if (message.nextSeqRecv !== BigInt(0)) { writer.uint32(16).uint64(message.nextSeqRecv); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): NextSequenceRecvData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): NextSequenceRecvData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNextSequenceRecvData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.path = reader.bytes(); break; - case 2: - message.nextSeqRecv = (reader.uint64() as Long); + message.nextSeqRecv = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): NextSequenceRecvData { + fromPartial(object: Partial): NextSequenceRecvData { const message = createBaseNextSequenceRecvData(); message.path = object.path ?? new Uint8Array(); - message.nextSeqRecv = object.nextSeqRecv !== undefined && object.nextSeqRecv !== null ? Long.fromValue(object.nextSeqRecv) : Long.UZERO; + message.nextSeqRecv = object.nextSeqRecv !== undefined && object.nextSeqRecv !== null ? BigInt(object.nextSeqRecv.toString()) : BigInt(0); + return message; + }, + fromAmino(object: NextSequenceRecvDataAmino): NextSequenceRecvData { + const message = createBaseNextSequenceRecvData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.next_seq_recv !== undefined && object.next_seq_recv !== null) { + message.nextSeqRecv = BigInt(object.next_seq_recv); + } return message; + }, + toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + return obj; + }, + fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { + return NextSequenceRecvData.fromAmino(object.value); + }, + toAminoMsg(message: NextSequenceRecvData): NextSequenceRecvDataAminoMsg { + return { + type: "cosmos-sdk/NextSequenceRecvData", + value: NextSequenceRecvData.toAmino(message) + }; + }, + fromProtoMsg(message: NextSequenceRecvDataProtoMsg): NextSequenceRecvData { + return NextSequenceRecvData.decode(message.value); + }, + toProto(message: NextSequenceRecvData): Uint8Array { + return NextSequenceRecvData.encode(message).finish(); + }, + toProtoMsg(message: NextSequenceRecvData): NextSequenceRecvDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData", + value: NextSequenceRecvData.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ibc/lightclients/tendermint/v1/tendermint.ts b/src/codegen/ibc/lightclients/tendermint/v1/tendermint.ts index 966c82e..a156014 100644 --- a/src/codegen/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/src/codegen/ibc/lightclients/tendermint/v1/tendermint.ts @@ -1,40 +1,33 @@ -import { Duration, DurationSDKType } from "../../../../google/protobuf/duration"; -import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import { ProofSpec, ProofSpecSDKType } from "../../../../confio/proofs"; +import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; +import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; +import { ProofSpec, ProofSpecAmino, ProofSpecSDKType } from "../../../../confio/proofs"; import { Timestamp } from "../../../../google/protobuf/timestamp"; -import { MerkleRoot, MerkleRootSDKType } from "../../../core/commitment/v1/commitment"; -import { SignedHeader, SignedHeaderSDKType } from "../../../../tendermint/types/types"; -import { ValidatorSet, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, toTimestamp, fromTimestamp, Long } from "../../../../helpers"; +import { MerkleRoot, MerkleRootAmino, MerkleRootSDKType } from "../../../core/commitment/v1/commitment"; +import { SignedHeader, SignedHeaderAmino, SignedHeaderSDKType } from "../../../../tendermint/types/types"; +import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** * ClientState from Tendermint tracks the current validator set, latest height, * and a possible frozen height. */ - export interface ClientState { chainId: string; - trustLevel?: Fraction; + trustLevel: Fraction; /** * duration of the period since the LastestTimestamp during which the * submitted headers are valid for upgrade */ - - trustingPeriod?: Duration; + trustingPeriod: Duration; /** duration of the staking unbonding period */ - - unbondingPeriod?: Duration; + unbondingPeriod: Duration; /** defines how much new (untrusted) header's Time can drift into the future. */ - - maxClockDrift?: Duration; + maxClockDrift: Duration; /** Block height when the client was frozen due to a misbehaviour */ - - frozenHeight?: Height; + frozenHeight: Height; /** Latest height the client was updated to */ - - latestHeight?: Height; + latestHeight: Height; /** Proof specifications used in verifying counterparty state */ - proofSpecs: ProofSpec[]; /** * Path at which next upgraded client will be committed. @@ -45,50 +38,44 @@ export interface ClientState { * the default upgrade module, upgrade_path should be []string{"upgrade", * "upgradedIBCState"}` */ - upgradePath: string[]; /** * This flag, when set to true, will allow governance to recover a client * which has expired */ - allowUpdateAfterExpiry: boolean; /** * This flag, when set to true, will allow governance to unfreeze a client * whose chain has experienced a misbehaviour event */ - allowUpdateAfterMisbehaviour: boolean; } +export interface ClientStateProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.ClientState"; + value: Uint8Array; +} /** * ClientState from Tendermint tracks the current validator set, latest height, * and a possible frozen height. */ - -export interface ClientStateSDKType { - chain_id: string; - trust_level?: FractionSDKType; +export interface ClientStateAmino { + chain_id?: string; + trust_level?: FractionAmino; /** * duration of the period since the LastestTimestamp during which the * submitted headers are valid for upgrade */ - - trusting_period?: DurationSDKType; + trusting_period?: DurationAmino; /** duration of the staking unbonding period */ - - unbonding_period?: DurationSDKType; + unbonding_period?: DurationAmino; /** defines how much new (untrusted) header's Time can drift into the future. */ - - max_clock_drift?: DurationSDKType; + max_clock_drift?: DurationAmino; /** Block height when the client was frozen due to a misbehaviour */ - - frozen_height?: HeightSDKType; + frozen_height?: HeightAmino; /** Latest height the client was updated to */ - - latest_height?: HeightSDKType; + latest_height?: HeightAmino; /** Proof specifications used in verifying counterparty state */ - - proof_specs: ProofSpecSDKType[]; + proof_specs?: ProofSpecAmino[]; /** * Path at which next upgraded client will be committed. * Each element corresponds to the key for a single CommitmentProof in the @@ -98,62 +85,105 @@ export interface ClientStateSDKType { * the default upgrade module, upgrade_path should be []string{"upgrade", * "upgradedIBCState"}` */ - - upgrade_path: string[]; + upgrade_path?: string[]; /** * This flag, when set to true, will allow governance to recover a client * which has expired */ - - allow_update_after_expiry: boolean; + allow_update_after_expiry?: boolean; /** * This flag, when set to true, will allow governance to unfreeze a client * whose chain has experienced a misbehaviour event */ - + allow_update_after_misbehaviour?: boolean; +} +export interface ClientStateAminoMsg { + type: "cosmos-sdk/ClientState"; + value: ClientStateAmino; +} +/** + * ClientState from Tendermint tracks the current validator set, latest height, + * and a possible frozen height. + */ +export interface ClientStateSDKType { + chain_id: string; + trust_level: FractionSDKType; + trusting_period: DurationSDKType; + unbonding_period: DurationSDKType; + max_clock_drift: DurationSDKType; + frozen_height: HeightSDKType; + latest_height: HeightSDKType; + proof_specs: ProofSpecSDKType[]; + upgrade_path: string[]; + allow_update_after_expiry: boolean; allow_update_after_misbehaviour: boolean; } /** ConsensusState defines the consensus state from Tendermint. */ - export interface ConsensusState { /** * timestamp that corresponds to the block height in which the ConsensusState * was stored. */ - timestamp?: Date; + timestamp: Date; /** commitment root (i.e app hash) */ - - root?: MerkleRoot; + root: MerkleRoot; nextValidatorsHash: Uint8Array; } +export interface ConsensusStateProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState"; + value: Uint8Array; +} /** ConsensusState defines the consensus state from Tendermint. */ - -export interface ConsensusStateSDKType { +export interface ConsensusStateAmino { /** * timestamp that corresponds to the block height in which the ConsensusState * was stored. */ - timestamp?: Date; + timestamp?: string; /** commitment root (i.e app hash) */ - - root?: MerkleRootSDKType; + root?: MerkleRootAmino; + next_validators_hash?: string; +} +export interface ConsensusStateAminoMsg { + type: "cosmos-sdk/ConsensusState"; + value: ConsensusStateAmino; +} +/** ConsensusState defines the consensus state from Tendermint. */ +export interface ConsensusStateSDKType { + timestamp: Date; + root: MerkleRootSDKType; next_validators_hash: Uint8Array; } /** * Misbehaviour is a wrapper over two conflicting Headers * that implements Misbehaviour interface expected by ICS-02 */ - export interface Misbehaviour { clientId: string; header1?: Header; header2?: Header; } +export interface MisbehaviourProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour"; + value: Uint8Array; +} +/** + * Misbehaviour is a wrapper over two conflicting Headers + * that implements Misbehaviour interface expected by ICS-02 + */ +export interface MisbehaviourAmino { + client_id?: string; + header_1?: HeaderAmino; + header_2?: HeaderAmino; +} +export interface MisbehaviourAminoMsg { + type: "cosmos-sdk/Misbehaviour"; + value: MisbehaviourAmino; +} /** * Misbehaviour is a wrapper over two conflicting Headers * that implements Misbehaviour interface expected by ICS-02 */ - export interface MisbehaviourSDKType { client_id: string; header_1?: HeaderSDKType; @@ -173,13 +203,40 @@ export interface MisbehaviourSDKType { * hash to TrustedConsensusState.NextValidatorsHash since that is the last * trusted validator set at the TrustedHeight. */ - export interface Header { signedHeader?: SignedHeader; validatorSet?: ValidatorSet; - trustedHeight?: Height; + trustedHeight: Height; trustedValidators?: ValidatorSet; } +export interface HeaderProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.Header"; + value: Uint8Array; +} +/** + * Header defines the Tendermint client consensus Header. + * It encapsulates all the information necessary to update from a trusted + * Tendermint ConsensusState. The inclusion of TrustedHeight and + * TrustedValidators allows this update to process correctly, so long as the + * ConsensusState for the TrustedHeight exists, this removes race conditions + * among relayers The SignedHeader and ValidatorSet are the new untrusted update + * fields for the client. The TrustedHeight is the height of a stored + * ConsensusState on the client that will be used to verify the new untrusted + * header. The Trusted ConsensusState must be within the unbonding period of + * current time in order to correctly verify, and the TrustedValidators must + * hash to TrustedConsensusState.NextValidatorsHash since that is the last + * trusted validator set at the TrustedHeight. + */ +export interface HeaderAmino { + signed_header?: SignedHeaderAmino; + validator_set?: ValidatorSetAmino; + trusted_height?: HeightAmino; + trusted_validators?: ValidatorSetAmino; +} +export interface HeaderAminoMsg { + type: "cosmos-sdk/Header"; + value: HeaderAmino; +} /** * Header defines the Tendermint client consensus Header. * It encapsulates all the information necessary to update from a trusted @@ -194,160 +251,145 @@ export interface Header { * hash to TrustedConsensusState.NextValidatorsHash since that is the last * trusted validator set at the TrustedHeight. */ - export interface HeaderSDKType { signed_header?: SignedHeaderSDKType; validator_set?: ValidatorSetSDKType; - trusted_height?: HeightSDKType; + trusted_height: HeightSDKType; trusted_validators?: ValidatorSetSDKType; } /** * Fraction defines the protobuf message type for tmmath.Fraction that only * supports positive values. */ - export interface Fraction { - numerator: Long; - denominator: Long; + numerator: bigint; + denominator: bigint; +} +export interface FractionProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.Fraction"; + value: Uint8Array; +} +/** + * Fraction defines the protobuf message type for tmmath.Fraction that only + * supports positive values. + */ +export interface FractionAmino { + numerator?: string; + denominator?: string; +} +export interface FractionAminoMsg { + type: "cosmos-sdk/Fraction"; + value: FractionAmino; } /** * Fraction defines the protobuf message type for tmmath.Fraction that only * supports positive values. */ - export interface FractionSDKType { - numerator: Long; - denominator: Long; + numerator: bigint; + denominator: bigint; } - function createBaseClientState(): ClientState { return { chainId: "", - trustLevel: undefined, - trustingPeriod: undefined, - unbondingPeriod: undefined, - maxClockDrift: undefined, - frozenHeight: undefined, - latestHeight: undefined, + trustLevel: Fraction.fromPartial({}), + trustingPeriod: Duration.fromPartial({}), + unbondingPeriod: Duration.fromPartial({}), + maxClockDrift: Duration.fromPartial({}), + frozenHeight: Height.fromPartial({}), + latestHeight: Height.fromPartial({}), proofSpecs: [], upgradePath: [], allowUpdateAfterExpiry: false, allowUpdateAfterMisbehaviour: false }; } - export const ClientState = { - encode(message: ClientState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chainId !== "") { writer.uint32(10).string(message.chainId); } - if (message.trustLevel !== undefined) { Fraction.encode(message.trustLevel, writer.uint32(18).fork()).ldelim(); } - if (message.trustingPeriod !== undefined) { Duration.encode(message.trustingPeriod, writer.uint32(26).fork()).ldelim(); } - if (message.unbondingPeriod !== undefined) { Duration.encode(message.unbondingPeriod, writer.uint32(34).fork()).ldelim(); } - if (message.maxClockDrift !== undefined) { Duration.encode(message.maxClockDrift, writer.uint32(42).fork()).ldelim(); } - if (message.frozenHeight !== undefined) { Height.encode(message.frozenHeight, writer.uint32(50).fork()).ldelim(); } - if (message.latestHeight !== undefined) { Height.encode(message.latestHeight, writer.uint32(58).fork()).ldelim(); } - for (const v of message.proofSpecs) { ProofSpec.encode(v!, writer.uint32(66).fork()).ldelim(); } - for (const v of message.upgradePath) { writer.uint32(74).string(v!); } - if (message.allowUpdateAfterExpiry === true) { writer.uint32(80).bool(message.allowUpdateAfterExpiry); } - if (message.allowUpdateAfterMisbehaviour === true) { writer.uint32(88).bool(message.allowUpdateAfterMisbehaviour); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ClientState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClientState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.chainId = reader.string(); break; - case 2: message.trustLevel = Fraction.decode(reader, reader.uint32()); break; - case 3: message.trustingPeriod = Duration.decode(reader, reader.uint32()); break; - case 4: message.unbondingPeriod = Duration.decode(reader, reader.uint32()); break; - case 5: message.maxClockDrift = Duration.decode(reader, reader.uint32()); break; - case 6: message.frozenHeight = Height.decode(reader, reader.uint32()); break; - case 7: message.latestHeight = Height.decode(reader, reader.uint32()); break; - case 8: message.proofSpecs.push(ProofSpec.decode(reader, reader.uint32())); break; - case 9: message.upgradePath.push(reader.string()); break; - case 10: message.allowUpdateAfterExpiry = reader.bool(); break; - case 11: message.allowUpdateAfterMisbehaviour = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ClientState { + fromPartial(object: Partial): ClientState { const message = createBaseClientState(); message.chainId = object.chainId ?? ""; message.trustLevel = object.trustLevel !== undefined && object.trustLevel !== null ? Fraction.fromPartial(object.trustLevel) : undefined; @@ -361,75 +403,178 @@ export const ClientState = { message.allowUpdateAfterExpiry = object.allowUpdateAfterExpiry ?? false; message.allowUpdateAfterMisbehaviour = object.allowUpdateAfterMisbehaviour ?? false; return message; + }, + fromAmino(object: ClientStateAmino): ClientState { + const message = createBaseClientState(); + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.trust_level !== undefined && object.trust_level !== null) { + message.trustLevel = Fraction.fromAmino(object.trust_level); + } + if (object.trusting_period !== undefined && object.trusting_period !== null) { + message.trustingPeriod = Duration.fromAmino(object.trusting_period); + } + if (object.unbonding_period !== undefined && object.unbonding_period !== null) { + message.unbondingPeriod = Duration.fromAmino(object.unbonding_period); + } + if (object.max_clock_drift !== undefined && object.max_clock_drift !== null) { + message.maxClockDrift = Duration.fromAmino(object.max_clock_drift); + } + if (object.frozen_height !== undefined && object.frozen_height !== null) { + message.frozenHeight = Height.fromAmino(object.frozen_height); + } + if (object.latest_height !== undefined && object.latest_height !== null) { + message.latestHeight = Height.fromAmino(object.latest_height); + } + message.proofSpecs = object.proof_specs?.map(e => ProofSpec.fromAmino(e)) || []; + message.upgradePath = object.upgrade_path?.map(e => e) || []; + if (object.allow_update_after_expiry !== undefined && object.allow_update_after_expiry !== null) { + message.allowUpdateAfterExpiry = object.allow_update_after_expiry; + } + if (object.allow_update_after_misbehaviour !== undefined && object.allow_update_after_misbehaviour !== null) { + message.allowUpdateAfterMisbehaviour = object.allow_update_after_misbehaviour; + } + return message; + }, + toAmino(message: ClientState): ClientStateAmino { + const obj: any = {}; + obj.chain_id = message.chainId; + obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; + obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; + obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; + obj.max_clock_drift = message.maxClockDrift ? Duration.toAmino(message.maxClockDrift) : undefined; + obj.frozen_height = message.frozenHeight ? Height.toAmino(message.frozenHeight) : {}; + obj.latest_height = message.latestHeight ? Height.toAmino(message.latestHeight) : {}; + if (message.proofSpecs) { + obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); + } else { + obj.proof_specs = []; + } + if (message.upgradePath) { + obj.upgrade_path = message.upgradePath.map(e => e); + } else { + obj.upgrade_path = []; + } + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + return obj; + }, + fromAminoMsg(object: ClientStateAminoMsg): ClientState { + return ClientState.fromAmino(object.value); + }, + toAminoMsg(message: ClientState): ClientStateAminoMsg { + return { + type: "cosmos-sdk/ClientState", + value: ClientState.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", + value: ClientState.encode(message).finish() + }; } - }; - function createBaseConsensusState(): ConsensusState { return { - timestamp: undefined, - root: undefined, + timestamp: new Date(), + root: MerkleRoot.fromPartial({}), nextValidatorsHash: new Uint8Array() }; } - export const ConsensusState = { - encode(message: ConsensusState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState", + encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).ldelim(); } - if (message.root !== undefined) { MerkleRoot.encode(message.root, writer.uint32(18).fork()).ldelim(); } - if (message.nextValidatorsHash.length !== 0) { writer.uint32(26).bytes(message.nextValidatorsHash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensusState(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 2: message.root = MerkleRoot.decode(reader, reader.uint32()); break; - case 3: message.nextValidatorsHash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConsensusState { + fromPartial(object: Partial): ConsensusState { const message = createBaseConsensusState(); message.timestamp = object.timestamp ?? undefined; message.root = object.root !== undefined && object.root !== null ? MerkleRoot.fromPartial(object.root) : undefined; message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); return message; + }, + fromAmino(object: ConsensusStateAmino): ConsensusState { + const message = createBaseConsensusState(); + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.root !== undefined && object.root !== null) { + message.root = MerkleRoot.fromAmino(object.root); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + return message; + }, + toAmino(message: ConsensusState): ConsensusStateAmino { + const obj: any = {}; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.root = message.root ? MerkleRoot.toAmino(message.root) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { + return ConsensusState.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusState): ConsensusStateAminoMsg { + return { + type: "cosmos-sdk/ConsensusState", + value: ConsensusState.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState", + value: ConsensusState.encode(message).finish() + }; } - }; - function createBaseMisbehaviour(): Misbehaviour { return { clientId: "", @@ -437,190 +582,275 @@ function createBaseMisbehaviour(): Misbehaviour { header2: undefined }; } - export const Misbehaviour = { - encode(message: Misbehaviour, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", + encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.header1 !== undefined) { Header.encode(message.header1, writer.uint32(18).fork()).ldelim(); } - if (message.header2 !== undefined) { Header.encode(message.header2, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Misbehaviour { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMisbehaviour(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; - case 2: message.header1 = Header.decode(reader, reader.uint32()); break; - case 3: message.header2 = Header.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Misbehaviour { + fromPartial(object: Partial): Misbehaviour { const message = createBaseMisbehaviour(); message.clientId = object.clientId ?? ""; message.header1 = object.header1 !== undefined && object.header1 !== null ? Header.fromPartial(object.header1) : undefined; message.header2 = object.header2 !== undefined && object.header2 !== null ? Header.fromPartial(object.header2) : undefined; return message; + }, + fromAmino(object: MisbehaviourAmino): Misbehaviour { + const message = createBaseMisbehaviour(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.header_1 !== undefined && object.header_1 !== null) { + message.header1 = Header.fromAmino(object.header_1); + } + if (object.header_2 !== undefined && object.header_2 !== null) { + message.header2 = Header.fromAmino(object.header_2); + } + return message; + }, + toAmino(message: Misbehaviour): MisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; + obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviourAminoMsg): Misbehaviour { + return Misbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: Misbehaviour): MisbehaviourAminoMsg { + return { + type: "cosmos-sdk/Misbehaviour", + value: Misbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", + value: Misbehaviour.encode(message).finish() + }; } - }; - function createBaseHeader(): Header { return { signedHeader: undefined, validatorSet: undefined, - trustedHeight: undefined, + trustedHeight: Height.fromPartial({}), trustedValidators: undefined }; } - export const Header = { - encode(message: Header, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/ibc.lightclients.tendermint.v1.Header", + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedHeader !== undefined) { SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); } - if (message.validatorSet !== undefined) { ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); } - if (message.trustedHeight !== undefined) { Height.encode(message.trustedHeight, writer.uint32(26).fork()).ldelim(); } - if (message.trustedValidators !== undefined) { ValidatorSet.encode(message.trustedValidators, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Header { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHeader(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signedHeader = SignedHeader.decode(reader, reader.uint32()); break; - case 2: message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); break; - case 3: message.trustedHeight = Height.decode(reader, reader.uint32()); break; - case 4: message.trustedValidators = ValidatorSet.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial
): Header { + fromPartial(object: Partial
): Header { const message = createBaseHeader(); 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; message.trustedHeight = object.trustedHeight !== undefined && object.trustedHeight !== null ? Height.fromPartial(object.trustedHeight) : undefined; message.trustedValidators = object.trustedValidators !== undefined && object.trustedValidators !== null ? ValidatorSet.fromPartial(object.trustedValidators) : undefined; return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.signed_header !== undefined && object.signed_header !== null) { + message.signedHeader = SignedHeader.fromAmino(object.signed_header); + } + if (object.validator_set !== undefined && object.validator_set !== null) { + message.validatorSet = ValidatorSet.fromAmino(object.validator_set); + } + if (object.trusted_height !== undefined && object.trusted_height !== null) { + message.trustedHeight = Height.fromAmino(object.trusted_height); + } + if (object.trusted_validators !== undefined && object.trusted_validators !== null) { + message.trustedValidators = ValidatorSet.fromAmino(object.trusted_validators); + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.signed_header = message.signedHeader ? SignedHeader.toAmino(message.signedHeader) : undefined; + obj.validator_set = message.validatorSet ? ValidatorSet.toAmino(message.validatorSet) : undefined; + obj.trusted_height = message.trustedHeight ? Height.toAmino(message.trustedHeight) : {}; + obj.trusted_validators = message.trustedValidators ? ValidatorSet.toAmino(message.trustedValidators) : undefined; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + toAminoMsg(message: Header): HeaderAminoMsg { + return { + type: "cosmos-sdk/Header", + value: Header.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.Header", + value: Header.encode(message).finish() + }; } - }; - function createBaseFraction(): Fraction { return { - numerator: Long.UZERO, - denominator: Long.UZERO + numerator: BigInt(0), + denominator: BigInt(0) }; } - export const Fraction = { - encode(message: Fraction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.numerator.isZero()) { + typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", + encode(message: Fraction, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.numerator !== BigInt(0)) { writer.uint32(8).uint64(message.numerator); } - - if (!message.denominator.isZero()) { + if (message.denominator !== BigInt(0)) { writer.uint32(16).uint64(message.denominator); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Fraction { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Fraction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFraction(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.numerator = (reader.uint64() as Long); + message.numerator = reader.uint64(); break; - case 2: - message.denominator = (reader.uint64() as Long); + message.denominator = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Fraction { + fromPartial(object: Partial): Fraction { const message = createBaseFraction(); - message.numerator = object.numerator !== undefined && object.numerator !== null ? Long.fromValue(object.numerator) : Long.UZERO; - message.denominator = object.denominator !== undefined && object.denominator !== null ? Long.fromValue(object.denominator) : Long.UZERO; + message.numerator = object.numerator !== undefined && object.numerator !== null ? BigInt(object.numerator.toString()) : BigInt(0); + message.denominator = object.denominator !== undefined && object.denominator !== null ? BigInt(object.denominator.toString()) : BigInt(0); return message; + }, + fromAmino(object: FractionAmino): Fraction { + const message = createBaseFraction(); + if (object.numerator !== undefined && object.numerator !== null) { + message.numerator = BigInt(object.numerator); + } + if (object.denominator !== undefined && object.denominator !== null) { + message.denominator = BigInt(object.denominator); + } + return message; + }, + toAmino(message: Fraction): FractionAmino { + const obj: any = {}; + obj.numerator = message.numerator ? message.numerator.toString() : undefined; + obj.denominator = message.denominator ? message.denominator.toString() : undefined; + return obj; + }, + fromAminoMsg(object: FractionAminoMsg): Fraction { + return Fraction.fromAmino(object.value); + }, + toAminoMsg(message: Fraction): FractionAminoMsg { + return { + type: "cosmos-sdk/Fraction", + value: Fraction.toAmino(message) + }; + }, + fromProtoMsg(message: FractionProtoMsg): Fraction { + return Fraction.decode(message.value); + }, + toProto(message: Fraction): Uint8Array { + return Fraction.encode(message).finish(); + }, + toProtoMsg(message: Fraction): FractionProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", + value: Fraction.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/ics23/bundle.ts b/src/codegen/ics23/bundle.ts index dcacaf2..30bc1c5 100644 --- a/src/codegen/ics23/bundle.ts +++ b/src/codegen/ics23/bundle.ts @@ -1,3 +1,4 @@ import * as _0 from "../confio/proofs"; -export const ics23 = { ..._0 +export const ics23 = { + ..._0 }; \ No newline at end of file diff --git a/src/codegen/index.ts b/src/codegen/index.ts index b396dd1..ca124a1 100644 --- a/src/codegen/index.ts +++ b/src/codegen/index.ts @@ -1,5 +1,5 @@ /** - * This file and any referenced files were automatically generated by @osmonauts/telescope@0.75.0 + * This file and any referenced files were automatically generated by @cosmology/telescope@1.3.2 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ @@ -14,4 +14,7 @@ export * from "./ibc/bundle"; export * from "./ibc/client"; export * from "./tendermint/bundle"; export * from "./umee/bundle"; -export * from "./umee/client"; \ No newline at end of file +export * from "./umee/client"; +export * from "./varint"; +export * from "./utf8"; +export * from "./binary"; \ No newline at end of file diff --git a/src/codegen/tendermint/abci/types.ts b/src/codegen/tendermint/abci/types.ts index 5248d71..e621884 100644 --- a/src/codegen/tendermint/abci/types.ts +++ b/src/codegen/tendermint/abci/types.ts @@ -1,30 +1,25 @@ import { Timestamp } from "../../google/protobuf/timestamp"; -import { Header, HeaderSDKType } from "../types/types"; -import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; -import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; -import { PublicKey, PublicKeySDKType } from "../crypto/keys"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long, toTimestamp, fromTimestamp } from "../../helpers"; +import { Header, HeaderAmino, HeaderSDKType } from "../types/types"; +import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "../crypto/proof"; +import { EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType, VersionParams, VersionParamsAmino, VersionParamsSDKType } from "../types/params"; +import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; export enum CheckTxType { NEW = 0, RECHECK = 1, UNRECOGNIZED = -1, } -export enum CheckTxTypeSDKType { - NEW = 0, - RECHECK = 1, - UNRECOGNIZED = -1, -} +export const CheckTxTypeSDKType = CheckTxType; +export const CheckTxTypeAmino = CheckTxType; export function checkTxTypeFromJSON(object: any): CheckTxType { switch (object) { case 0: case "NEW": return CheckTxType.NEW; - case 1: case "RECHECK": return CheckTxType.RECHECK; - case -1: case "UNRECOGNIZED": default: @@ -35,10 +30,8 @@ export function checkTxTypeToJSON(object: CheckTxType): string { switch (object) { case CheckTxType.NEW: return "NEW"; - case CheckTxType.RECHECK: return "RECHECK"; - case CheckTxType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -47,69 +40,40 @@ export function checkTxTypeToJSON(object: CheckTxType): string { 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 enum ResponseOfferSnapshot_ResultSDKType { - /** UNKNOWN - Unknown result, abort all snapshot restoration */ - UNKNOWN = 0, - /** ACCEPT - Snapshot accepted, apply chunks */ ACCEPT = 1, - /** ABORT - Abort all snapshot restoration */ ABORT = 2, - /** REJECT - Reject this specific snapshot, try others */ REJECT = 3, - /** REJECT_FORMAT - Reject all snapshots of this format, try others */ REJECT_FORMAT = 4, - /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ REJECT_SENDER = 5, UNRECOGNIZED = -1, } +export const ResponseOfferSnapshot_ResultSDKType = ResponseOfferSnapshot_Result; +export const ResponseOfferSnapshot_ResultAmino = ResponseOfferSnapshot_Result; export function responseOfferSnapshot_ResultFromJSON(object: any): ResponseOfferSnapshot_Result { switch (object) { case 0: case "UNKNOWN": return ResponseOfferSnapshot_Result.UNKNOWN; - case 1: case "ACCEPT": return ResponseOfferSnapshot_Result.ACCEPT; - case 2: case "ABORT": return ResponseOfferSnapshot_Result.ABORT; - case 3: case "REJECT": return ResponseOfferSnapshot_Result.REJECT; - case 4: case "REJECT_FORMAT": return ResponseOfferSnapshot_Result.REJECT_FORMAT; - case 5: case "REJECT_SENDER": return ResponseOfferSnapshot_Result.REJECT_SENDER; - case -1: case "UNRECOGNIZED": default: @@ -120,22 +84,16 @@ export function responseOfferSnapshot_ResultToJSON(object: ResponseOfferSnapshot 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"; @@ -144,69 +102,40 @@ export function responseOfferSnapshot_ResultToJSON(object: ResponseOfferSnapshot 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 enum ResponseApplySnapshotChunk_ResultSDKType { - /** UNKNOWN - Unknown result, abort all snapshot restoration */ - UNKNOWN = 0, - /** ACCEPT - Chunk successfully accepted */ ACCEPT = 1, - /** ABORT - Abort all snapshot restoration */ ABORT = 2, - /** RETRY - Retry chunk (combine with refetch and reject) */ RETRY = 3, - /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ RETRY_SNAPSHOT = 4, - /** REJECT_SNAPSHOT - Reject this snapshot, try others */ REJECT_SNAPSHOT = 5, UNRECOGNIZED = -1, } +export const ResponseApplySnapshotChunk_ResultSDKType = ResponseApplySnapshotChunk_Result; +export const ResponseApplySnapshotChunk_ResultAmino = ResponseApplySnapshotChunk_Result; export function responseApplySnapshotChunk_ResultFromJSON(object: any): ResponseApplySnapshotChunk_Result { switch (object) { case 0: case "UNKNOWN": return ResponseApplySnapshotChunk_Result.UNKNOWN; - case 1: case "ACCEPT": return ResponseApplySnapshotChunk_Result.ACCEPT; - case 2: case "ABORT": return ResponseApplySnapshotChunk_Result.ABORT; - case 3: case "RETRY": return ResponseApplySnapshotChunk_Result.RETRY; - case 4: case "RETRY_SNAPSHOT": return ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT; - case 5: case "REJECT_SNAPSHOT": return ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT; - case -1: case "UNRECOGNIZED": default: @@ -217,22 +146,16 @@ export function responseApplySnapshotChunk_ResultToJSON(object: ResponseApplySna 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"; @@ -244,26 +167,19 @@ export enum EvidenceType { LIGHT_CLIENT_ATTACK = 2, UNRECOGNIZED = -1, } -export enum EvidenceTypeSDKType { - UNKNOWN = 0, - DUPLICATE_VOTE = 1, - LIGHT_CLIENT_ATTACK = 2, - UNRECOGNIZED = -1, -} +export const EvidenceTypeSDKType = EvidenceType; +export const EvidenceTypeAmino = EvidenceType; export function evidenceTypeFromJSON(object: any): EvidenceType { switch (object) { case 0: case "UNKNOWN": return EvidenceType.UNKNOWN; - case 1: case "DUPLICATE_VOTE": return EvidenceType.DUPLICATE_VOTE; - case 2: case "LIGHT_CLIENT_ATTACK": return EvidenceType.LIGHT_CLIENT_ATTACK; - case -1: case "UNRECOGNIZED": default: @@ -274,13 +190,10 @@ export function evidenceTypeToJSON(object: EvidenceType): string { switch (object) { case EvidenceType.UNKNOWN: return "UNKNOWN"; - case EvidenceType.DUPLICATE_VOTE: return "DUPLICATE_VOTE"; - case EvidenceType.LIGHT_CLIENT_ATTACK: return "LIGHT_CLIENT_ATTACK"; - case EvidenceType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -303,6 +216,31 @@ export interface Request { loadSnapshotChunk?: RequestLoadSnapshotChunk; applySnapshotChunk?: RequestApplySnapshotChunk; } +export interface RequestProtoMsg { + typeUrl: "/tendermint.abci.Request"; + value: Uint8Array; +} +export interface RequestAmino { + echo?: RequestEchoAmino; + flush?: RequestFlushAmino; + info?: RequestInfoAmino; + set_option?: RequestSetOptionAmino; + init_chain?: RequestInitChainAmino; + query?: RequestQueryAmino; + begin_block?: RequestBeginBlockAmino; + check_tx?: RequestCheckTxAmino; + deliver_tx?: RequestDeliverTxAmino; + end_block?: RequestEndBlockAmino; + commit?: RequestCommitAmino; + list_snapshots?: RequestListSnapshotsAmino; + offer_snapshot?: RequestOfferSnapshotAmino; + load_snapshot_chunk?: RequestLoadSnapshotChunkAmino; + apply_snapshot_chunk?: RequestApplySnapshotChunkAmino; +} +export interface RequestAminoMsg { + type: "/tendermint.abci.Request"; + value: RequestAmino; +} export interface RequestSDKType { echo?: RequestEchoSDKType; flush?: RequestFlushSDKType; @@ -323,142 +261,314 @@ export interface RequestSDKType { export interface RequestEcho { message: string; } +export interface RequestEchoProtoMsg { + typeUrl: "/tendermint.abci.RequestEcho"; + value: Uint8Array; +} +export interface RequestEchoAmino { + message?: string; +} +export interface RequestEchoAminoMsg { + type: "/tendermint.abci.RequestEcho"; + value: RequestEchoAmino; +} export interface RequestEchoSDKType { message: string; } export interface RequestFlush {} +export interface RequestFlushProtoMsg { + typeUrl: "/tendermint.abci.RequestFlush"; + value: Uint8Array; +} +export interface RequestFlushAmino {} +export interface RequestFlushAminoMsg { + type: "/tendermint.abci.RequestFlush"; + value: RequestFlushAmino; +} export interface RequestFlushSDKType {} export interface RequestInfo { version: string; - blockVersion: Long; - p2pVersion: Long; + blockVersion: bigint; + p2pVersion: bigint; +} +export interface RequestInfoProtoMsg { + typeUrl: "/tendermint.abci.RequestInfo"; + value: Uint8Array; +} +export interface RequestInfoAmino { + version?: string; + block_version?: string; + p2p_version?: string; +} +export interface RequestInfoAminoMsg { + type: "/tendermint.abci.RequestInfo"; + value: RequestInfoAmino; } export interface RequestInfoSDKType { version: string; - block_version: Long; - p2p_version: Long; + block_version: bigint; + p2p_version: bigint; } /** nondeterministic */ - export interface RequestSetOption { key: string; value: string; } +export interface RequestSetOptionProtoMsg { + typeUrl: "/tendermint.abci.RequestSetOption"; + value: Uint8Array; +} +/** nondeterministic */ +export interface RequestSetOptionAmino { + key?: string; + value?: string; +} +export interface RequestSetOptionAminoMsg { + type: "/tendermint.abci.RequestSetOption"; + value: RequestSetOptionAmino; +} /** nondeterministic */ - export interface RequestSetOptionSDKType { key: string; value: string; } export interface RequestInitChain { - time?: Date; + time: Date; chainId: string; consensusParams?: ConsensusParams; validators: ValidatorUpdate[]; appStateBytes: Uint8Array; - initialHeight: Long; + initialHeight: bigint; +} +export interface RequestInitChainProtoMsg { + typeUrl: "/tendermint.abci.RequestInitChain"; + value: Uint8Array; +} +export interface RequestInitChainAmino { + time?: string; + chain_id?: string; + consensus_params?: ConsensusParamsAmino; + validators?: ValidatorUpdateAmino[]; + app_state_bytes?: string; + initial_height?: string; +} +export interface RequestInitChainAminoMsg { + type: "/tendermint.abci.RequestInitChain"; + value: RequestInitChainAmino; } export interface RequestInitChainSDKType { - time?: Date; + time: Date; chain_id: string; consensus_params?: ConsensusParamsSDKType; validators: ValidatorUpdateSDKType[]; app_state_bytes: Uint8Array; - initial_height: Long; + initial_height: bigint; } export interface RequestQuery { data: Uint8Array; path: string; - height: Long; + height: bigint; prove: boolean; } +export interface RequestQueryProtoMsg { + typeUrl: "/tendermint.abci.RequestQuery"; + value: Uint8Array; +} +export interface RequestQueryAmino { + data?: string; + path?: string; + height?: string; + prove?: boolean; +} +export interface RequestQueryAminoMsg { + type: "/tendermint.abci.RequestQuery"; + value: RequestQueryAmino; +} export interface RequestQuerySDKType { data: Uint8Array; path: string; - height: Long; + height: bigint; prove: boolean; } export interface RequestBeginBlock { hash: Uint8Array; - header?: Header; - lastCommitInfo?: LastCommitInfo; + header: Header; + lastCommitInfo: LastCommitInfo; byzantineValidators: Evidence[]; } +export interface RequestBeginBlockProtoMsg { + typeUrl: "/tendermint.abci.RequestBeginBlock"; + value: Uint8Array; +} +export interface RequestBeginBlockAmino { + hash?: string; + header?: HeaderAmino; + last_commit_info?: LastCommitInfoAmino; + byzantine_validators?: EvidenceAmino[]; +} +export interface RequestBeginBlockAminoMsg { + type: "/tendermint.abci.RequestBeginBlock"; + value: RequestBeginBlockAmino; +} export interface RequestBeginBlockSDKType { hash: Uint8Array; - header?: HeaderSDKType; - last_commit_info?: LastCommitInfoSDKType; + header: HeaderSDKType; + last_commit_info: LastCommitInfoSDKType; byzantine_validators: EvidenceSDKType[]; } export interface RequestCheckTx { tx: Uint8Array; type: CheckTxType; } +export interface RequestCheckTxProtoMsg { + typeUrl: "/tendermint.abci.RequestCheckTx"; + value: Uint8Array; +} +export interface RequestCheckTxAmino { + tx?: string; + type?: CheckTxType; +} +export interface RequestCheckTxAminoMsg { + type: "/tendermint.abci.RequestCheckTx"; + value: RequestCheckTxAmino; +} export interface RequestCheckTxSDKType { tx: Uint8Array; - type: CheckTxTypeSDKType; + type: CheckTxType; } export interface RequestDeliverTx { tx: Uint8Array; } +export interface RequestDeliverTxProtoMsg { + typeUrl: "/tendermint.abci.RequestDeliverTx"; + value: Uint8Array; +} +export interface RequestDeliverTxAmino { + tx?: string; +} +export interface RequestDeliverTxAminoMsg { + type: "/tendermint.abci.RequestDeliverTx"; + value: RequestDeliverTxAmino; +} export interface RequestDeliverTxSDKType { tx: Uint8Array; } export interface RequestEndBlock { - height: Long; + height: bigint; +} +export interface RequestEndBlockProtoMsg { + typeUrl: "/tendermint.abci.RequestEndBlock"; + value: Uint8Array; +} +export interface RequestEndBlockAmino { + height?: string; +} +export interface RequestEndBlockAminoMsg { + type: "/tendermint.abci.RequestEndBlock"; + value: RequestEndBlockAmino; } export interface RequestEndBlockSDKType { - height: Long; + height: bigint; } export interface RequestCommit {} +export interface RequestCommitProtoMsg { + typeUrl: "/tendermint.abci.RequestCommit"; + value: Uint8Array; +} +export interface RequestCommitAmino {} +export interface RequestCommitAminoMsg { + type: "/tendermint.abci.RequestCommit"; + value: RequestCommitAmino; +} export interface RequestCommitSDKType {} /** lists available snapshots */ - export interface RequestListSnapshots {} +export interface RequestListSnapshotsProtoMsg { + typeUrl: "/tendermint.abci.RequestListSnapshots"; + value: Uint8Array; +} +/** lists available snapshots */ +export interface RequestListSnapshotsAmino {} +export interface RequestListSnapshotsAminoMsg { + type: "/tendermint.abci.RequestListSnapshots"; + value: RequestListSnapshotsAmino; +} /** lists available snapshots */ - export interface RequestListSnapshotsSDKType {} /** offers a snapshot to the application */ - export interface RequestOfferSnapshot { /** snapshot offered by peers */ snapshot?: Snapshot; /** light client-verified app hash for snapshot height */ - appHash: Uint8Array; } +export interface RequestOfferSnapshotProtoMsg { + typeUrl: "/tendermint.abci.RequestOfferSnapshot"; + value: Uint8Array; +} /** offers a snapshot to the application */ - -export interface RequestOfferSnapshotSDKType { +export interface RequestOfferSnapshotAmino { /** snapshot offered by peers */ - snapshot?: SnapshotSDKType; + snapshot?: SnapshotAmino; /** light client-verified app hash for snapshot height */ - + app_hash?: string; +} +export interface RequestOfferSnapshotAminoMsg { + type: "/tendermint.abci.RequestOfferSnapshot"; + value: RequestOfferSnapshotAmino; +} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshotSDKType { + snapshot?: SnapshotSDKType; app_hash: Uint8Array; } /** loads a snapshot chunk */ - export interface RequestLoadSnapshotChunk { - height: Long; + height: bigint; format: number; chunk: number; } +export interface RequestLoadSnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk"; + value: Uint8Array; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunkAmino { + height?: string; + format?: number; + chunk?: number; +} +export interface RequestLoadSnapshotChunkAminoMsg { + type: "/tendermint.abci.RequestLoadSnapshotChunk"; + value: RequestLoadSnapshotChunkAmino; +} /** loads a snapshot chunk */ - export interface RequestLoadSnapshotChunkSDKType { - height: Long; + height: bigint; format: number; chunk: number; } /** Applies a snapshot chunk */ - export interface RequestApplySnapshotChunk { index: number; chunk: Uint8Array; sender: string; } +export interface RequestApplySnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk"; + value: Uint8Array; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunkAmino { + index?: number; + chunk?: string; + sender?: string; +} +export interface RequestApplySnapshotChunkAminoMsg { + type: "/tendermint.abci.RequestApplySnapshotChunk"; + value: RequestApplySnapshotChunkAmino; +} /** Applies a snapshot chunk */ - export interface RequestApplySnapshotChunkSDKType { index: number; chunk: Uint8Array; @@ -482,6 +592,32 @@ export interface Response { loadSnapshotChunk?: ResponseLoadSnapshotChunk; applySnapshotChunk?: ResponseApplySnapshotChunk; } +export interface ResponseProtoMsg { + typeUrl: "/tendermint.abci.Response"; + value: Uint8Array; +} +export interface ResponseAmino { + exception?: ResponseExceptionAmino; + echo?: ResponseEchoAmino; + flush?: ResponseFlushAmino; + info?: ResponseInfoAmino; + set_option?: ResponseSetOptionAmino; + init_chain?: ResponseInitChainAmino; + query?: ResponseQueryAmino; + begin_block?: ResponseBeginBlockAmino; + check_tx?: ResponseCheckTxAmino; + deliver_tx?: ResponseDeliverTxAmino; + end_block?: ResponseEndBlockAmino; + commit?: ResponseCommitAmino; + list_snapshots?: ResponseListSnapshotsAmino; + offer_snapshot?: ResponseOfferSnapshotAmino; + load_snapshot_chunk?: ResponseLoadSnapshotChunkAmino; + apply_snapshot_chunk?: ResponseApplySnapshotChunkAmino; +} +export interface ResponseAminoMsg { + type: "/tendermint.abci.Response"; + value: ResponseAmino; +} export interface ResponseSDKType { exception?: ResponseExceptionSDKType; echo?: ResponseEchoSDKType; @@ -501,52 +637,107 @@ export interface ResponseSDKType { apply_snapshot_chunk?: ResponseApplySnapshotChunkSDKType; } /** nondeterministic */ - export interface ResponseException { error: string; } +export interface ResponseExceptionProtoMsg { + typeUrl: "/tendermint.abci.ResponseException"; + value: Uint8Array; +} +/** nondeterministic */ +export interface ResponseExceptionAmino { + error?: string; +} +export interface ResponseExceptionAminoMsg { + type: "/tendermint.abci.ResponseException"; + value: ResponseExceptionAmino; +} /** nondeterministic */ - export interface ResponseExceptionSDKType { error: string; } export interface ResponseEcho { message: string; } +export interface ResponseEchoProtoMsg { + typeUrl: "/tendermint.abci.ResponseEcho"; + value: Uint8Array; +} +export interface ResponseEchoAmino { + message?: string; +} +export interface ResponseEchoAminoMsg { + type: "/tendermint.abci.ResponseEcho"; + value: ResponseEchoAmino; +} export interface ResponseEchoSDKType { message: string; } export interface ResponseFlush {} +export interface ResponseFlushProtoMsg { + typeUrl: "/tendermint.abci.ResponseFlush"; + value: Uint8Array; +} +export interface ResponseFlushAmino {} +export interface ResponseFlushAminoMsg { + type: "/tendermint.abci.ResponseFlush"; + value: ResponseFlushAmino; +} export interface ResponseFlushSDKType {} export interface ResponseInfo { data: string; version: string; - appVersion: Long; - lastBlockHeight: Long; + appVersion: bigint; + lastBlockHeight: bigint; lastBlockAppHash: Uint8Array; } +export interface ResponseInfoProtoMsg { + typeUrl: "/tendermint.abci.ResponseInfo"; + value: Uint8Array; +} +export interface ResponseInfoAmino { + data?: string; + version?: string; + app_version?: string; + last_block_height?: string; + last_block_app_hash?: string; +} +export interface ResponseInfoAminoMsg { + type: "/tendermint.abci.ResponseInfo"; + value: ResponseInfoAmino; +} export interface ResponseInfoSDKType { data: string; version: string; - app_version: Long; - last_block_height: Long; + app_version: bigint; + last_block_height: bigint; last_block_app_hash: Uint8Array; } /** nondeterministic */ - export interface ResponseSetOption { code: number; /** bytes data = 2; */ - log: string; info: string; } +export interface ResponseSetOptionProtoMsg { + typeUrl: "/tendermint.abci.ResponseSetOption"; + value: Uint8Array; +} +/** nondeterministic */ +export interface ResponseSetOptionAmino { + code?: number; + /** bytes data = 2; */ + log?: string; + info?: string; +} +export interface ResponseSetOptionAminoMsg { + type: "/tendermint.abci.ResponseSetOption"; + value: ResponseSetOptionAmino; +} /** nondeterministic */ - export interface ResponseSetOptionSDKType { code: number; - /** bytes data = 2; */ - log: string; info: string; } @@ -555,6 +746,19 @@ export interface ResponseInitChain { validators: ValidatorUpdate[]; appHash: Uint8Array; } +export interface ResponseInitChainProtoMsg { + typeUrl: "/tendermint.abci.ResponseInitChain"; + value: Uint8Array; +} +export interface ResponseInitChainAmino { + consensus_params?: ConsensusParamsAmino; + validators?: ValidatorUpdateAmino[]; + app_hash?: string; +} +export interface ResponseInitChainAminoMsg { + type: "/tendermint.abci.ResponseInitChain"; + value: ResponseInitChainAmino; +} export interface ResponseInitChainSDKType { consensus_params?: ConsensusParamsSDKType; validators: ValidatorUpdateSDKType[]; @@ -563,36 +767,62 @@ export interface ResponseInitChainSDKType { export interface ResponseQuery { code: number; /** bytes data = 2; // use "value" instead. */ - log: string; /** nondeterministic */ - info: string; - index: Long; + index: bigint; key: Uint8Array; value: Uint8Array; proofOps?: ProofOps; - height: Long; + height: bigint; codespace: string; } +export interface ResponseQueryProtoMsg { + typeUrl: "/tendermint.abci.ResponseQuery"; + value: Uint8Array; +} +export interface ResponseQueryAmino { + code?: number; + /** bytes data = 2; // use "value" instead. */ + log?: string; + /** nondeterministic */ + info?: string; + index?: string; + key?: string; + value?: string; + proof_ops?: ProofOpsAmino; + height?: string; + codespace?: string; +} +export interface ResponseQueryAminoMsg { + type: "/tendermint.abci.ResponseQuery"; + value: ResponseQueryAmino; +} export interface ResponseQuerySDKType { code: number; - /** bytes data = 2; // use "value" instead. */ - log: string; - /** nondeterministic */ - info: string; - index: Long; + index: bigint; key: Uint8Array; value: Uint8Array; proof_ops?: ProofOpsSDKType; - height: Long; + height: bigint; codespace: string; } export interface ResponseBeginBlock { events: Event[]; } +export interface ResponseBeginBlockProtoMsg { + typeUrl: "/tendermint.abci.ResponseBeginBlock"; + value: Uint8Array; +} +export interface ResponseBeginBlockAmino { + events?: EventAmino[]; +} +export interface ResponseBeginBlockAminoMsg { + type: "/tendermint.abci.ResponseBeginBlock"; + value: ResponseBeginBlockAmino; +} export interface ResponseBeginBlockSDKType { events: EventSDKType[]; } @@ -600,27 +830,41 @@ export interface ResponseCheckTx { code: number; data: Uint8Array; /** nondeterministic */ - log: string; /** nondeterministic */ - info: string; - gasWanted: Long; - gasUsed: Long; + gasWanted: bigint; + gasUsed: bigint; events: Event[]; codespace: string; } +export interface ResponseCheckTxProtoMsg { + typeUrl: "/tendermint.abci.ResponseCheckTx"; + value: Uint8Array; +} +export interface ResponseCheckTxAmino { + code?: number; + data?: string; + /** nondeterministic */ + log?: string; + /** nondeterministic */ + info?: string; + gas_wanted?: string; + gas_used?: string; + events?: EventAmino[]; + codespace?: string; +} +export interface ResponseCheckTxAminoMsg { + type: "/tendermint.abci.ResponseCheckTx"; + value: ResponseCheckTxAmino; +} export interface ResponseCheckTxSDKType { code: number; data: Uint8Array; - /** nondeterministic */ - log: string; - /** nondeterministic */ - info: string; - gas_wanted: Long; - gas_used: Long; + gas_wanted: bigint; + gas_used: bigint; events: EventSDKType[]; codespace: string; } @@ -628,27 +872,41 @@ export interface ResponseDeliverTx { code: number; data: Uint8Array; /** nondeterministic */ - log: string; /** nondeterministic */ - info: string; - gasWanted: Long; - gasUsed: Long; + gasWanted: bigint; + gasUsed: bigint; events: Event[]; codespace: string; } +export interface ResponseDeliverTxProtoMsg { + typeUrl: "/tendermint.abci.ResponseDeliverTx"; + value: Uint8Array; +} +export interface ResponseDeliverTxAmino { + code?: number; + data?: string; + /** nondeterministic */ + log?: string; + /** nondeterministic */ + info?: string; + gas_wanted?: string; + gas_used?: string; + events?: EventAmino[]; + codespace?: string; +} +export interface ResponseDeliverTxAminoMsg { + type: "/tendermint.abci.ResponseDeliverTx"; + value: ResponseDeliverTxAmino; +} export interface ResponseDeliverTxSDKType { code: number; data: Uint8Array; - /** nondeterministic */ - log: string; - /** nondeterministic */ - info: string; - gas_wanted: Long; - gas_used: Long; + gas_wanted: bigint; + gas_used: bigint; events: EventSDKType[]; codespace: string; } @@ -657,6 +915,19 @@ export interface ResponseEndBlock { consensusParamUpdates?: ConsensusParams; events: Event[]; } +export interface ResponseEndBlockProtoMsg { + typeUrl: "/tendermint.abci.ResponseEndBlock"; + value: Uint8Array; +} +export interface ResponseEndBlockAmino { + validator_updates?: ValidatorUpdateAmino[]; + consensus_param_updates?: ConsensusParamsAmino; + events?: EventAmino[]; +} +export interface ResponseEndBlockAminoMsg { + type: "/tendermint.abci.ResponseEndBlock"; + value: ResponseEndBlockAmino; +} export interface ResponseEndBlockSDKType { validator_updates: ValidatorUpdateSDKType[]; consensus_param_updates?: ConsensusParamsSDKType; @@ -665,65 +936,135 @@ export interface ResponseEndBlockSDKType { export interface ResponseCommit { /** reserve 1 */ data: Uint8Array; - retainHeight: Long; + retainHeight: bigint; } -export interface ResponseCommitSDKType { +export interface ResponseCommitProtoMsg { + typeUrl: "/tendermint.abci.ResponseCommit"; + value: Uint8Array; +} +export interface ResponseCommitAmino { /** reserve 1 */ + data?: string; + retain_height?: string; +} +export interface ResponseCommitAminoMsg { + type: "/tendermint.abci.ResponseCommit"; + value: ResponseCommitAmino; +} +export interface ResponseCommitSDKType { data: Uint8Array; - retain_height: Long; + retain_height: bigint; } export interface ResponseListSnapshots { snapshots: Snapshot[]; } +export interface ResponseListSnapshotsProtoMsg { + typeUrl: "/tendermint.abci.ResponseListSnapshots"; + value: Uint8Array; +} +export interface ResponseListSnapshotsAmino { + snapshots?: SnapshotAmino[]; +} +export interface ResponseListSnapshotsAminoMsg { + type: "/tendermint.abci.ResponseListSnapshots"; + value: ResponseListSnapshotsAmino; +} export interface ResponseListSnapshotsSDKType { snapshots: SnapshotSDKType[]; } export interface ResponseOfferSnapshot { result: ResponseOfferSnapshot_Result; } +export interface ResponseOfferSnapshotProtoMsg { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot"; + value: Uint8Array; +} +export interface ResponseOfferSnapshotAmino { + result?: ResponseOfferSnapshot_Result; +} +export interface ResponseOfferSnapshotAminoMsg { + type: "/tendermint.abci.ResponseOfferSnapshot"; + value: ResponseOfferSnapshotAmino; +} export interface ResponseOfferSnapshotSDKType { - result: ResponseOfferSnapshot_ResultSDKType; + result: ResponseOfferSnapshot_Result; } export interface ResponseLoadSnapshotChunk { chunk: Uint8Array; } +export interface ResponseLoadSnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk"; + value: Uint8Array; +} +export interface ResponseLoadSnapshotChunkAmino { + chunk?: string; +} +export interface ResponseLoadSnapshotChunkAminoMsg { + type: "/tendermint.abci.ResponseLoadSnapshotChunk"; + value: ResponseLoadSnapshotChunkAmino; +} export interface ResponseLoadSnapshotChunkSDKType { chunk: Uint8Array; } export interface ResponseApplySnapshotChunk { result: ResponseApplySnapshotChunk_Result; /** Chunks to refetch and reapply */ - refetchChunks: number[]; /** Chunk senders to reject and ban */ - rejectSenders: string[]; } -export interface ResponseApplySnapshotChunkSDKType { - result: ResponseApplySnapshotChunk_ResultSDKType; +export interface ResponseApplySnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk"; + value: Uint8Array; +} +export interface ResponseApplySnapshotChunkAmino { + result?: ResponseApplySnapshotChunk_Result; /** Chunks to refetch and reapply */ - - refetch_chunks: number[]; + refetch_chunks?: number[]; /** Chunk senders to reject and ban */ - + reject_senders?: string[]; +} +export interface ResponseApplySnapshotChunkAminoMsg { + type: "/tendermint.abci.ResponseApplySnapshotChunk"; + value: ResponseApplySnapshotChunkAmino; +} +export interface ResponseApplySnapshotChunkSDKType { + result: ResponseApplySnapshotChunk_Result; + refetch_chunks: number[]; reject_senders: string[]; } /** * ConsensusParams contains all consensus-relevant parameters * that can be adjusted by the abci app */ - export interface ConsensusParams { block?: BlockParams; evidence?: EvidenceParams; validator?: ValidatorParams; version?: VersionParams; } +export interface ConsensusParamsProtoMsg { + typeUrl: "/tendermint.abci.ConsensusParams"; + value: Uint8Array; +} +/** + * ConsensusParams contains all consensus-relevant parameters + * that can be adjusted by the abci app + */ +export interface ConsensusParamsAmino { + block?: BlockParamsAmino; + evidence?: EvidenceParamsAmino; + validator?: ValidatorParamsAmino; + version?: VersionParamsAmino; +} +export interface ConsensusParamsAminoMsg { + type: "/tendermint.abci.ConsensusParams"; + value: ConsensusParamsAmino; +} /** * ConsensusParams contains all consensus-relevant parameters * that can be adjusted by the abci app */ - export interface ConsensusParamsSDKType { block?: BlockParamsSDKType; evidence?: EvidenceParamsSDKType; @@ -731,27 +1072,48 @@ export interface ConsensusParamsSDKType { version?: VersionParamsSDKType; } /** BlockParams contains limits on the block size. */ - export interface BlockParams { /** Note: must be greater than 0 */ - maxBytes: Long; + maxBytes: bigint; /** Note: must be greater or equal to -1 */ - - maxGas: Long; + maxGas: bigint; +} +export interface BlockParamsProtoMsg { + typeUrl: "/tendermint.abci.BlockParams"; + value: Uint8Array; } /** BlockParams contains limits on the block size. */ - -export interface BlockParamsSDKType { +export interface BlockParamsAmino { /** Note: must be greater than 0 */ - max_bytes: Long; + max_bytes?: string; /** Note: must be greater or equal to -1 */ - - max_gas: Long; + max_gas?: string; +} +export interface BlockParamsAminoMsg { + type: "/tendermint.abci.BlockParams"; + value: BlockParamsAmino; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParamsSDKType { + max_bytes: bigint; + max_gas: bigint; } export interface LastCommitInfo { round: number; votes: VoteInfo[]; } +export interface LastCommitInfoProtoMsg { + typeUrl: "/tendermint.abci.LastCommitInfo"; + value: Uint8Array; +} +export interface LastCommitInfoAmino { + round?: number; + votes?: VoteInfoAmino[]; +} +export interface LastCommitInfoAminoMsg { + type: "/tendermint.abci.LastCommitInfo"; + value: LastCommitInfoAmino; +} export interface LastCommitInfoSDKType { round: number; votes: VoteInfoSDKType[]; @@ -761,37 +1123,62 @@ export interface LastCommitInfoSDKType { * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. * Later, transactions may be queried using these events. */ - export interface Event { type: string; attributes: EventAttribute[]; } +export interface EventProtoMsg { + typeUrl: "/tendermint.abci.Event"; + value: Uint8Array; +} +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface EventAmino { + type?: string; + attributes?: EventAttributeAmino[]; +} +export interface EventAminoMsg { + type: "/tendermint.abci.Event"; + value: EventAmino; +} /** * Event allows application developers to attach additional information to * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. * Later, transactions may be queried using these events. */ - export interface EventSDKType { type: string; attributes: EventAttributeSDKType[]; } /** EventAttribute is a single key-value pair, associated with an event. */ - export interface EventAttribute { key: Uint8Array; value: Uint8Array; /** nondeterministic */ - index: boolean; } +export interface EventAttributeProtoMsg { + typeUrl: "/tendermint.abci.EventAttribute"; + value: Uint8Array; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttributeAmino { + key?: string; + value?: string; + /** nondeterministic */ + index?: boolean; +} +export interface EventAttributeAminoMsg { + type: "/tendermint.abci.EventAttribute"; + value: EventAttributeAmino; +} /** EventAttribute is a single key-value pair, associated with an event. */ - export interface EventAttributeSDKType { key: Uint8Array; value: Uint8Array; - /** nondeterministic */ - index: boolean; } /** @@ -799,27 +1186,43 @@ export interface EventAttributeSDKType { * * One usage is indexing transaction results. */ - export interface TxResult { - height: Long; + height: bigint; index: number; tx: Uint8Array; - result?: ResponseDeliverTx; + result: ResponseDeliverTx; +} +export interface TxResultProtoMsg { + typeUrl: "/tendermint.abci.TxResult"; + value: Uint8Array; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResultAmino { + height?: string; + index?: number; + tx?: string; + result?: ResponseDeliverTxAmino; +} +export interface TxResultAminoMsg { + type: "/tendermint.abci.TxResult"; + value: TxResultAmino; } /** * TxResult contains results of executing the transaction. * * One usage is indexing transaction results. */ - export interface TxResultSDKType { - height: Long; + height: bigint; index: number; tx: Uint8Array; - result?: ResponseDeliverTxSDKType; + result: ResponseDeliverTxSDKType; } /** Validator */ - export interface Validator { /** * The first 20 bytes of SHA256(public key) @@ -827,116 +1230,161 @@ export interface Validator { */ address: Uint8Array; /** The voting power */ - - power: Long; + power: bigint; +} +export interface ValidatorProtoMsg { + typeUrl: "/tendermint.abci.Validator"; + value: Uint8Array; } /** Validator */ - -export interface ValidatorSDKType { +export interface ValidatorAmino { /** * The first 20 bytes of SHA256(public key) * PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ - address: Uint8Array; + address?: string; /** The voting power */ - - power: Long; + power?: string; +} +export interface ValidatorAminoMsg { + type: "/tendermint.abci.Validator"; + value: ValidatorAmino; +} +/** Validator */ +export interface ValidatorSDKType { + address: Uint8Array; + power: bigint; } /** ValidatorUpdate */ - export interface ValidatorUpdate { - pubKey?: PublicKey; - power: Long; + pubKey: PublicKey; + power: bigint; +} +export interface ValidatorUpdateProtoMsg { + typeUrl: "/tendermint.abci.ValidatorUpdate"; + value: Uint8Array; +} +/** ValidatorUpdate */ +export interface ValidatorUpdateAmino { + pub_key?: PublicKeyAmino; + power?: string; +} +export interface ValidatorUpdateAminoMsg { + type: "/tendermint.abci.ValidatorUpdate"; + value: ValidatorUpdateAmino; } /** ValidatorUpdate */ - export interface ValidatorUpdateSDKType { - pub_key?: PublicKeySDKType; - power: Long; + pub_key: PublicKeySDKType; + power: bigint; } /** VoteInfo */ - export interface VoteInfo { - validator?: Validator; + validator: Validator; signedLastBlock: boolean; } +export interface VoteInfoProtoMsg { + typeUrl: "/tendermint.abci.VoteInfo"; + value: Uint8Array; +} +/** VoteInfo */ +export interface VoteInfoAmino { + validator?: ValidatorAmino; + signed_last_block?: boolean; +} +export interface VoteInfoAminoMsg { + type: "/tendermint.abci.VoteInfo"; + value: VoteInfoAmino; +} /** VoteInfo */ - export interface VoteInfoSDKType { - validator?: ValidatorSDKType; + validator: ValidatorSDKType; signed_last_block: boolean; } export interface Evidence { type: EvidenceType; /** The offending validator */ - - validator?: Validator; + validator: Validator; /** The height when the offense occurred */ - - height: Long; + height: bigint; /** The corresponding time where the offense occurred */ - - time?: Date; + time: Date; /** * Total voting power of the validator set in case the ABCI application does * not store historical validators. * https://github.com/tendermint/tendermint/issues/4581 */ - - totalVotingPower: Long; + totalVotingPower: bigint; } -export interface EvidenceSDKType { - type: EvidenceTypeSDKType; +export interface EvidenceProtoMsg { + typeUrl: "/tendermint.abci.Evidence"; + value: Uint8Array; +} +export interface EvidenceAmino { + type?: EvidenceType; /** The offending validator */ - - validator?: ValidatorSDKType; + validator?: ValidatorAmino; /** The height when the offense occurred */ - - height: Long; + height?: string; /** The corresponding time where the offense occurred */ - - time?: Date; + time?: string; /** * Total voting power of the validator set in case the ABCI application does * not store historical validators. * https://github.com/tendermint/tendermint/issues/4581 */ - - total_voting_power: Long; + total_voting_power?: string; +} +export interface EvidenceAminoMsg { + type: "/tendermint.abci.Evidence"; + value: EvidenceAmino; +} +export interface EvidenceSDKType { + type: EvidenceType; + validator: ValidatorSDKType; + height: bigint; + time: Date; + total_voting_power: bigint; } export interface Snapshot { /** The height at which the snapshot was taken */ - height: Long; + height: bigint; /** The application-specific snapshot format */ - format: number; /** Number of chunks in the snapshot */ - chunks: number; /** Arbitrary snapshot hash, equal only if identical */ - hash: Uint8Array; /** Arbitrary application metadata */ - metadata: Uint8Array; } -export interface SnapshotSDKType { +export interface SnapshotProtoMsg { + typeUrl: "/tendermint.abci.Snapshot"; + value: Uint8Array; +} +export interface SnapshotAmino { /** The height at which the snapshot was taken */ - height: Long; + height?: string; /** The application-specific snapshot format */ - - format: number; + format?: number; /** Number of chunks in the snapshot */ - - chunks: number; + chunks?: number; /** Arbitrary snapshot hash, equal only if identical */ - - hash: Uint8Array; + hash?: string; /** Arbitrary application metadata */ - + metadata?: string; +} +export interface SnapshotAminoMsg { + type: "/tendermint.abci.Snapshot"; + value: SnapshotAmino; +} +export interface SnapshotSDKType { + height: bigint; + format: number; + chunks: number; + hash: Uint8Array; metadata: Uint8Array; } - function createBaseRequest(): Request { return { echo: undefined, @@ -956,151 +1404,116 @@ function createBaseRequest(): Request { applySnapshotChunk: undefined }; } - export const Request = { - encode(message: Request, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.Request", + encode(message: Request, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.echo !== undefined) { RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); } - if (message.flush !== undefined) { RequestFlush.encode(message.flush, writer.uint32(18).fork()).ldelim(); } - if (message.info !== undefined) { RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim(); } - if (message.setOption !== undefined) { RequestSetOption.encode(message.setOption, writer.uint32(34).fork()).ldelim(); } - if (message.initChain !== undefined) { RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).ldelim(); } - if (message.query !== undefined) { RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); } - if (message.beginBlock !== undefined) { RequestBeginBlock.encode(message.beginBlock, writer.uint32(58).fork()).ldelim(); } - if (message.checkTx !== undefined) { RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim(); } - if (message.deliverTx !== undefined) { RequestDeliverTx.encode(message.deliverTx, writer.uint32(74).fork()).ldelim(); } - if (message.endBlock !== undefined) { RequestEndBlock.encode(message.endBlock, writer.uint32(82).fork()).ldelim(); } - if (message.commit !== undefined) { RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); } - if (message.listSnapshots !== undefined) { RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).ldelim(); } - if (message.offerSnapshot !== undefined) { RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).ldelim(); } - if (message.loadSnapshotChunk !== undefined) { RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).ldelim(); } - if (message.applySnapshotChunk !== undefined) { RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Request { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequest(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.echo = RequestEcho.decode(reader, reader.uint32()); break; - case 2: message.flush = RequestFlush.decode(reader, reader.uint32()); break; - case 3: message.info = RequestInfo.decode(reader, reader.uint32()); break; - case 4: message.setOption = RequestSetOption.decode(reader, reader.uint32()); break; - case 5: message.initChain = RequestInitChain.decode(reader, reader.uint32()); break; - case 6: message.query = RequestQuery.decode(reader, reader.uint32()); break; - case 7: message.beginBlock = RequestBeginBlock.decode(reader, reader.uint32()); break; - case 8: message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); break; - case 9: message.deliverTx = RequestDeliverTx.decode(reader, reader.uint32()); break; - case 10: message.endBlock = RequestEndBlock.decode(reader, reader.uint32()); break; - case 11: message.commit = RequestCommit.decode(reader, reader.uint32()); break; - case 12: message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); break; - case 13: message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); break; - case 14: message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); break; - case 15: message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Request { + fromPartial(object: Partial): 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; @@ -1118,787 +1531,1154 @@ export const Request = { 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; return message; + }, + fromAmino(object: RequestAmino): Request { + const message = createBaseRequest(); + if (object.echo !== undefined && object.echo !== null) { + message.echo = RequestEcho.fromAmino(object.echo); + } + if (object.flush !== undefined && object.flush !== null) { + message.flush = RequestFlush.fromAmino(object.flush); + } + if (object.info !== undefined && object.info !== null) { + message.info = RequestInfo.fromAmino(object.info); + } + if (object.set_option !== undefined && object.set_option !== null) { + message.setOption = RequestSetOption.fromAmino(object.set_option); + } + if (object.init_chain !== undefined && object.init_chain !== null) { + message.initChain = RequestInitChain.fromAmino(object.init_chain); + } + if (object.query !== undefined && object.query !== null) { + message.query = RequestQuery.fromAmino(object.query); + } + if (object.begin_block !== undefined && object.begin_block !== null) { + message.beginBlock = RequestBeginBlock.fromAmino(object.begin_block); + } + if (object.check_tx !== undefined && object.check_tx !== null) { + message.checkTx = RequestCheckTx.fromAmino(object.check_tx); + } + if (object.deliver_tx !== undefined && object.deliver_tx !== null) { + message.deliverTx = RequestDeliverTx.fromAmino(object.deliver_tx); + } + if (object.end_block !== undefined && object.end_block !== null) { + message.endBlock = RequestEndBlock.fromAmino(object.end_block); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = RequestCommit.fromAmino(object.commit); + } + if (object.list_snapshots !== undefined && object.list_snapshots !== null) { + message.listSnapshots = RequestListSnapshots.fromAmino(object.list_snapshots); + } + if (object.offer_snapshot !== undefined && object.offer_snapshot !== null) { + message.offerSnapshot = RequestOfferSnapshot.fromAmino(object.offer_snapshot); + } + if (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) { + message.loadSnapshotChunk = RequestLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk); + } + if (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) { + message.applySnapshotChunk = RequestApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk); + } + return message; + }, + toAmino(message: Request): RequestAmino { + const obj: any = {}; + obj.echo = message.echo ? RequestEcho.toAmino(message.echo) : undefined; + obj.flush = message.flush ? RequestFlush.toAmino(message.flush) : undefined; + obj.info = message.info ? RequestInfo.toAmino(message.info) : undefined; + obj.set_option = message.setOption ? RequestSetOption.toAmino(message.setOption) : undefined; + obj.init_chain = message.initChain ? RequestInitChain.toAmino(message.initChain) : undefined; + obj.query = message.query ? RequestQuery.toAmino(message.query) : undefined; + obj.begin_block = message.beginBlock ? RequestBeginBlock.toAmino(message.beginBlock) : undefined; + obj.check_tx = message.checkTx ? RequestCheckTx.toAmino(message.checkTx) : undefined; + obj.deliver_tx = message.deliverTx ? RequestDeliverTx.toAmino(message.deliverTx) : undefined; + obj.end_block = message.endBlock ? RequestEndBlock.toAmino(message.endBlock) : undefined; + obj.commit = message.commit ? RequestCommit.toAmino(message.commit) : undefined; + obj.list_snapshots = message.listSnapshots ? RequestListSnapshots.toAmino(message.listSnapshots) : undefined; + obj.offer_snapshot = message.offerSnapshot ? RequestOfferSnapshot.toAmino(message.offerSnapshot) : undefined; + obj.load_snapshot_chunk = message.loadSnapshotChunk ? RequestLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) : undefined; + obj.apply_snapshot_chunk = message.applySnapshotChunk ? RequestApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; + return obj; + }, + fromAminoMsg(object: RequestAminoMsg): Request { + return Request.fromAmino(object.value); + }, + fromProtoMsg(message: RequestProtoMsg): Request { + return Request.decode(message.value); + }, + toProto(message: Request): Uint8Array { + return Request.encode(message).finish(); + }, + toProtoMsg(message: Request): RequestProtoMsg { + return { + typeUrl: "/tendermint.abci.Request", + value: Request.encode(message).finish() + }; } - }; - function createBaseRequestEcho(): RequestEcho { return { message: "" }; } - export const RequestEcho = { - encode(message: RequestEcho, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestEcho", + encode(message: RequestEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.message !== "") { writer.uint32(10).string(message.message); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestEcho { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestEcho(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.message = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestEcho { + fromPartial(object: Partial): RequestEcho { const message = createBaseRequestEcho(); message.message = object.message ?? ""; return message; + }, + fromAmino(object: RequestEchoAmino): RequestEcho { + const message = createBaseRequestEcho(); + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } + return message; + }, + toAmino(message: RequestEcho): RequestEchoAmino { + const obj: any = {}; + obj.message = message.message; + return obj; + }, + fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { + return RequestEcho.fromAmino(object.value); + }, + fromProtoMsg(message: RequestEchoProtoMsg): RequestEcho { + return RequestEcho.decode(message.value); + }, + toProto(message: RequestEcho): Uint8Array { + return RequestEcho.encode(message).finish(); + }, + toProtoMsg(message: RequestEcho): RequestEchoProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestEcho", + value: RequestEcho.encode(message).finish() + }; } - }; - function createBaseRequestFlush(): RequestFlush { return {}; } - export const RequestFlush = { - encode(_: RequestFlush, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestFlush", + encode(_: RequestFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestFlush { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestFlush(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): RequestFlush { + fromPartial(_: Partial): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, + fromAmino(_: RequestFlushAmino): RequestFlush { const message = createBaseRequestFlush(); return message; + }, + toAmino(_: RequestFlush): RequestFlushAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestFlushAminoMsg): RequestFlush { + return RequestFlush.fromAmino(object.value); + }, + fromProtoMsg(message: RequestFlushProtoMsg): RequestFlush { + return RequestFlush.decode(message.value); + }, + toProto(message: RequestFlush): Uint8Array { + return RequestFlush.encode(message).finish(); + }, + toProtoMsg(message: RequestFlush): RequestFlushProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestFlush", + value: RequestFlush.encode(message).finish() + }; } - }; - function createBaseRequestInfo(): RequestInfo { return { version: "", - blockVersion: Long.UZERO, - p2pVersion: Long.UZERO + blockVersion: BigInt(0), + p2pVersion: BigInt(0) }; } - export const RequestInfo = { - encode(message: RequestInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestInfo", + encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== "") { writer.uint32(10).string(message.version); } - - if (!message.blockVersion.isZero()) { + if (message.blockVersion !== BigInt(0)) { writer.uint32(16).uint64(message.blockVersion); } - - if (!message.p2pVersion.isZero()) { + if (message.p2pVersion !== BigInt(0)) { writer.uint32(24).uint64(message.p2pVersion); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.version = reader.string(); break; - case 2: - message.blockVersion = (reader.uint64() as Long); + message.blockVersion = reader.uint64(); break; - case 3: - message.p2pVersion = (reader.uint64() as Long); + message.p2pVersion = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestInfo { + fromPartial(object: Partial): RequestInfo { const message = createBaseRequestInfo(); message.version = object.version ?? ""; - message.blockVersion = object.blockVersion !== undefined && object.blockVersion !== null ? Long.fromValue(object.blockVersion) : Long.UZERO; - message.p2pVersion = object.p2pVersion !== undefined && object.p2pVersion !== null ? Long.fromValue(object.p2pVersion) : Long.UZERO; + message.blockVersion = object.blockVersion !== undefined && object.blockVersion !== null ? BigInt(object.blockVersion.toString()) : BigInt(0); + message.p2pVersion = object.p2pVersion !== undefined && object.p2pVersion !== null ? BigInt(object.p2pVersion.toString()) : BigInt(0); return message; + }, + fromAmino(object: RequestInfoAmino): RequestInfo { + const message = createBaseRequestInfo(); + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.block_version !== undefined && object.block_version !== null) { + message.blockVersion = BigInt(object.block_version); + } + if (object.p2p_version !== undefined && object.p2p_version !== null) { + message.p2pVersion = BigInt(object.p2p_version); + } + return message; + }, + toAmino(message: RequestInfo): RequestInfoAmino { + const obj: any = {}; + obj.version = message.version; + obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; + obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { + return RequestInfo.fromAmino(object.value); + }, + fromProtoMsg(message: RequestInfoProtoMsg): RequestInfo { + return RequestInfo.decode(message.value); + }, + toProto(message: RequestInfo): Uint8Array { + return RequestInfo.encode(message).finish(); + }, + toProtoMsg(message: RequestInfo): RequestInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestInfo", + value: RequestInfo.encode(message).finish() + }; } - }; - function createBaseRequestSetOption(): RequestSetOption { return { key: "", value: "" }; } - export const RequestSetOption = { - encode(message: RequestSetOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestSetOption", + encode(message: RequestSetOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== "") { writer.uint32(18).string(message.value); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestSetOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestSetOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestSetOption(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.string(); break; - case 2: message.value = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestSetOption { + fromPartial(object: Partial): RequestSetOption { const message = createBaseRequestSetOption(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; + }, + fromAmino(object: RequestSetOptionAmino): RequestSetOption { + const message = createBaseRequestSetOption(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: RequestSetOption): RequestSetOptionAmino { + const obj: any = {}; + obj.key = message.key; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { + return RequestSetOption.fromAmino(object.value); + }, + fromProtoMsg(message: RequestSetOptionProtoMsg): RequestSetOption { + return RequestSetOption.decode(message.value); + }, + toProto(message: RequestSetOption): Uint8Array { + return RequestSetOption.encode(message).finish(); + }, + toProtoMsg(message: RequestSetOption): RequestSetOptionProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestSetOption", + value: RequestSetOption.encode(message).finish() + }; } - }; - function createBaseRequestInitChain(): RequestInitChain { return { - time: undefined, + time: new Date(), chainId: "", consensusParams: undefined, validators: [], appStateBytes: new Uint8Array(), - initialHeight: Long.ZERO + initialHeight: BigInt(0) }; } - export const RequestInitChain = { - encode(message: RequestInitChain, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestInitChain", + encode(message: RequestInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); } - if (message.chainId !== "") { writer.uint32(18).string(message.chainId); } - if (message.consensusParams !== undefined) { ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim(); } - for (const v of message.validators) { ValidatorUpdate.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.appStateBytes.length !== 0) { writer.uint32(42).bytes(message.appStateBytes); } - - if (!message.initialHeight.isZero()) { + if (message.initialHeight !== BigInt(0)) { writer.uint32(48).int64(message.initialHeight); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestInitChain { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestInitChain(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 2: message.chainId = reader.string(); break; - case 3: message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); break; - case 4: message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); break; - case 5: message.appStateBytes = reader.bytes(); break; - case 6: - message.initialHeight = (reader.int64() as Long); + message.initialHeight = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestInitChain { + fromPartial(object: Partial): RequestInitChain { const message = createBaseRequestInitChain(); message.time = object.time ?? undefined; message.chainId = object.chainId ?? ""; message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || []; message.appStateBytes = object.appStateBytes ?? new Uint8Array(); - message.initialHeight = object.initialHeight !== undefined && object.initialHeight !== null ? Long.fromValue(object.initialHeight) : Long.ZERO; + message.initialHeight = object.initialHeight !== undefined && object.initialHeight !== null ? BigInt(object.initialHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: RequestInitChainAmino): RequestInitChain { + const message = createBaseRequestInitChain(); + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.consensus_params !== undefined && object.consensus_params !== null) { + message.consensusParams = ConsensusParams.fromAmino(object.consensus_params); + } + message.validators = object.validators?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.app_state_bytes !== undefined && object.app_state_bytes !== null) { + message.appStateBytes = bytesFromBase64(object.app_state_bytes); + } + if (object.initial_height !== undefined && object.initial_height !== null) { + message.initialHeight = BigInt(object.initial_height); + } return message; + }, + toAmino(message: RequestInitChain): RequestInitChainAmino { + const obj: any = {}; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.chain_id = message.chainId; + obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; + if (message.validators) { + obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validators = []; + } + obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; + obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { + return RequestInitChain.fromAmino(object.value); + }, + fromProtoMsg(message: RequestInitChainProtoMsg): RequestInitChain { + return RequestInitChain.decode(message.value); + }, + toProto(message: RequestInitChain): Uint8Array { + return RequestInitChain.encode(message).finish(); + }, + toProtoMsg(message: RequestInitChain): RequestInitChainProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestInitChain", + value: RequestInitChain.encode(message).finish() + }; } - }; - function createBaseRequestQuery(): RequestQuery { return { data: new Uint8Array(), path: "", - height: Long.ZERO, + height: BigInt(0), prove: false }; } - export const RequestQuery = { - encode(message: RequestQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestQuery", + encode(message: RequestQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); } - if (message.path !== "") { writer.uint32(18).string(message.path); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(24).int64(message.height); } - if (message.prove === true) { writer.uint32(32).bool(message.prove); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestQuery { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestQuery(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.data = reader.bytes(); break; - case 2: message.path = reader.string(); break; - case 3: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 4: message.prove = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestQuery { + fromPartial(object: Partial): RequestQuery { const message = createBaseRequestQuery(); message.data = object.data ?? new Uint8Array(); message.path = object.path ?? ""; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.prove = object.prove ?? false; return message; + }, + fromAmino(object: RequestQueryAmino): RequestQuery { + const message = createBaseRequestQuery(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.prove !== undefined && object.prove !== null) { + message.prove = object.prove; + } + return message; + }, + toAmino(message: RequestQuery): RequestQueryAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.path = message.path; + obj.height = message.height ? message.height.toString() : undefined; + obj.prove = message.prove; + return obj; + }, + fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { + return RequestQuery.fromAmino(object.value); + }, + fromProtoMsg(message: RequestQueryProtoMsg): RequestQuery { + return RequestQuery.decode(message.value); + }, + toProto(message: RequestQuery): Uint8Array { + return RequestQuery.encode(message).finish(); + }, + toProtoMsg(message: RequestQuery): RequestQueryProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestQuery", + value: RequestQuery.encode(message).finish() + }; } - }; - function createBaseRequestBeginBlock(): RequestBeginBlock { return { hash: new Uint8Array(), - header: undefined, - lastCommitInfo: undefined, + header: Header.fromPartial({}), + lastCommitInfo: LastCommitInfo.fromPartial({}), byzantineValidators: [] }; } - export const RequestBeginBlock = { - encode(message: RequestBeginBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestBeginBlock", + encode(message: RequestBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); } - if (message.header !== undefined) { Header.encode(message.header, writer.uint32(18).fork()).ldelim(); } - if (message.lastCommitInfo !== undefined) { LastCommitInfo.encode(message.lastCommitInfo, writer.uint32(26).fork()).ldelim(); } - for (const v of message.byzantineValidators) { Evidence.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestBeginBlock { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestBeginBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestBeginBlock(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = reader.bytes(); break; - case 2: message.header = Header.decode(reader, reader.uint32()); break; - case 3: message.lastCommitInfo = LastCommitInfo.decode(reader, reader.uint32()); break; - case 4: message.byzantineValidators.push(Evidence.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestBeginBlock { + fromPartial(object: Partial): RequestBeginBlock { const message = createBaseRequestBeginBlock(); message.hash = object.hash ?? new Uint8Array(); message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; message.lastCommitInfo = object.lastCommitInfo !== undefined && object.lastCommitInfo !== null ? LastCommitInfo.fromPartial(object.lastCommitInfo) : undefined; message.byzantineValidators = object.byzantineValidators?.map(e => Evidence.fromPartial(e)) || []; return message; + }, + fromAmino(object: RequestBeginBlockAmino): RequestBeginBlock { + const message = createBaseRequestBeginBlock(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.last_commit_info !== undefined && object.last_commit_info !== null) { + message.lastCommitInfo = LastCommitInfo.fromAmino(object.last_commit_info); + } + message.byzantineValidators = object.byzantine_validators?.map(e => Evidence.fromAmino(e)) || []; + return message; + }, + toAmino(message: RequestBeginBlock): RequestBeginBlockAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.last_commit_info = message.lastCommitInfo ? LastCommitInfo.toAmino(message.lastCommitInfo) : undefined; + if (message.byzantineValidators) { + obj.byzantine_validators = message.byzantineValidators.map(e => e ? Evidence.toAmino(e) : undefined); + } else { + obj.byzantine_validators = []; + } + return obj; + }, + fromAminoMsg(object: RequestBeginBlockAminoMsg): RequestBeginBlock { + return RequestBeginBlock.fromAmino(object.value); + }, + fromProtoMsg(message: RequestBeginBlockProtoMsg): RequestBeginBlock { + return RequestBeginBlock.decode(message.value); + }, + toProto(message: RequestBeginBlock): Uint8Array { + return RequestBeginBlock.encode(message).finish(); + }, + toProtoMsg(message: RequestBeginBlock): RequestBeginBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestBeginBlock", + value: RequestBeginBlock.encode(message).finish() + }; } - }; - function createBaseRequestCheckTx(): RequestCheckTx { return { tx: new Uint8Array(), type: 0 }; } - export const RequestCheckTx = { - encode(message: RequestCheckTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestCheckTx", + encode(message: RequestCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx.length !== 0) { writer.uint32(10).bytes(message.tx); } - if (message.type !== 0) { writer.uint32(16).int32(message.type); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestCheckTx { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestCheckTx(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.tx = reader.bytes(); break; - case 2: message.type = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestCheckTx { + fromPartial(object: Partial): RequestCheckTx { const message = createBaseRequestCheckTx(); message.tx = object.tx ?? new Uint8Array(); message.type = object.type ?? 0; return message; + }, + fromAmino(object: RequestCheckTxAmino): RequestCheckTx { + const message = createBaseRequestCheckTx(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + if (object.type !== undefined && object.type !== null) { + message.type = checkTxTypeFromJSON(object.type); + } + return message; + }, + toAmino(message: RequestCheckTx): RequestCheckTxAmino { + const obj: any = {}; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + obj.type = checkTxTypeToJSON(message.type); + return obj; + }, + fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { + return RequestCheckTx.fromAmino(object.value); + }, + fromProtoMsg(message: RequestCheckTxProtoMsg): RequestCheckTx { + return RequestCheckTx.decode(message.value); + }, + toProto(message: RequestCheckTx): Uint8Array { + return RequestCheckTx.encode(message).finish(); + }, + toProtoMsg(message: RequestCheckTx): RequestCheckTxProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestCheckTx", + value: RequestCheckTx.encode(message).finish() + }; } - }; - function createBaseRequestDeliverTx(): RequestDeliverTx { return { tx: new Uint8Array() }; } - export const RequestDeliverTx = { - encode(message: RequestDeliverTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestDeliverTx", + encode(message: RequestDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx.length !== 0) { writer.uint32(10).bytes(message.tx); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestDeliverTx { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestDeliverTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestDeliverTx(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.tx = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestDeliverTx { + fromPartial(object: Partial): RequestDeliverTx { const message = createBaseRequestDeliverTx(); message.tx = object.tx ?? new Uint8Array(); return message; + }, + fromAmino(object: RequestDeliverTxAmino): RequestDeliverTx { + const message = createBaseRequestDeliverTx(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + return message; + }, + toAmino(message: RequestDeliverTx): RequestDeliverTxAmino { + const obj: any = {}; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: RequestDeliverTxAminoMsg): RequestDeliverTx { + return RequestDeliverTx.fromAmino(object.value); + }, + fromProtoMsg(message: RequestDeliverTxProtoMsg): RequestDeliverTx { + return RequestDeliverTx.decode(message.value); + }, + toProto(message: RequestDeliverTx): Uint8Array { + return RequestDeliverTx.encode(message).finish(); + }, + toProtoMsg(message: RequestDeliverTx): RequestDeliverTxProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestDeliverTx", + value: RequestDeliverTx.encode(message).finish() + }; } - }; - function createBaseRequestEndBlock(): RequestEndBlock { return { - height: Long.ZERO + height: BigInt(0) }; } - export const RequestEndBlock = { - encode(message: RequestEndBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/tendermint.abci.RequestEndBlock", + encode(message: RequestEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestEndBlock { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestEndBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestEndBlock(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestEndBlock { + fromPartial(object: Partial): RequestEndBlock { const message = createBaseRequestEndBlock(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: RequestEndBlockAmino): RequestEndBlock { + const message = createBaseRequestEndBlock(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } return message; + }, + toAmino(message: RequestEndBlock): RequestEndBlockAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { + return RequestEndBlock.fromAmino(object.value); + }, + fromProtoMsg(message: RequestEndBlockProtoMsg): RequestEndBlock { + return RequestEndBlock.decode(message.value); + }, + toProto(message: RequestEndBlock): Uint8Array { + return RequestEndBlock.encode(message).finish(); + }, + toProtoMsg(message: RequestEndBlock): RequestEndBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestEndBlock", + value: RequestEndBlock.encode(message).finish() + }; } - }; - function createBaseRequestCommit(): RequestCommit { return {}; } - export const RequestCommit = { - encode(_: RequestCommit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestCommit", + encode(_: RequestCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestCommit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestCommit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): RequestCommit { + fromPartial(_: Partial): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, + fromAmino(_: RequestCommitAmino): RequestCommit { const message = createBaseRequestCommit(); return message; + }, + toAmino(_: RequestCommit): RequestCommitAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestCommitAminoMsg): RequestCommit { + return RequestCommit.fromAmino(object.value); + }, + fromProtoMsg(message: RequestCommitProtoMsg): RequestCommit { + return RequestCommit.decode(message.value); + }, + toProto(message: RequestCommit): Uint8Array { + return RequestCommit.encode(message).finish(); + }, + toProtoMsg(message: RequestCommit): RequestCommitProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestCommit", + value: RequestCommit.encode(message).finish() + }; } - }; - function createBaseRequestListSnapshots(): RequestListSnapshots { return {}; } - export const RequestListSnapshots = { - encode(_: RequestListSnapshots, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestListSnapshots", + encode(_: RequestListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestListSnapshots { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestListSnapshots(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): RequestListSnapshots { + fromPartial(_: Partial): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, + fromAmino(_: RequestListSnapshotsAmino): RequestListSnapshots { const message = createBaseRequestListSnapshots(); return message; + }, + toAmino(_: RequestListSnapshots): RequestListSnapshotsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestListSnapshotsAminoMsg): RequestListSnapshots { + return RequestListSnapshots.fromAmino(object.value); + }, + fromProtoMsg(message: RequestListSnapshotsProtoMsg): RequestListSnapshots { + return RequestListSnapshots.decode(message.value); + }, + toProto(message: RequestListSnapshots): Uint8Array { + return RequestListSnapshots.encode(message).finish(); + }, + toProtoMsg(message: RequestListSnapshots): RequestListSnapshotsProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestListSnapshots", + value: RequestListSnapshots.encode(message).finish() + }; } - }; - function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { return { snapshot: undefined, appHash: new Uint8Array() }; } - export const RequestOfferSnapshot = { - encode(message: RequestOfferSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestOfferSnapshot", + encode(message: RequestOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.snapshot !== undefined) { Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); } - if (message.appHash.length !== 0) { writer.uint32(18).bytes(message.appHash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestOfferSnapshot { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestOfferSnapshot(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.snapshot = Snapshot.decode(reader, reader.uint32()); break; - case 2: message.appHash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestOfferSnapshot { + fromPartial(object: Partial): RequestOfferSnapshot { const message = createBaseRequestOfferSnapshot(); message.snapshot = object.snapshot !== undefined && object.snapshot !== null ? Snapshot.fromPartial(object.snapshot) : undefined; message.appHash = object.appHash ?? new Uint8Array(); return message; + }, + fromAmino(object: RequestOfferSnapshotAmino): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + if (object.snapshot !== undefined && object.snapshot !== null) { + message.snapshot = Snapshot.fromAmino(object.snapshot); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + return message; + }, + toAmino(message: RequestOfferSnapshot): RequestOfferSnapshotAmino { + const obj: any = {}; + obj.snapshot = message.snapshot ? Snapshot.toAmino(message.snapshot) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + return obj; + }, + fromAminoMsg(object: RequestOfferSnapshotAminoMsg): RequestOfferSnapshot { + return RequestOfferSnapshot.fromAmino(object.value); + }, + fromProtoMsg(message: RequestOfferSnapshotProtoMsg): RequestOfferSnapshot { + return RequestOfferSnapshot.decode(message.value); + }, + toProto(message: RequestOfferSnapshot): Uint8Array { + return RequestOfferSnapshot.encode(message).finish(); + }, + toProtoMsg(message: RequestOfferSnapshot): RequestOfferSnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestOfferSnapshot", + value: RequestOfferSnapshot.encode(message).finish() + }; } - }; - function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { return { - height: Long.UZERO, + height: BigInt(0), format: 0, chunk: 0 }; } - export const RequestLoadSnapshotChunk = { - encode(message: RequestLoadSnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); } - if (message.format !== 0) { writer.uint32(16).uint32(message.format); } - if (message.chunk !== 0) { writer.uint32(24).uint32(message.chunk); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestLoadSnapshotChunk { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestLoadSnapshotChunk(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.uint64() as Long); + message.height = reader.uint64(); break; - case 2: message.format = reader.uint32(); break; - case 3: message.chunk = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestLoadSnapshotChunk { + fromPartial(object: Partial): RequestLoadSnapshotChunk { const message = createBaseRequestLoadSnapshotChunk(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.UZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.format = object.format ?? 0; message.chunk = object.chunk ?? 0; return message; + }, + fromAmino(object: RequestLoadSnapshotChunkAmino): RequestLoadSnapshotChunk { + const message = createBaseRequestLoadSnapshotChunk(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = object.chunk; + } + return message; + }, + toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.format = message.format; + obj.chunk = message.chunk; + return obj; + }, + fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: RequestLoadSnapshotChunkProtoMsg): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.decode(message.value); + }, + toProto(message: RequestLoadSnapshotChunk): Uint8Array { + return RequestLoadSnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + value: RequestLoadSnapshotChunk.encode(message).finish() + }; } - }; - function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { return { index: 0, @@ -1906,64 +2686,86 @@ function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { sender: "" }; } - export const RequestApplySnapshotChunk = { - encode(message: RequestApplySnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== 0) { writer.uint32(8).uint32(message.index); } - if (message.chunk.length !== 0) { writer.uint32(18).bytes(message.chunk); } - if (message.sender !== "") { writer.uint32(26).string(message.sender); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RequestApplySnapshotChunk { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestApplySnapshotChunk(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.index = reader.uint32(); break; - case 2: message.chunk = reader.bytes(); break; - case 3: message.sender = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): RequestApplySnapshotChunk { + fromPartial(object: Partial): RequestApplySnapshotChunk { const message = createBaseRequestApplySnapshotChunk(); message.index = object.index ?? 0; message.chunk = object.chunk ?? new Uint8Array(); message.sender = object.sender ?? ""; return message; + }, + fromAmino(object: RequestApplySnapshotChunkAmino): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = bytesFromBase64(object.chunk); + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + return message; + }, + toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { + const obj: any = {}; + obj.index = message.index; + obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; + obj.sender = message.sender; + return obj; + }, + fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: RequestApplySnapshotChunkProtoMsg): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.decode(message.value); + }, + toProto(message: RequestApplySnapshotChunk): Uint8Array { + return RequestApplySnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + value: RequestApplySnapshotChunk.encode(message).finish() + }; } - }; - function createBaseResponse(): Response { return { exception: undefined, @@ -1984,159 +2786,122 @@ function createBaseResponse(): Response { applySnapshotChunk: undefined }; } - export const Response = { - encode(message: Response, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.Response", + encode(message: Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exception !== undefined) { ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); } - if (message.echo !== undefined) { ResponseEcho.encode(message.echo, writer.uint32(18).fork()).ldelim(); } - if (message.flush !== undefined) { ResponseFlush.encode(message.flush, writer.uint32(26).fork()).ldelim(); } - if (message.info !== undefined) { ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); } - if (message.setOption !== undefined) { ResponseSetOption.encode(message.setOption, writer.uint32(42).fork()).ldelim(); } - if (message.initChain !== undefined) { ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).ldelim(); } - if (message.query !== undefined) { ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); } - if (message.beginBlock !== undefined) { ResponseBeginBlock.encode(message.beginBlock, writer.uint32(66).fork()).ldelim(); } - if (message.checkTx !== undefined) { ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).ldelim(); } - if (message.deliverTx !== undefined) { ResponseDeliverTx.encode(message.deliverTx, writer.uint32(82).fork()).ldelim(); } - if (message.endBlock !== undefined) { ResponseEndBlock.encode(message.endBlock, writer.uint32(90).fork()).ldelim(); } - if (message.commit !== undefined) { ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); } - if (message.listSnapshots !== undefined) { ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).ldelim(); } - if (message.offerSnapshot !== undefined) { ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).ldelim(); } - if (message.loadSnapshotChunk !== undefined) { ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).ldelim(); } - if (message.applySnapshotChunk !== undefined) { ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Response { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.exception = ResponseException.decode(reader, reader.uint32()); break; - case 2: message.echo = ResponseEcho.decode(reader, reader.uint32()); break; - case 3: message.flush = ResponseFlush.decode(reader, reader.uint32()); break; - case 4: message.info = ResponseInfo.decode(reader, reader.uint32()); break; - case 5: message.setOption = ResponseSetOption.decode(reader, reader.uint32()); break; - case 6: message.initChain = ResponseInitChain.decode(reader, reader.uint32()); break; - case 7: message.query = ResponseQuery.decode(reader, reader.uint32()); break; - case 8: message.beginBlock = ResponseBeginBlock.decode(reader, reader.uint32()); break; - case 9: message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); break; - case 10: message.deliverTx = ResponseDeliverTx.decode(reader, reader.uint32()); break; - case 11: message.endBlock = ResponseEndBlock.decode(reader, reader.uint32()); break; - case 12: message.commit = ResponseCommit.decode(reader, reader.uint32()); break; - case 13: message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); break; - case 14: message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); break; - case 15: message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); break; - case 16: message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Response { + fromPartial(object: Partial): 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; @@ -2155,219 +2920,382 @@ export const Response = { 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; return message; + }, + fromAmino(object: ResponseAmino): Response { + const message = createBaseResponse(); + if (object.exception !== undefined && object.exception !== null) { + message.exception = ResponseException.fromAmino(object.exception); + } + if (object.echo !== undefined && object.echo !== null) { + message.echo = ResponseEcho.fromAmino(object.echo); + } + if (object.flush !== undefined && object.flush !== null) { + message.flush = ResponseFlush.fromAmino(object.flush); + } + if (object.info !== undefined && object.info !== null) { + message.info = ResponseInfo.fromAmino(object.info); + } + if (object.set_option !== undefined && object.set_option !== null) { + message.setOption = ResponseSetOption.fromAmino(object.set_option); + } + if (object.init_chain !== undefined && object.init_chain !== null) { + message.initChain = ResponseInitChain.fromAmino(object.init_chain); + } + if (object.query !== undefined && object.query !== null) { + message.query = ResponseQuery.fromAmino(object.query); + } + if (object.begin_block !== undefined && object.begin_block !== null) { + message.beginBlock = ResponseBeginBlock.fromAmino(object.begin_block); + } + if (object.check_tx !== undefined && object.check_tx !== null) { + message.checkTx = ResponseCheckTx.fromAmino(object.check_tx); + } + if (object.deliver_tx !== undefined && object.deliver_tx !== null) { + message.deliverTx = ResponseDeliverTx.fromAmino(object.deliver_tx); + } + if (object.end_block !== undefined && object.end_block !== null) { + message.endBlock = ResponseEndBlock.fromAmino(object.end_block); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = ResponseCommit.fromAmino(object.commit); + } + if (object.list_snapshots !== undefined && object.list_snapshots !== null) { + message.listSnapshots = ResponseListSnapshots.fromAmino(object.list_snapshots); + } + if (object.offer_snapshot !== undefined && object.offer_snapshot !== null) { + message.offerSnapshot = ResponseOfferSnapshot.fromAmino(object.offer_snapshot); + } + if (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) { + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk); + } + if (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) { + message.applySnapshotChunk = ResponseApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk); + } + return message; + }, + toAmino(message: Response): ResponseAmino { + const obj: any = {}; + obj.exception = message.exception ? ResponseException.toAmino(message.exception) : undefined; + obj.echo = message.echo ? ResponseEcho.toAmino(message.echo) : undefined; + obj.flush = message.flush ? ResponseFlush.toAmino(message.flush) : undefined; + obj.info = message.info ? ResponseInfo.toAmino(message.info) : undefined; + obj.set_option = message.setOption ? ResponseSetOption.toAmino(message.setOption) : undefined; + obj.init_chain = message.initChain ? ResponseInitChain.toAmino(message.initChain) : undefined; + obj.query = message.query ? ResponseQuery.toAmino(message.query) : undefined; + obj.begin_block = message.beginBlock ? ResponseBeginBlock.toAmino(message.beginBlock) : undefined; + obj.check_tx = message.checkTx ? ResponseCheckTx.toAmino(message.checkTx) : undefined; + obj.deliver_tx = message.deliverTx ? ResponseDeliverTx.toAmino(message.deliverTx) : undefined; + obj.end_block = message.endBlock ? ResponseEndBlock.toAmino(message.endBlock) : undefined; + obj.commit = message.commit ? ResponseCommit.toAmino(message.commit) : undefined; + obj.list_snapshots = message.listSnapshots ? ResponseListSnapshots.toAmino(message.listSnapshots) : undefined; + obj.offer_snapshot = message.offerSnapshot ? ResponseOfferSnapshot.toAmino(message.offerSnapshot) : undefined; + obj.load_snapshot_chunk = message.loadSnapshotChunk ? ResponseLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) : undefined; + obj.apply_snapshot_chunk = message.applySnapshotChunk ? ResponseApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseAminoMsg): Response { + return Response.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseProtoMsg): Response { + return Response.decode(message.value); + }, + toProto(message: Response): Uint8Array { + return Response.encode(message).finish(); + }, + toProtoMsg(message: Response): ResponseProtoMsg { + return { + typeUrl: "/tendermint.abci.Response", + value: Response.encode(message).finish() + }; } - }; - function createBaseResponseException(): ResponseException { return { error: "" }; } - export const ResponseException = { - encode(message: ResponseException, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseException", + encode(message: ResponseException, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.error !== "") { writer.uint32(10).string(message.error); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseException { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseException(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.error = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseException { + fromPartial(object: Partial): ResponseException { const message = createBaseResponseException(); message.error = object.error ?? ""; return message; + }, + fromAmino(object: ResponseExceptionAmino): ResponseException { + const message = createBaseResponseException(); + if (object.error !== undefined && object.error !== null) { + message.error = object.error; + } + return message; + }, + toAmino(message: ResponseException): ResponseExceptionAmino { + const obj: any = {}; + obj.error = message.error; + return obj; + }, + fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { + return ResponseException.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseExceptionProtoMsg): ResponseException { + return ResponseException.decode(message.value); + }, + toProto(message: ResponseException): Uint8Array { + return ResponseException.encode(message).finish(); + }, + toProtoMsg(message: ResponseException): ResponseExceptionProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseException", + value: ResponseException.encode(message).finish() + }; } - }; - function createBaseResponseEcho(): ResponseEcho { return { message: "" }; } - export const ResponseEcho = { - encode(message: ResponseEcho, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseEcho", + encode(message: ResponseEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.message !== "") { writer.uint32(10).string(message.message); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEcho { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseEcho(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.message = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseEcho { + fromPartial(object: Partial): ResponseEcho { const message = createBaseResponseEcho(); message.message = object.message ?? ""; return message; + }, + fromAmino(object: ResponseEchoAmino): ResponseEcho { + const message = createBaseResponseEcho(); + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } + return message; + }, + toAmino(message: ResponseEcho): ResponseEchoAmino { + const obj: any = {}; + obj.message = message.message; + return obj; + }, + fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { + return ResponseEcho.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseEchoProtoMsg): ResponseEcho { + return ResponseEcho.decode(message.value); + }, + toProto(message: ResponseEcho): Uint8Array { + return ResponseEcho.encode(message).finish(); + }, + toProtoMsg(message: ResponseEcho): ResponseEchoProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseEcho", + value: ResponseEcho.encode(message).finish() + }; } - }; - function createBaseResponseFlush(): ResponseFlush { return {}; } - export const ResponseFlush = { - encode(_: ResponseFlush, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseFlush", + encode(_: ResponseFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseFlush { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseFlush(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): ResponseFlush { + fromPartial(_: Partial): ResponseFlush { const message = createBaseResponseFlush(); return message; + }, + fromAmino(_: ResponseFlushAmino): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, + toAmino(_: ResponseFlush): ResponseFlushAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ResponseFlushAminoMsg): ResponseFlush { + return ResponseFlush.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseFlushProtoMsg): ResponseFlush { + return ResponseFlush.decode(message.value); + }, + toProto(message: ResponseFlush): Uint8Array { + return ResponseFlush.encode(message).finish(); + }, + toProtoMsg(message: ResponseFlush): ResponseFlushProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseFlush", + value: ResponseFlush.encode(message).finish() + }; } - }; - function createBaseResponseInfo(): ResponseInfo { return { data: "", version: "", - appVersion: Long.UZERO, - lastBlockHeight: Long.ZERO, + appVersion: BigInt(0), + lastBlockHeight: BigInt(0), lastBlockAppHash: new Uint8Array() }; } - export const ResponseInfo = { - encode(message: ResponseInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseInfo", + encode(message: ResponseInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data !== "") { writer.uint32(10).string(message.data); } - if (message.version !== "") { writer.uint32(18).string(message.version); } - - if (!message.appVersion.isZero()) { + if (message.appVersion !== BigInt(0)) { writer.uint32(24).uint64(message.appVersion); } - - if (!message.lastBlockHeight.isZero()) { + if (message.lastBlockHeight !== BigInt(0)) { writer.uint32(32).int64(message.lastBlockHeight); } - if (message.lastBlockAppHash.length !== 0) { writer.uint32(42).bytes(message.lastBlockAppHash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.data = reader.string(); break; - case 2: message.version = reader.string(); break; - case 3: - message.appVersion = (reader.uint64() as Long); + message.appVersion = reader.uint64(); break; - case 4: - message.lastBlockHeight = (reader.int64() as Long); + message.lastBlockHeight = reader.int64(); break; - case 5: message.lastBlockAppHash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseInfo { + fromPartial(object: Partial): ResponseInfo { const message = createBaseResponseInfo(); message.data = object.data ?? ""; message.version = object.version ?? ""; - message.appVersion = object.appVersion !== undefined && object.appVersion !== null ? Long.fromValue(object.appVersion) : Long.UZERO; - message.lastBlockHeight = object.lastBlockHeight !== undefined && object.lastBlockHeight !== null ? Long.fromValue(object.lastBlockHeight) : Long.ZERO; + message.appVersion = object.appVersion !== undefined && object.appVersion !== null ? BigInt(object.appVersion.toString()) : BigInt(0); + message.lastBlockHeight = object.lastBlockHeight !== undefined && object.lastBlockHeight !== null ? BigInt(object.lastBlockHeight.toString()) : BigInt(0); message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(); return message; + }, + fromAmino(object: ResponseInfoAmino): ResponseInfo { + const message = createBaseResponseInfo(); + if (object.data !== undefined && object.data !== null) { + message.data = object.data; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.app_version !== undefined && object.app_version !== null) { + message.appVersion = BigInt(object.app_version); + } + if (object.last_block_height !== undefined && object.last_block_height !== null) { + message.lastBlockHeight = BigInt(object.last_block_height); + } + if (object.last_block_app_hash !== undefined && object.last_block_app_hash !== null) { + message.lastBlockAppHash = bytesFromBase64(object.last_block_app_hash); + } + return message; + }, + toAmino(message: ResponseInfo): ResponseInfoAmino { + const obj: any = {}; + obj.data = message.data; + obj.version = message.version; + obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseInfoAminoMsg): ResponseInfo { + return ResponseInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseInfoProtoMsg): ResponseInfo { + return ResponseInfo.decode(message.value); + }, + toProto(message: ResponseInfo): Uint8Array { + return ResponseInfo.encode(message).finish(); + }, + toProtoMsg(message: ResponseInfo): ResponseInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseInfo", + value: ResponseInfo.encode(message).finish() + }; } - }; - function createBaseResponseSetOption(): ResponseSetOption { return { code: 0, @@ -2375,64 +3303,86 @@ function createBaseResponseSetOption(): ResponseSetOption { info: "" }; } - export const ResponseSetOption = { - encode(message: ResponseSetOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseSetOption", + encode(message: ResponseSetOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); } - if (message.log !== "") { writer.uint32(26).string(message.log); } - if (message.info !== "") { writer.uint32(34).string(message.info); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseSetOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseSetOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseSetOption(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.code = reader.uint32(); break; - case 3: message.log = reader.string(); break; - case 4: message.info = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseSetOption { + fromPartial(object: Partial): ResponseSetOption { const message = createBaseResponseSetOption(); message.code = object.code ?? 0; message.log = object.log ?? ""; message.info = object.info ?? ""; return message; + }, + fromAmino(object: ResponseSetOptionAmino): ResponseSetOption { + const message = createBaseResponseSetOption(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + return message; + }, + toAmino(message: ResponseSetOption): ResponseSetOptionAmino { + const obj: any = {}; + obj.code = message.code; + obj.log = message.log; + obj.info = message.info; + return obj; + }, + fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { + return ResponseSetOption.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseSetOptionProtoMsg): ResponseSetOption { + return ResponseSetOption.decode(message.value); + }, + toProto(message: ResponseSetOption): Uint8Array { + return ResponseSetOption.encode(message).finish(); + }, + toProtoMsg(message: ResponseSetOption): ResponseSetOptionProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseSetOption", + value: ResponseSetOption.encode(message).finish() + }; } - }; - function createBaseResponseInitChain(): ResponseInitChain { return { consensusParams: undefined, @@ -2440,464 +3390,610 @@ function createBaseResponseInitChain(): ResponseInitChain { appHash: new Uint8Array() }; } - export const ResponseInitChain = { - encode(message: ResponseInitChain, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseInitChain", + encode(message: ResponseInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusParams !== undefined) { ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); } - for (const v of message.validators) { ValidatorUpdate.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.appHash.length !== 0) { writer.uint32(26).bytes(message.appHash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInitChain { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseInitChain(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); break; - case 2: message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); break; - case 3: message.appHash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseInitChain { + fromPartial(object: Partial): ResponseInitChain { const message = createBaseResponseInitChain(); message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || []; message.appHash = object.appHash ?? new Uint8Array(); return message; + }, + fromAmino(object: ResponseInitChainAmino): ResponseInitChain { + const message = createBaseResponseInitChain(); + if (object.consensus_params !== undefined && object.consensus_params !== null) { + message.consensusParams = ConsensusParams.fromAmino(object.consensus_params); + } + message.validators = object.validators?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + return message; + }, + toAmino(message: ResponseInitChain): ResponseInitChainAmino { + const obj: any = {}; + obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; + if (message.validators) { + obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validators = []; + } + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseInitChainAminoMsg): ResponseInitChain { + return ResponseInitChain.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseInitChainProtoMsg): ResponseInitChain { + return ResponseInitChain.decode(message.value); + }, + toProto(message: ResponseInitChain): Uint8Array { + return ResponseInitChain.encode(message).finish(); + }, + toProtoMsg(message: ResponseInitChain): ResponseInitChainProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseInitChain", + value: ResponseInitChain.encode(message).finish() + }; } - }; - function createBaseResponseQuery(): ResponseQuery { return { code: 0, log: "", info: "", - index: Long.ZERO, + index: BigInt(0), key: new Uint8Array(), value: new Uint8Array(), proofOps: undefined, - height: Long.ZERO, + height: BigInt(0), codespace: "" }; } - export const ResponseQuery = { - encode(message: ResponseQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseQuery", + encode(message: ResponseQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); } - if (message.log !== "") { writer.uint32(26).string(message.log); } - if (message.info !== "") { writer.uint32(34).string(message.info); } - - if (!message.index.isZero()) { + if (message.index !== BigInt(0)) { writer.uint32(40).int64(message.index); } - if (message.key.length !== 0) { writer.uint32(50).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(58).bytes(message.value); } - if (message.proofOps !== undefined) { ProofOps.encode(message.proofOps, writer.uint32(66).fork()).ldelim(); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(72).int64(message.height); } - if (message.codespace !== "") { writer.uint32(82).string(message.codespace); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseQuery { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseQuery(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.code = reader.uint32(); break; - case 3: message.log = reader.string(); break; - case 4: message.info = reader.string(); break; - case 5: - message.index = (reader.int64() as Long); + message.index = reader.int64(); break; - case 6: message.key = reader.bytes(); break; - case 7: message.value = reader.bytes(); break; - case 8: message.proofOps = ProofOps.decode(reader, reader.uint32()); break; - case 9: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 10: message.codespace = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseQuery { + fromPartial(object: Partial): ResponseQuery { const message = createBaseResponseQuery(); message.code = object.code ?? 0; message.log = object.log ?? ""; message.info = object.info ?? ""; - message.index = object.index !== undefined && object.index !== null ? Long.fromValue(object.index) : Long.ZERO; + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); message.proofOps = object.proofOps !== undefined && object.proofOps !== null ? ProofOps.fromPartial(object.proofOps) : undefined; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.codespace = object.codespace ?? ""; return message; + }, + fromAmino(object: ResponseQueryAmino): ResponseQuery { + const message = createBaseResponseQuery(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.proof_ops !== undefined && object.proof_ops !== null) { + message.proofOps = ProofOps.fromAmino(object.proof_ops); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ResponseQuery): ResponseQueryAmino { + const obj: any = {}; + obj.code = message.code; + obj.log = message.log; + obj.info = message.info; + obj.index = message.index ? message.index.toString() : undefined; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; + obj.height = message.height ? message.height.toString() : undefined; + obj.codespace = message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { + return ResponseQuery.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseQueryProtoMsg): ResponseQuery { + return ResponseQuery.decode(message.value); + }, + toProto(message: ResponseQuery): Uint8Array { + return ResponseQuery.encode(message).finish(); + }, + toProtoMsg(message: ResponseQuery): ResponseQueryProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseQuery", + value: ResponseQuery.encode(message).finish() + }; } - }; - function createBaseResponseBeginBlock(): ResponseBeginBlock { return { events: [] }; } - export const ResponseBeginBlock = { - encode(message: ResponseBeginBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseBeginBlock", + encode(message: ResponseBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.events) { Event.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseBeginBlock { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseBeginBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseBeginBlock(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.events.push(Event.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseBeginBlock { + fromPartial(object: Partial): ResponseBeginBlock { const message = createBaseResponseBeginBlock(); message.events = object.events?.map(e => Event.fromPartial(e)) || []; return message; + }, + fromAmino(object: ResponseBeginBlockAmino): ResponseBeginBlock { + const message = createBaseResponseBeginBlock(); + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + return message; + }, + toAmino(message: ResponseBeginBlock): ResponseBeginBlockAmino { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + fromAminoMsg(object: ResponseBeginBlockAminoMsg): ResponseBeginBlock { + return ResponseBeginBlock.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseBeginBlockProtoMsg): ResponseBeginBlock { + return ResponseBeginBlock.decode(message.value); + }, + toProto(message: ResponseBeginBlock): Uint8Array { + return ResponseBeginBlock.encode(message).finish(); + }, + toProtoMsg(message: ResponseBeginBlock): ResponseBeginBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseBeginBlock", + value: ResponseBeginBlock.encode(message).finish() + }; } - }; - function createBaseResponseCheckTx(): ResponseCheckTx { return { code: 0, data: new Uint8Array(), log: "", info: "", - gasWanted: Long.ZERO, - gasUsed: Long.ZERO, + gasWanted: BigInt(0), + gasUsed: BigInt(0), events: [], codespace: "" }; } - export const ResponseCheckTx = { - encode(message: ResponseCheckTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseCheckTx", + encode(message: ResponseCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); } - if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } - if (message.log !== "") { writer.uint32(26).string(message.log); } - if (message.info !== "") { writer.uint32(34).string(message.info); } - - if (!message.gasWanted.isZero()) { + if (message.gasWanted !== BigInt(0)) { writer.uint32(40).int64(message.gasWanted); } - - if (!message.gasUsed.isZero()) { + if (message.gasUsed !== BigInt(0)) { writer.uint32(48).int64(message.gasUsed); } - for (const v of message.events) { Event.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.codespace !== "") { writer.uint32(66).string(message.codespace); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCheckTx { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseCheckTx(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.code = reader.uint32(); break; - case 2: message.data = reader.bytes(); break; - case 3: message.log = reader.string(); break; - case 4: message.info = reader.string(); break; - case 5: - message.gasWanted = (reader.int64() as Long); + message.gasWanted = reader.int64(); break; - case 6: - message.gasUsed = (reader.int64() as Long); + message.gasUsed = reader.int64(); break; - case 7: message.events.push(Event.decode(reader, reader.uint32())); break; - case 8: message.codespace = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseCheckTx { + fromPartial(object: Partial): ResponseCheckTx { const message = createBaseResponseCheckTx(); message.code = object.code ?? 0; message.data = object.data ?? new Uint8Array(); message.log = object.log ?? ""; message.info = object.info ?? ""; - message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? Long.fromValue(object.gasWanted) : Long.ZERO; - message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? Long.fromValue(object.gasUsed) : Long.ZERO; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); message.events = object.events?.map(e => Event.fromPartial(e)) || []; message.codespace = object.codespace ?? ""; return message; + }, + fromAmino(object: ResponseCheckTxAmino): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { + const obj: any = {}; + obj.code = message.code; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log; + obj.info = message.info; + obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = []; + } + obj.codespace = message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { + return ResponseCheckTx.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseCheckTxProtoMsg): ResponseCheckTx { + return ResponseCheckTx.decode(message.value); + }, + toProto(message: ResponseCheckTx): Uint8Array { + return ResponseCheckTx.encode(message).finish(); + }, + toProtoMsg(message: ResponseCheckTx): ResponseCheckTxProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseCheckTx", + value: ResponseCheckTx.encode(message).finish() + }; } - }; - function createBaseResponseDeliverTx(): ResponseDeliverTx { return { code: 0, data: new Uint8Array(), log: "", info: "", - gasWanted: Long.ZERO, - gasUsed: Long.ZERO, + gasWanted: BigInt(0), + gasUsed: BigInt(0), events: [], codespace: "" }; } - export const ResponseDeliverTx = { - encode(message: ResponseDeliverTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseDeliverTx", + encode(message: ResponseDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); } - if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } - if (message.log !== "") { writer.uint32(26).string(message.log); } - if (message.info !== "") { writer.uint32(34).string(message.info); } - - if (!message.gasWanted.isZero()) { + if (message.gasWanted !== BigInt(0)) { writer.uint32(40).int64(message.gasWanted); } - - if (!message.gasUsed.isZero()) { + if (message.gasUsed !== BigInt(0)) { writer.uint32(48).int64(message.gasUsed); } - for (const v of message.events) { Event.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.codespace !== "") { writer.uint32(66).string(message.codespace); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseDeliverTx { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseDeliverTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseDeliverTx(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.code = reader.uint32(); break; - case 2: message.data = reader.bytes(); break; - case 3: message.log = reader.string(); break; - case 4: message.info = reader.string(); break; - case 5: - message.gasWanted = (reader.int64() as Long); + message.gasWanted = reader.int64(); break; - case 6: - message.gasUsed = (reader.int64() as Long); + message.gasUsed = reader.int64(); break; - case 7: message.events.push(Event.decode(reader, reader.uint32())); break; - case 8: message.codespace = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseDeliverTx { + fromPartial(object: Partial): ResponseDeliverTx { const message = createBaseResponseDeliverTx(); message.code = object.code ?? 0; message.data = object.data ?? new Uint8Array(); message.log = object.log ?? ""; message.info = object.info ?? ""; - message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? Long.fromValue(object.gasWanted) : Long.ZERO; - message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? Long.fromValue(object.gasUsed) : Long.ZERO; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); message.events = object.events?.map(e => Event.fromPartial(e)) || []; message.codespace = object.codespace ?? ""; return message; + }, + fromAmino(object: ResponseDeliverTxAmino): ResponseDeliverTx { + const message = createBaseResponseDeliverTx(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { + const obj: any = {}; + obj.code = message.code; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log; + obj.info = message.info; + obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = []; + } + obj.codespace = message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { + return ResponseDeliverTx.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseDeliverTxProtoMsg): ResponseDeliverTx { + return ResponseDeliverTx.decode(message.value); + }, + toProto(message: ResponseDeliverTx): Uint8Array { + return ResponseDeliverTx.encode(message).finish(); + }, + toProtoMsg(message: ResponseDeliverTx): ResponseDeliverTxProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseDeliverTx", + value: ResponseDeliverTx.encode(message).finish() + }; } - }; - function createBaseResponseEndBlock(): ResponseEndBlock { return { validatorUpdates: [], @@ -2905,254 +4001,356 @@ function createBaseResponseEndBlock(): ResponseEndBlock { events: [] }; } - export const ResponseEndBlock = { - encode(message: ResponseEndBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseEndBlock", + encode(message: ResponseEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validatorUpdates) { ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.consensusParamUpdates !== undefined) { ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(18).fork()).ldelim(); } - for (const v of message.events) { Event.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEndBlock { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEndBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseEndBlock(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); break; - case 2: message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); break; - case 3: message.events.push(Event.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseEndBlock { + fromPartial(object: Partial): ResponseEndBlock { const message = createBaseResponseEndBlock(); message.validatorUpdates = object.validatorUpdates?.map(e => ValidatorUpdate.fromPartial(e)) || []; message.consensusParamUpdates = object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null ? ConsensusParams.fromPartial(object.consensusParamUpdates) : undefined; message.events = object.events?.map(e => Event.fromPartial(e)) || []; return message; + }, + fromAmino(object: ResponseEndBlockAmino): ResponseEndBlock { + const message = createBaseResponseEndBlock(); + message.validatorUpdates = object.validator_updates?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.consensus_param_updates !== undefined && object.consensus_param_updates !== null) { + message.consensusParamUpdates = ConsensusParams.fromAmino(object.consensus_param_updates); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + return message; + }, + toAmino(message: ResponseEndBlock): ResponseEndBlockAmino { + const obj: any = {}; + if (message.validatorUpdates) { + obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validator_updates = []; + } + obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + fromAminoMsg(object: ResponseEndBlockAminoMsg): ResponseEndBlock { + return ResponseEndBlock.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseEndBlockProtoMsg): ResponseEndBlock { + return ResponseEndBlock.decode(message.value); + }, + toProto(message: ResponseEndBlock): Uint8Array { + return ResponseEndBlock.encode(message).finish(); + }, + toProtoMsg(message: ResponseEndBlock): ResponseEndBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseEndBlock", + value: ResponseEndBlock.encode(message).finish() + }; } - }; - function createBaseResponseCommit(): ResponseCommit { return { data: new Uint8Array(), - retainHeight: Long.ZERO + retainHeight: BigInt(0) }; } - export const ResponseCommit = { - encode(message: ResponseCommit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseCommit", + encode(message: ResponseCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } - - if (!message.retainHeight.isZero()) { + if (message.retainHeight !== BigInt(0)) { writer.uint32(24).int64(message.retainHeight); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCommit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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 2: message.data = reader.bytes(); break; - case 3: - message.retainHeight = (reader.int64() as Long); + message.retainHeight = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseCommit { + fromPartial(object: Partial): ResponseCommit { const message = createBaseResponseCommit(); message.data = object.data ?? new Uint8Array(); - message.retainHeight = object.retainHeight !== undefined && object.retainHeight !== null ? Long.fromValue(object.retainHeight) : Long.ZERO; + message.retainHeight = object.retainHeight !== undefined && object.retainHeight !== null ? BigInt(object.retainHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ResponseCommitAmino): ResponseCommit { + const message = createBaseResponseCommit(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.retain_height !== undefined && object.retain_height !== null) { + message.retainHeight = BigInt(object.retain_height); + } return message; + }, + toAmino(message: ResponseCommit): ResponseCommitAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { + return ResponseCommit.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseCommitProtoMsg): ResponseCommit { + return ResponseCommit.decode(message.value); + }, + toProto(message: ResponseCommit): Uint8Array { + return ResponseCommit.encode(message).finish(); + }, + toProtoMsg(message: ResponseCommit): ResponseCommitProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseCommit", + value: ResponseCommit.encode(message).finish() + }; } - }; - function createBaseResponseListSnapshots(): ResponseListSnapshots { return { snapshots: [] }; } - export const ResponseListSnapshots = { - encode(message: ResponseListSnapshots, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseListSnapshots", + encode(message: ResponseListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.snapshots) { Snapshot.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseListSnapshots { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseListSnapshots(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.snapshots.push(Snapshot.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseListSnapshots { + fromPartial(object: Partial): ResponseListSnapshots { const message = createBaseResponseListSnapshots(); message.snapshots = object.snapshots?.map(e => Snapshot.fromPartial(e)) || []; return message; + }, + fromAmino(object: ResponseListSnapshotsAmino): ResponseListSnapshots { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map(e => Snapshot.fromAmino(e)) || []; + return message; + }, + toAmino(message: ResponseListSnapshots): ResponseListSnapshotsAmino { + const obj: any = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e) : undefined); + } else { + obj.snapshots = []; + } + return obj; + }, + fromAminoMsg(object: ResponseListSnapshotsAminoMsg): ResponseListSnapshots { + return ResponseListSnapshots.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseListSnapshotsProtoMsg): ResponseListSnapshots { + return ResponseListSnapshots.decode(message.value); + }, + toProto(message: ResponseListSnapshots): Uint8Array { + return ResponseListSnapshots.encode(message).finish(); + }, + toProtoMsg(message: ResponseListSnapshots): ResponseListSnapshotsProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseListSnapshots", + value: ResponseListSnapshots.encode(message).finish() + }; } - }; - function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { return { result: 0 }; } - export const ResponseOfferSnapshot = { - encode(message: ResponseOfferSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== 0) { writer.uint32(8).int32(message.result); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseOfferSnapshot { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseOfferSnapshot(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.result = (reader.int32() as any); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseOfferSnapshot { + fromPartial(object: Partial): ResponseOfferSnapshot { const message = createBaseResponseOfferSnapshot(); message.result = object.result ?? 0; return message; + }, + fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + if (object.result !== undefined && object.result !== null) { + message.result = responseOfferSnapshot_ResultFromJSON(object.result); + } + return message; + }, + toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { + const obj: any = {}; + obj.result = responseOfferSnapshot_ResultToJSON(message.result); + return obj; + }, + fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseOfferSnapshotProtoMsg): ResponseOfferSnapshot { + return ResponseOfferSnapshot.decode(message.value); + }, + toProto(message: ResponseOfferSnapshot): Uint8Array { + return ResponseOfferSnapshot.encode(message).finish(); + }, + toProtoMsg(message: ResponseOfferSnapshot): ResponseOfferSnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + value: ResponseOfferSnapshot.encode(message).finish() + }; } - }; - function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { return { chunk: new Uint8Array() }; } - export const ResponseLoadSnapshotChunk = { - encode(message: ResponseLoadSnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chunk.length !== 0) { writer.uint32(10).bytes(message.chunk); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseLoadSnapshotChunk(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.chunk = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseLoadSnapshotChunk { + fromPartial(object: Partial): ResponseLoadSnapshotChunk { const message = createBaseResponseLoadSnapshotChunk(); message.chunk = object.chunk ?? new Uint8Array(); return message; + }, + fromAmino(object: ResponseLoadSnapshotChunkAmino): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = bytesFromBase64(object.chunk); + } + return message; + }, + toAmino(message: ResponseLoadSnapshotChunk): ResponseLoadSnapshotChunkAmino { + const obj: any = {}; + obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseLoadSnapshotChunkAminoMsg): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseLoadSnapshotChunkProtoMsg): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.decode(message.value); + }, + toProto(message: ResponseLoadSnapshotChunk): Uint8Array { + return ResponseLoadSnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: ResponseLoadSnapshotChunk): ResponseLoadSnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + value: ResponseLoadSnapshotChunk.encode(message).finish() + }; } - }; - function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { return { result: 0, @@ -3160,77 +4358,99 @@ function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { rejectSenders: [] }; } - export const ResponseApplySnapshotChunk = { - encode(message: ResponseApplySnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== 0) { writer.uint32(8).int32(message.result); } - writer.uint32(18).fork(); - for (const v of message.refetchChunks) { writer.uint32(v); } - writer.ldelim(); - for (const v of message.rejectSenders) { writer.uint32(26).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseApplySnapshotChunk { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResponseApplySnapshotChunk(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.result = (reader.int32() as any); break; - case 2: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { message.refetchChunks.push(reader.uint32()); } } else { message.refetchChunks.push(reader.uint32()); } - break; - case 3: message.rejectSenders.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ResponseApplySnapshotChunk { + fromPartial(object: Partial): ResponseApplySnapshotChunk { const message = createBaseResponseApplySnapshotChunk(); message.result = object.result ?? 0; message.refetchChunks = object.refetchChunks?.map(e => e) || []; message.rejectSenders = object.rejectSenders?.map(e => e) || []; return message; + }, + fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + if (object.result !== undefined && object.result !== null) { + message.result = responseApplySnapshotChunk_ResultFromJSON(object.result); + } + message.refetchChunks = object.refetch_chunks?.map(e => e) || []; + message.rejectSenders = object.reject_senders?.map(e => e) || []; + return message; + }, + toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { + const obj: any = {}; + obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + if (message.refetchChunks) { + obj.refetch_chunks = message.refetchChunks.map(e => e); + } else { + obj.refetch_chunks = []; + } + if (message.rejectSenders) { + obj.reject_senders = message.rejectSenders.map(e => e); + } else { + obj.reject_senders = []; + } + return obj; + }, + fromAminoMsg(object: ResponseApplySnapshotChunkAminoMsg): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseApplySnapshotChunkProtoMsg): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.decode(message.value); + }, + toProto(message: ResponseApplySnapshotChunk): Uint8Array { + return ResponseApplySnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + value: ResponseApplySnapshotChunk.encode(message).finish() + }; } - }; - function createBaseConsensusParams(): ConsensusParams { return { block: undefined, @@ -3239,238 +4459,326 @@ function createBaseConsensusParams(): ConsensusParams { version: undefined }; } - export const ConsensusParams = { - encode(message: ConsensusParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ConsensusParams", + encode(message: ConsensusParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.block !== undefined) { BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); } - if (message.evidence !== undefined) { EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim(); } - if (message.validator !== undefined) { ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim(); } - if (message.version !== undefined) { VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensusParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.block = BlockParams.decode(reader, reader.uint32()); break; - case 2: message.evidence = EvidenceParams.decode(reader, reader.uint32()); break; - case 3: message.validator = ValidatorParams.decode(reader, reader.uint32()); break; - case 4: message.version = VersionParams.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConsensusParams { + fromPartial(object: Partial): ConsensusParams { const message = createBaseConsensusParams(); message.block = object.block !== undefined && object.block !== null ? BlockParams.fromPartial(object.block) : undefined; message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; message.version = object.version !== undefined && object.version !== null ? VersionParams.fromPartial(object.version) : undefined; return message; + }, + fromAmino(object: ConsensusParamsAmino): ConsensusParams { + const message = createBaseConsensusParams(); + if (object.block !== undefined && object.block !== null) { + message.block = BlockParams.fromAmino(object.block); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceParams.fromAmino(object.evidence); + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = ValidatorParams.fromAmino(object.validator); + } + if (object.version !== undefined && object.version !== null) { + message.version = VersionParams.fromAmino(object.version); + } + return message; + }, + toAmino(message: ConsensusParams): ConsensusParamsAmino { + const obj: any = {}; + obj.block = message.block ? BlockParams.toAmino(message.block) : undefined; + obj.evidence = message.evidence ? EvidenceParams.toAmino(message.evidence) : undefined; + obj.validator = message.validator ? ValidatorParams.toAmino(message.validator) : undefined; + obj.version = message.version ? VersionParams.toAmino(message.version) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusParamsAminoMsg): ConsensusParams { + return ConsensusParams.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusParamsProtoMsg): ConsensusParams { + return ConsensusParams.decode(message.value); + }, + toProto(message: ConsensusParams): Uint8Array { + return ConsensusParams.encode(message).finish(); + }, + toProtoMsg(message: ConsensusParams): ConsensusParamsProtoMsg { + return { + typeUrl: "/tendermint.abci.ConsensusParams", + value: ConsensusParams.encode(message).finish() + }; } - }; - function createBaseBlockParams(): BlockParams { return { - maxBytes: Long.ZERO, - maxGas: Long.ZERO + maxBytes: BigInt(0), + maxGas: BigInt(0) }; } - export const BlockParams = { - encode(message: BlockParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.maxBytes.isZero()) { + typeUrl: "/tendermint.abci.BlockParams", + encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxBytes !== BigInt(0)) { writer.uint32(8).int64(message.maxBytes); } - - if (!message.maxGas.isZero()) { + if (message.maxGas !== BigInt(0)) { writer.uint32(16).int64(message.maxGas); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBlockParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.maxBytes = (reader.int64() as Long); + message.maxBytes = reader.int64(); break; - case 2: - message.maxGas = (reader.int64() as Long); + message.maxGas = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BlockParams { + fromPartial(object: Partial): BlockParams { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); + message.maxGas = object.maxGas !== undefined && object.maxGas !== null ? BigInt(object.maxGas.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BlockParamsAmino): BlockParams { const message = createBaseBlockParams(); - message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? Long.fromValue(object.maxBytes) : Long.ZERO; - message.maxGas = object.maxGas !== undefined && object.maxGas !== null ? Long.fromValue(object.maxGas) : Long.ZERO; + if (object.max_bytes !== undefined && object.max_bytes !== null) { + message.maxBytes = BigInt(object.max_bytes); + } + if (object.max_gas !== undefined && object.max_gas !== null) { + message.maxGas = BigInt(object.max_gas); + } return message; + }, + toAmino(message: BlockParams): BlockParamsAmino { + const obj: any = {}; + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { + return BlockParams.fromAmino(object.value); + }, + fromProtoMsg(message: BlockParamsProtoMsg): BlockParams { + return BlockParams.decode(message.value); + }, + toProto(message: BlockParams): Uint8Array { + return BlockParams.encode(message).finish(); + }, + toProtoMsg(message: BlockParams): BlockParamsProtoMsg { + return { + typeUrl: "/tendermint.abci.BlockParams", + value: BlockParams.encode(message).finish() + }; } - }; - function createBaseLastCommitInfo(): LastCommitInfo { return { round: 0, votes: [] }; } - export const LastCommitInfo = { - encode(message: LastCommitInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.LastCommitInfo", + encode(message: LastCommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.round !== 0) { writer.uint32(8).int32(message.round); } - for (const v of message.votes) { VoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): LastCommitInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): LastCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseLastCommitInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.round = reader.int32(); break; - case 2: message.votes.push(VoteInfo.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): LastCommitInfo { + fromPartial(object: Partial): LastCommitInfo { const message = createBaseLastCommitInfo(); message.round = object.round ?? 0; message.votes = object.votes?.map(e => VoteInfo.fromPartial(e)) || []; return message; + }, + fromAmino(object: LastCommitInfoAmino): LastCommitInfo { + const message = createBaseLastCommitInfo(); + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + message.votes = object.votes?.map(e => VoteInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: LastCommitInfo): LastCommitInfoAmino { + const obj: any = {}; + obj.round = message.round; + if (message.votes) { + obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); + } else { + obj.votes = []; + } + return obj; + }, + fromAminoMsg(object: LastCommitInfoAminoMsg): LastCommitInfo { + return LastCommitInfo.fromAmino(object.value); + }, + fromProtoMsg(message: LastCommitInfoProtoMsg): LastCommitInfo { + return LastCommitInfo.decode(message.value); + }, + toProto(message: LastCommitInfo): Uint8Array { + return LastCommitInfo.encode(message).finish(); + }, + toProtoMsg(message: LastCommitInfo): LastCommitInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.LastCommitInfo", + value: LastCommitInfo.encode(message).finish() + }; } - }; - function createBaseEvent(): Event { return { type: "", attributes: [] }; } - export const Event = { - encode(message: Event, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.Event", + encode(message: Event, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); } - for (const v of message.attributes) { EventAttribute.encode(v!, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Event { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEvent(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.type = reader.string(); break; - case 2: message.attributes.push(EventAttribute.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Event { + fromPartial(object: Partial): Event { const message = createBaseEvent(); message.type = object.type ?? ""; message.attributes = object.attributes?.map(e => EventAttribute.fromPartial(e)) || []; return message; + }, + fromAmino(object: EventAmino): Event { + const message = createBaseEvent(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + message.attributes = object.attributes?.map(e => EventAttribute.fromAmino(e)) || []; + return message; + }, + toAmino(message: Event): EventAmino { + const obj: any = {}; + obj.type = message.type; + if (message.attributes) { + obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); + } else { + obj.attributes = []; + } + return obj; + }, + fromAminoMsg(object: EventAminoMsg): Event { + return Event.fromAmino(object.value); + }, + fromProtoMsg(message: EventProtoMsg): Event { + return Event.decode(message.value); + }, + toProto(message: Event): Uint8Array { + return Event.encode(message).finish(); + }, + toProtoMsg(message: Event): EventProtoMsg { + return { + typeUrl: "/tendermint.abci.Event", + value: Event.encode(message).finish() + }; } - }; - function createBaseEventAttribute(): EventAttribute { return { key: new Uint8Array(), @@ -3478,470 +4786,629 @@ function createBaseEventAttribute(): EventAttribute { index: false }; } - export const EventAttribute = { - encode(message: EventAttribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.EventAttribute", + encode(message: EventAttribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - if (message.index === true) { writer.uint32(24).bool(message.index); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventAttribute { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventAttribute(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: message.value = reader.bytes(); break; - case 3: message.index = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventAttribute { + fromPartial(object: Partial): EventAttribute { const message = createBaseEventAttribute(); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); message.index = object.index ?? false; return message; + }, + fromAmino(object: EventAttributeAmino): EventAttribute { + const message = createBaseEventAttribute(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + return message; + }, + toAmino(message: EventAttribute): EventAttributeAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.index = message.index; + return obj; + }, + fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { + return EventAttribute.fromAmino(object.value); + }, + fromProtoMsg(message: EventAttributeProtoMsg): EventAttribute { + return EventAttribute.decode(message.value); + }, + toProto(message: EventAttribute): Uint8Array { + return EventAttribute.encode(message).finish(); + }, + toProtoMsg(message: EventAttribute): EventAttributeProtoMsg { + return { + typeUrl: "/tendermint.abci.EventAttribute", + value: EventAttribute.encode(message).finish() + }; } - }; - function createBaseTxResult(): TxResult { return { - height: Long.ZERO, + height: BigInt(0), index: 0, tx: new Uint8Array(), - result: undefined + result: ResponseDeliverTx.fromPartial({}) }; } - export const TxResult = { - encode(message: TxResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/tendermint.abci.TxResult", + encode(message: TxResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - if (message.index !== 0) { writer.uint32(16).uint32(message.index); } - if (message.tx.length !== 0) { writer.uint32(26).bytes(message.tx); } - if (message.result !== undefined) { ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TxResult { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTxResult(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 2: message.index = reader.uint32(); break; - case 3: message.tx = reader.bytes(); break; - case 4: message.result = ResponseDeliverTx.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TxResult { + fromPartial(object: Partial): TxResult { const message = createBaseTxResult(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.index = object.index ?? 0; message.tx = object.tx ?? new Uint8Array(); message.result = object.result !== undefined && object.result !== null ? ResponseDeliverTx.fromPartial(object.result) : undefined; return message; + }, + fromAmino(object: TxResultAmino): TxResult { + const message = createBaseTxResult(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + if (object.result !== undefined && object.result !== null) { + message.result = ResponseDeliverTx.fromAmino(object.result); + } + return message; + }, + toAmino(message: TxResult): TxResultAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.index = message.index; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: TxResultAminoMsg): TxResult { + return TxResult.fromAmino(object.value); + }, + fromProtoMsg(message: TxResultProtoMsg): TxResult { + return TxResult.decode(message.value); + }, + toProto(message: TxResult): Uint8Array { + return TxResult.encode(message).finish(); + }, + toProtoMsg(message: TxResult): TxResultProtoMsg { + return { + typeUrl: "/tendermint.abci.TxResult", + value: TxResult.encode(message).finish() + }; } - }; - function createBaseValidator(): Validator { return { address: new Uint8Array(), - power: Long.ZERO + power: BigInt(0) }; } - export const Validator = { - encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.Validator", + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address.length !== 0) { writer.uint32(10).bytes(message.address); } - - if (!message.power.isZero()) { + if (message.power !== BigInt(0)) { writer.uint32(24).int64(message.power); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Validator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidator(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.bytes(); break; - case 3: - message.power = (reader.int64() as Long); + message.power = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Validator { + fromPartial(object: Partial): Validator { const message = createBaseValidator(); message.address = object.address ?? new Uint8Array(); - message.power = object.power !== undefined && object.power !== null ? Long.fromValue(object.power) : Long.ZERO; + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.address !== undefined && object.address !== null) { + message.address = bytesFromBase64(object.address); + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address ? base64FromBytes(message.address) : undefined; + obj.power = message.power ? message.power.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/tendermint.abci.Validator", + value: Validator.encode(message).finish() + }; } - }; - function createBaseValidatorUpdate(): ValidatorUpdate { return { - pubKey: undefined, - power: Long.ZERO + pubKey: PublicKey.fromPartial({}), + power: BigInt(0) }; } - export const ValidatorUpdate = { - encode(message: ValidatorUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.ValidatorUpdate", + encode(message: ValidatorUpdate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); } - - if (!message.power.isZero()) { + if (message.power !== BigInt(0)) { writer.uint32(16).int64(message.power); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorUpdate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorUpdate(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pubKey = PublicKey.decode(reader, reader.uint32()); break; - case 2: - message.power = (reader.int64() as Long); + message.power = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorUpdate { + fromPartial(object: Partial): ValidatorUpdate { const message = createBaseValidatorUpdate(); message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; - message.power = object.power !== undefined && object.power !== null ? Long.fromValue(object.power) : Long.ZERO; + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); return message; + }, + fromAmino(object: ValidatorUpdateAmino): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } + return message; + }, + toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.power = message.power ? message.power.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { + return ValidatorUpdate.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorUpdateProtoMsg): ValidatorUpdate { + return ValidatorUpdate.decode(message.value); + }, + toProto(message: ValidatorUpdate): Uint8Array { + return ValidatorUpdate.encode(message).finish(); + }, + toProtoMsg(message: ValidatorUpdate): ValidatorUpdateProtoMsg { + return { + typeUrl: "/tendermint.abci.ValidatorUpdate", + value: ValidatorUpdate.encode(message).finish() + }; } - }; - function createBaseVoteInfo(): VoteInfo { return { - validator: undefined, + validator: Validator.fromPartial({}), signedLastBlock: false }; } - export const VoteInfo = { - encode(message: VoteInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.VoteInfo", + encode(message: VoteInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); } - if (message.signedLastBlock === true) { writer.uint32(16).bool(message.signedLastBlock); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VoteInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVoteInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validator = Validator.decode(reader, reader.uint32()); break; - case 2: message.signedLastBlock = reader.bool(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): VoteInfo { + fromPartial(object: Partial): VoteInfo { const message = createBaseVoteInfo(); message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; message.signedLastBlock = object.signedLastBlock ?? false; return message; + }, + fromAmino(object: VoteInfoAmino): VoteInfo { + const message = createBaseVoteInfo(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + if (object.signed_last_block !== undefined && object.signed_last_block !== null) { + message.signedLastBlock = object.signed_last_block; + } + return message; + }, + toAmino(message: VoteInfo): VoteInfoAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.signed_last_block = message.signedLastBlock; + return obj; + }, + fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { + return VoteInfo.fromAmino(object.value); + }, + fromProtoMsg(message: VoteInfoProtoMsg): VoteInfo { + return VoteInfo.decode(message.value); + }, + toProto(message: VoteInfo): Uint8Array { + return VoteInfo.encode(message).finish(); + }, + toProtoMsg(message: VoteInfo): VoteInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.VoteInfo", + value: VoteInfo.encode(message).finish() + }; } - }; - function createBaseEvidence(): Evidence { return { type: 0, - validator: undefined, - height: Long.ZERO, - time: undefined, - totalVotingPower: Long.ZERO + validator: Validator.fromPartial({}), + height: BigInt(0), + time: new Date(), + totalVotingPower: BigInt(0) }; } - export const Evidence = { - encode(message: Evidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.abci.Evidence", + encode(message: Evidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } - if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(24).int64(message.height); } - if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); } - - if (!message.totalVotingPower.isZero()) { + if (message.totalVotingPower !== BigInt(0)) { writer.uint32(40).int64(message.totalVotingPower); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Evidence { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEvidence(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.type = (reader.int32() as any); break; - case 2: message.validator = Validator.decode(reader, reader.uint32()); break; - case 3: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 4: message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 5: - message.totalVotingPower = (reader.int64() as Long); + message.totalVotingPower = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Evidence { + fromPartial(object: Partial): Evidence { const message = createBaseEvidence(); message.type = object.type ?? 0; message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.time = object.time ?? undefined; - message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? Long.fromValue(object.totalVotingPower) : Long.ZERO; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EvidenceAmino): Evidence { + const message = createBaseEvidence(); + if (object.type !== undefined && object.type !== null) { + message.type = evidenceTypeFromJSON(object.type); + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } return message; + }, + toAmino(message: Evidence): EvidenceAmino { + const obj: any = {}; + obj.type = evidenceTypeToJSON(message.type); + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.height = message.height ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceAminoMsg): Evidence { + return Evidence.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceProtoMsg): Evidence { + return Evidence.decode(message.value); + }, + toProto(message: Evidence): Uint8Array { + return Evidence.encode(message).finish(); + }, + toProtoMsg(message: Evidence): EvidenceProtoMsg { + return { + typeUrl: "/tendermint.abci.Evidence", + value: Evidence.encode(message).finish() + }; } - }; - function createBaseSnapshot(): Snapshot { return { - height: Long.UZERO, + height: BigInt(0), format: 0, chunks: 0, hash: new Uint8Array(), metadata: new Uint8Array() }; } - export const Snapshot = { - encode(message: Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/tendermint.abci.Snapshot", + encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); } - if (message.format !== 0) { writer.uint32(16).uint32(message.format); } - if (message.chunks !== 0) { writer.uint32(24).uint32(message.chunks); } - if (message.hash.length !== 0) { writer.uint32(34).bytes(message.hash); } - if (message.metadata.length !== 0) { writer.uint32(42).bytes(message.metadata); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSnapshot(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.uint64() as Long); + message.height = reader.uint64(); break; - case 2: message.format = reader.uint32(); break; - case 3: message.chunks = reader.uint32(); break; - case 4: message.hash = reader.bytes(); break; - case 5: message.metadata = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Snapshot { + fromPartial(object: Partial): Snapshot { const message = createBaseSnapshot(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.UZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.format = object.format ?? 0; message.chunks = object.chunks ?? 0; message.hash = object.hash ?? new Uint8Array(); message.metadata = object.metadata ?? new Uint8Array(); return message; + }, + fromAmino(object: SnapshotAmino): Snapshot { + const message = createBaseSnapshot(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunks !== undefined && object.chunks !== null) { + message.chunks = object.chunks; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = bytesFromBase64(object.metadata); + } + return message; + }, + toAmino(message: Snapshot): SnapshotAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.format = message.format; + obj.chunks = message.chunks; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotAminoMsg): Snapshot { + return Snapshot.fromAmino(object.value); + }, + fromProtoMsg(message: SnapshotProtoMsg): Snapshot { + return Snapshot.decode(message.value); + }, + toProto(message: Snapshot): Uint8Array { + return Snapshot.encode(message).finish(); + }, + toProtoMsg(message: Snapshot): SnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.Snapshot", + value: Snapshot.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/bundle.ts b/src/codegen/tendermint/bundle.ts index ce7d6fb..2878f9b 100644 --- a/src/codegen/tendermint/bundle.ts +++ b/src/codegen/tendermint/bundle.ts @@ -10,23 +10,29 @@ import * as _134 from "./types/types"; import * as _135 from "./types/validator"; import * as _136 from "./version/types"; export namespace tendermint { - export const abci = { ..._126 + export const abci = { + ..._126 }; - export const crypto = { ..._127, + export const crypto = { + ..._127, ..._128 }; export namespace libs { - export const bits = { ..._129 + export const bits = { + ..._129 }; } - export const p2p = { ..._130 + export const p2p = { + ..._130 }; - export const types = { ..._131, + export const types = { + ..._131, ..._132, ..._133, ..._134, ..._135 }; - export const version = { ..._136 + export const version = { + ..._136 }; } \ No newline at end of file diff --git a/src/codegen/tendermint/crypto/keys.ts b/src/codegen/tendermint/crypto/keys.ts index 21481d0..548b1ad 100644 --- a/src/codegen/tendermint/crypto/keys.ts +++ b/src/codegen/tendermint/crypto/keys.ts @@ -1,69 +1,100 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../helpers"; /** PublicKey defines the keys available for use with Tendermint Validators */ - export interface PublicKey { ed25519?: Uint8Array; secp256k1?: Uint8Array; } +export interface PublicKeyProtoMsg { + typeUrl: "/tendermint.crypto.PublicKey"; + value: Uint8Array; +} +/** PublicKey defines the keys available for use with Tendermint Validators */ +export interface PublicKeyAmino { + ed25519?: string; + secp256k1?: string; +} +export interface PublicKeyAminoMsg { + type: "/tendermint.crypto.PublicKey"; + value: PublicKeyAmino; +} /** PublicKey defines the keys available for use with Tendermint Validators */ - export interface PublicKeySDKType { ed25519?: Uint8Array; secp256k1?: Uint8Array; } - function createBasePublicKey(): PublicKey { return { ed25519: undefined, secp256k1: undefined }; } - export const PublicKey = { - encode(message: PublicKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.crypto.PublicKey", + encode(message: PublicKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ed25519 !== undefined) { writer.uint32(10).bytes(message.ed25519); } - if (message.secp256k1 !== undefined) { writer.uint32(18).bytes(message.secp256k1); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PublicKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePublicKey(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.ed25519 = reader.bytes(); break; - case 2: message.secp256k1 = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PublicKey { + fromPartial(object: Partial): PublicKey { const message = createBasePublicKey(); message.ed25519 = object.ed25519 ?? undefined; message.secp256k1 = object.secp256k1 ?? undefined; return message; + }, + fromAmino(object: PublicKeyAmino): PublicKey { + const message = createBasePublicKey(); + if (object.ed25519 !== undefined && object.ed25519 !== null) { + message.ed25519 = bytesFromBase64(object.ed25519); + } + if (object.secp256k1 !== undefined && object.secp256k1 !== null) { + message.secp256k1 = bytesFromBase64(object.secp256k1); + } + return message; + }, + toAmino(message: PublicKey): PublicKeyAmino { + const obj: any = {}; + obj.ed25519 = message.ed25519 ? base64FromBytes(message.ed25519) : undefined; + obj.secp256k1 = message.secp256k1 ? base64FromBytes(message.secp256k1) : undefined; + return obj; + }, + fromAminoMsg(object: PublicKeyAminoMsg): PublicKey { + return PublicKey.fromAmino(object.value); + }, + fromProtoMsg(message: PublicKeyProtoMsg): PublicKey { + return PublicKey.decode(message.value); + }, + toProto(message: PublicKey): Uint8Array { + return PublicKey.encode(message).finish(); + }, + toProtoMsg(message: PublicKey): PublicKeyProtoMsg { + return { + typeUrl: "/tendermint.crypto.PublicKey", + value: PublicKey.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/crypto/proof.ts b/src/codegen/tendermint/crypto/proof.ts index 5fe2d81..8d91ce1 100644 --- a/src/codegen/tendermint/crypto/proof.ts +++ b/src/codegen/tendermint/crypto/proof.ts @@ -1,14 +1,28 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../helpers"; export interface Proof { - total: Long; - index: Long; + total: bigint; + index: bigint; leafHash: Uint8Array; aunts: Uint8Array[]; } +export interface ProofProtoMsg { + typeUrl: "/tendermint.crypto.Proof"; + value: Uint8Array; +} +export interface ProofAmino { + total?: string; + index?: string; + leaf_hash?: string; + aunts?: string[]; +} +export interface ProofAminoMsg { + type: "/tendermint.crypto.Proof"; + value: ProofAmino; +} export interface ProofSDKType { - total: Long; - index: Long; + total: bigint; + index: bigint; leaf_hash: Uint8Array; aunts: Uint8Array[]; } @@ -16,14 +30,24 @@ export interface ValueOp { /** Encoded in ProofOp.Key. */ key: Uint8Array; /** To encode in ProofOp.Data */ - proof?: Proof; } -export interface ValueOpSDKType { +export interface ValueOpProtoMsg { + typeUrl: "/tendermint.crypto.ValueOp"; + value: Uint8Array; +} +export interface ValueOpAmino { /** Encoded in ProofOp.Key. */ - key: Uint8Array; + key?: string; /** To encode in ProofOp.Data */ - + proof?: ProofAmino; +} +export interface ValueOpAminoMsg { + type: "/tendermint.crypto.ValueOp"; + value: ValueOpAmino; +} +export interface ValueOpSDKType { + key: Uint8Array; proof?: ProofSDKType; } export interface DominoOp { @@ -31,6 +55,19 @@ export interface DominoOp { input: string; output: string; } +export interface DominoOpProtoMsg { + typeUrl: "/tendermint.crypto.DominoOp"; + value: Uint8Array; +} +export interface DominoOpAmino { + key?: string; + input?: string; + output?: string; +} +export interface DominoOpAminoMsg { + type: "/tendermint.crypto.DominoOp"; + value: DominoOpAmino; +} export interface DominoOpSDKType { key: string; input: string; @@ -41,164 +78,235 @@ export interface DominoOpSDKType { * The data could be arbitrary format, providing nessecary data * for example neighbouring node hash */ - export interface ProofOp { type: string; key: Uint8Array; data: Uint8Array; } +export interface ProofOpProtoMsg { + typeUrl: "/tendermint.crypto.ProofOp"; + value: Uint8Array; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOpAmino { + type?: string; + key?: string; + data?: string; +} +export interface ProofOpAminoMsg { + type: "/tendermint.crypto.ProofOp"; + value: ProofOpAmino; +} /** * 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 ProofOpSDKType { type: string; key: Uint8Array; data: Uint8Array; } /** ProofOps is Merkle proof defined by the list of ProofOps */ - export interface ProofOps { ops: ProofOp[]; } +export interface ProofOpsProtoMsg { + typeUrl: "/tendermint.crypto.ProofOps"; + value: Uint8Array; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOpsAmino { + ops?: ProofOpAmino[]; +} +export interface ProofOpsAminoMsg { + type: "/tendermint.crypto.ProofOps"; + value: ProofOpsAmino; +} /** ProofOps is Merkle proof defined by the list of ProofOps */ - export interface ProofOpsSDKType { ops: ProofOpSDKType[]; } - function createBaseProof(): Proof { return { - total: Long.ZERO, - index: Long.ZERO, + total: BigInt(0), + index: BigInt(0), leafHash: new Uint8Array(), aunts: [] }; } - export const Proof = { - encode(message: Proof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.total.isZero()) { + typeUrl: "/tendermint.crypto.Proof", + encode(message: Proof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.total !== BigInt(0)) { writer.uint32(8).int64(message.total); } - - if (!message.index.isZero()) { + if (message.index !== BigInt(0)) { writer.uint32(16).int64(message.index); } - if (message.leafHash.length !== 0) { writer.uint32(26).bytes(message.leafHash); } - for (const v of message.aunts) { writer.uint32(34).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Proof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.total = (reader.int64() as Long); + message.total = reader.int64(); break; - case 2: - message.index = (reader.int64() as Long); + message.index = reader.int64(); break; - case 3: message.leafHash = reader.bytes(); break; - case 4: message.aunts.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Proof { + fromPartial(object: Partial): Proof { const message = createBaseProof(); - message.total = object.total !== undefined && object.total !== null ? Long.fromValue(object.total) : Long.ZERO; - message.index = object.index !== undefined && object.index !== null ? Long.fromValue(object.index) : Long.ZERO; + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); message.leafHash = object.leafHash ?? new Uint8Array(); message.aunts = object.aunts?.map(e => e) || []; return message; + }, + fromAmino(object: ProofAmino): Proof { + const message = createBaseProof(); + if (object.total !== undefined && object.total !== null) { + message.total = BigInt(object.total); + } + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + if (object.leaf_hash !== undefined && object.leaf_hash !== null) { + message.leafHash = bytesFromBase64(object.leaf_hash); + } + message.aunts = object.aunts?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Proof): ProofAmino { + const obj: any = {}; + obj.total = message.total ? message.total.toString() : undefined; + obj.index = message.index ? message.index.toString() : undefined; + obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; + if (message.aunts) { + obj.aunts = message.aunts.map(e => base64FromBytes(e)); + } else { + obj.aunts = []; + } + return obj; + }, + fromAminoMsg(object: ProofAminoMsg): Proof { + return Proof.fromAmino(object.value); + }, + fromProtoMsg(message: ProofProtoMsg): Proof { + return Proof.decode(message.value); + }, + toProto(message: Proof): Uint8Array { + return Proof.encode(message).finish(); + }, + toProtoMsg(message: Proof): ProofProtoMsg { + return { + typeUrl: "/tendermint.crypto.Proof", + value: Proof.encode(message).finish() + }; } - }; - function createBaseValueOp(): ValueOp { return { key: new Uint8Array(), proof: undefined }; } - export const ValueOp = { - encode(message: ValueOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.crypto.ValueOp", + encode(message: ValueOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); } - if (message.proof !== undefined) { Proof.encode(message.proof, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValueOp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValueOp(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.bytes(); break; - case 2: message.proof = Proof.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValueOp { + fromPartial(object: Partial): ValueOp { const message = createBaseValueOp(); message.key = object.key ?? new Uint8Array(); message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; return message; + }, + fromAmino(object: ValueOpAmino): ValueOp { + const message = createBaseValueOp(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: ValueOp): ValueOpAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: ValueOpAminoMsg): ValueOp { + return ValueOp.fromAmino(object.value); + }, + fromProtoMsg(message: ValueOpProtoMsg): ValueOp { + return ValueOp.decode(message.value); + }, + toProto(message: ValueOp): Uint8Array { + return ValueOp.encode(message).finish(); + }, + toProtoMsg(message: ValueOp): ValueOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.ValueOp", + value: ValueOp.encode(message).finish() + }; } - }; - function createBaseDominoOp(): DominoOp { return { key: "", @@ -206,64 +314,86 @@ function createBaseDominoOp(): DominoOp { output: "" }; } - export const DominoOp = { - encode(message: DominoOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.crypto.DominoOp", + encode(message: DominoOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.input !== "") { writer.uint32(18).string(message.input); } - if (message.output !== "") { writer.uint32(26).string(message.output); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DominoOp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDominoOp(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.key = reader.string(); break; - case 2: message.input = reader.string(); break; - case 3: message.output = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DominoOp { + fromPartial(object: Partial): DominoOp { const message = createBaseDominoOp(); message.key = object.key ?? ""; message.input = object.input ?? ""; message.output = object.output ?? ""; return message; + }, + fromAmino(object: DominoOpAmino): DominoOp { + const message = createBaseDominoOp(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.input !== undefined && object.input !== null) { + message.input = object.input; + } + if (object.output !== undefined && object.output !== null) { + message.output = object.output; + } + return message; + }, + toAmino(message: DominoOp): DominoOpAmino { + const obj: any = {}; + obj.key = message.key; + obj.input = message.input; + obj.output = message.output; + return obj; + }, + fromAminoMsg(object: DominoOpAminoMsg): DominoOp { + return DominoOp.fromAmino(object.value); + }, + fromProtoMsg(message: DominoOpProtoMsg): DominoOp { + return DominoOp.decode(message.value); + }, + toProto(message: DominoOp): Uint8Array { + return DominoOp.encode(message).finish(); + }, + toProtoMsg(message: DominoOp): DominoOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.DominoOp", + value: DominoOp.encode(message).finish() + }; } - }; - function createBaseProofOp(): ProofOp { return { type: "", @@ -271,105 +401,148 @@ function createBaseProofOp(): ProofOp { data: new Uint8Array() }; } - export const ProofOp = { - encode(message: ProofOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.crypto.ProofOp", + encode(message: ProofOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); } - if (message.key.length !== 0) { writer.uint32(18).bytes(message.key); } - if (message.data.length !== 0) { writer.uint32(26).bytes(message.data); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ProofOp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProofOp(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.type = reader.string(); break; - case 2: message.key = reader.bytes(); break; - case 3: message.data = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ProofOp { + fromPartial(object: Partial): ProofOp { const message = createBaseProofOp(); message.type = object.type ?? ""; message.key = object.key ?? new Uint8Array(); message.data = object.data ?? new Uint8Array(); return message; + }, + fromAmino(object: ProofOpAmino): ProofOp { + const message = createBaseProofOp(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: ProofOp): ProofOpAmino { + const obj: any = {}; + obj.type = message.type; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: ProofOpAminoMsg): ProofOp { + return ProofOp.fromAmino(object.value); + }, + fromProtoMsg(message: ProofOpProtoMsg): ProofOp { + return ProofOp.decode(message.value); + }, + toProto(message: ProofOp): Uint8Array { + return ProofOp.encode(message).finish(); + }, + toProtoMsg(message: ProofOp): ProofOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.ProofOp", + value: ProofOp.encode(message).finish() + }; } - }; - function createBaseProofOps(): ProofOps { return { ops: [] }; } - export const ProofOps = { - encode(message: ProofOps, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.crypto.ProofOps", + encode(message: ProofOps, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.ops) { ProofOp.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ProofOps { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProofOps(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.ops.push(ProofOp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ProofOps { + fromPartial(object: Partial): ProofOps { const message = createBaseProofOps(); message.ops = object.ops?.map(e => ProofOp.fromPartial(e)) || []; return message; + }, + fromAmino(object: ProofOpsAmino): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map(e => ProofOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: ProofOps): ProofOpsAmino { + const obj: any = {}; + if (message.ops) { + obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e) : undefined); + } else { + obj.ops = []; + } + return obj; + }, + fromAminoMsg(object: ProofOpsAminoMsg): ProofOps { + return ProofOps.fromAmino(object.value); + }, + fromProtoMsg(message: ProofOpsProtoMsg): ProofOps { + return ProofOps.decode(message.value); + }, + toProto(message: ProofOps): Uint8Array { + return ProofOps.encode(message).finish(); + }, + toProtoMsg(message: ProofOps): ProofOpsProtoMsg { + return { + typeUrl: "/tendermint.crypto.ProofOps", + value: ProofOps.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/libs/bits/types.ts b/src/codegen/tendermint/libs/bits/types.ts index 1c65e19..8e9cb41 100644 --- a/src/codegen/tendermint/libs/bits/types.ts +++ b/src/codegen/tendermint/libs/bits/types.ts @@ -1,77 +1,107 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; export interface BitArray { - bits: Long; - elems: Long[]; + bits: bigint; + elems: bigint[]; +} +export interface BitArrayProtoMsg { + typeUrl: "/tendermint.libs.bits.BitArray"; + value: Uint8Array; +} +export interface BitArrayAmino { + bits?: string; + elems?: string[]; +} +export interface BitArrayAminoMsg { + type: "/tendermint.libs.bits.BitArray"; + value: BitArrayAmino; } export interface BitArraySDKType { - bits: Long; - elems: Long[]; + bits: bigint; + elems: bigint[]; } - function createBaseBitArray(): BitArray { return { - bits: Long.ZERO, + bits: BigInt(0), elems: [] }; } - export const BitArray = { - encode(message: BitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.bits.isZero()) { + typeUrl: "/tendermint.libs.bits.BitArray", + encode(message: BitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bits !== BigInt(0)) { writer.uint32(8).int64(message.bits); } - writer.uint32(18).fork(); - for (const v of message.elems) { writer.uint64(v); } - writer.ldelim(); return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BitArray { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.bits = (reader.int64() as Long); + message.bits = reader.int64(); break; - case 2: if ((tag & 7) === 2) { const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.elems.push((reader.uint64() as Long)); + message.elems.push(reader.uint64()); } } else { - message.elems.push((reader.uint64() as Long)); + message.elems.push(reader.uint64()); } - break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BitArray { + fromPartial(object: Partial): BitArray { const message = createBaseBitArray(); - message.bits = object.bits !== undefined && object.bits !== null ? Long.fromValue(object.bits) : Long.ZERO; - message.elems = object.elems?.map(e => Long.fromValue(e)) || []; + message.bits = object.bits !== undefined && object.bits !== null ? BigInt(object.bits.toString()) : BigInt(0); + message.elems = object.elems?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: BitArrayAmino): BitArray { + const message = createBaseBitArray(); + if (object.bits !== undefined && object.bits !== null) { + message.bits = BigInt(object.bits); + } + message.elems = object.elems?.map(e => BigInt(e)) || []; return message; + }, + toAmino(message: BitArray): BitArrayAmino { + const obj: any = {}; + obj.bits = message.bits ? message.bits.toString() : undefined; + if (message.elems) { + obj.elems = message.elems.map(e => e.toString()); + } else { + obj.elems = []; + } + return obj; + }, + fromAminoMsg(object: BitArrayAminoMsg): BitArray { + return BitArray.fromAmino(object.value); + }, + fromProtoMsg(message: BitArrayProtoMsg): BitArray { + return BitArray.decode(message.value); + }, + toProto(message: BitArray): Uint8Array { + return BitArray.encode(message).finish(); + }, + toProtoMsg(message: BitArray): BitArrayProtoMsg { + return { + typeUrl: "/tendermint.libs.bits.BitArray", + value: BitArray.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/p2p/types.ts b/src/codegen/tendermint/p2p/types.ts index 62bd43a..76ecc8e 100644 --- a/src/codegen/tendermint/p2p/types.ts +++ b/src/codegen/tendermint/p2p/types.ts @@ -1,40 +1,83 @@ import { Timestamp } from "../../google/protobuf/timestamp"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; export interface ProtocolVersion { - p2p: Long; - block: Long; - app: Long; + p2p: bigint; + block: bigint; + app: bigint; +} +export interface ProtocolVersionProtoMsg { + typeUrl: "/tendermint.p2p.ProtocolVersion"; + value: Uint8Array; +} +export interface ProtocolVersionAmino { + p2p?: string; + block?: string; + app?: string; +} +export interface ProtocolVersionAminoMsg { + type: "/tendermint.p2p.ProtocolVersion"; + value: ProtocolVersionAmino; } export interface ProtocolVersionSDKType { - p2p: Long; - block: Long; - app: Long; + p2p: bigint; + block: bigint; + app: bigint; } export interface NodeInfo { - protocolVersion?: ProtocolVersion; + protocolVersion: ProtocolVersion; nodeId: string; listenAddr: string; network: string; version: string; channels: Uint8Array; moniker: string; - other?: NodeInfoOther; + other: NodeInfoOther; +} +export interface NodeInfoProtoMsg { + typeUrl: "/tendermint.p2p.NodeInfo"; + value: Uint8Array; +} +export interface NodeInfoAmino { + protocol_version?: ProtocolVersionAmino; + node_id?: string; + listen_addr?: string; + network?: string; + version?: string; + channels?: string; + moniker?: string; + other?: NodeInfoOtherAmino; +} +export interface NodeInfoAminoMsg { + type: "/tendermint.p2p.NodeInfo"; + value: NodeInfoAmino; } export interface NodeInfoSDKType { - protocol_version?: ProtocolVersionSDKType; + protocol_version: ProtocolVersionSDKType; node_id: string; listen_addr: string; network: string; version: string; channels: Uint8Array; moniker: string; - other?: NodeInfoOtherSDKType; + other: NodeInfoOtherSDKType; } export interface NodeInfoOther { txIndex: string; rpcAddress: string; } +export interface NodeInfoOtherProtoMsg { + typeUrl: "/tendermint.p2p.NodeInfoOther"; + value: Uint8Array; +} +export interface NodeInfoOtherAmino { + tx_index?: string; + rpc_address?: string; +} +export interface NodeInfoOtherAminoMsg { + type: "/tendermint.p2p.NodeInfoOther"; + value: NodeInfoOtherAmino; +} export interface NodeInfoOtherSDKType { tx_index: string; rpc_address: string; @@ -44,6 +87,19 @@ export interface PeerInfo { addressInfo: PeerAddressInfo[]; lastConnected?: Date; } +export interface PeerInfoProtoMsg { + typeUrl: "/tendermint.p2p.PeerInfo"; + value: Uint8Array; +} +export interface PeerInfoAmino { + id?: string; + address_info?: PeerAddressInfoAmino[]; + last_connected?: string; +} +export interface PeerInfoAminoMsg { + type: "/tendermint.p2p.PeerInfo"; + value: PeerInfoAmino; +} export interface PeerInfoSDKType { id: string; address_info: PeerAddressInfoSDKType[]; @@ -55,179 +111,193 @@ export interface PeerAddressInfo { lastDialFailure?: Date; dialFailures: number; } +export interface PeerAddressInfoProtoMsg { + typeUrl: "/tendermint.p2p.PeerAddressInfo"; + value: Uint8Array; +} +export interface PeerAddressInfoAmino { + address?: string; + last_dial_success?: string; + last_dial_failure?: string; + dial_failures?: number; +} +export interface PeerAddressInfoAminoMsg { + type: "/tendermint.p2p.PeerAddressInfo"; + value: PeerAddressInfoAmino; +} export interface PeerAddressInfoSDKType { address: string; last_dial_success?: Date; last_dial_failure?: Date; dial_failures: number; } - function createBaseProtocolVersion(): ProtocolVersion { return { - p2p: Long.UZERO, - block: Long.UZERO, - app: Long.UZERO + p2p: BigInt(0), + block: BigInt(0), + app: BigInt(0) }; } - export const ProtocolVersion = { - encode(message: ProtocolVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.p2p.isZero()) { + typeUrl: "/tendermint.p2p.ProtocolVersion", + encode(message: ProtocolVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.p2p !== BigInt(0)) { writer.uint32(8).uint64(message.p2p); } - - if (!message.block.isZero()) { + if (message.block !== BigInt(0)) { writer.uint32(16).uint64(message.block); } - - if (!message.app.isZero()) { + if (message.app !== BigInt(0)) { writer.uint32(24).uint64(message.app); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ProtocolVersion { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: - message.p2p = (reader.uint64() as Long); + message.p2p = reader.uint64(); break; - case 2: - message.block = (reader.uint64() as Long); + message.block = reader.uint64(); break; - case 3: - message.app = (reader.uint64() as Long); + message.app = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ProtocolVersion { + fromPartial(object: Partial): ProtocolVersion { const message = createBaseProtocolVersion(); - message.p2p = object.p2p !== undefined && object.p2p !== null ? Long.fromValue(object.p2p) : Long.UZERO; - message.block = object.block !== undefined && object.block !== null ? Long.fromValue(object.block) : Long.UZERO; - message.app = object.app !== undefined && object.app !== null ? Long.fromValue(object.app) : Long.UZERO; + message.p2p = object.p2p !== undefined && object.p2p !== null ? BigInt(object.p2p.toString()) : BigInt(0); + message.block = object.block !== undefined && object.block !== null ? BigInt(object.block.toString()) : BigInt(0); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ProtocolVersionAmino): ProtocolVersion { + const message = createBaseProtocolVersion(); + if (object.p2p !== undefined && object.p2p !== null) { + message.p2p = BigInt(object.p2p); + } + if (object.block !== undefined && object.block !== null) { + message.block = BigInt(object.block); + } + if (object.app !== undefined && object.app !== null) { + message.app = BigInt(object.app); + } return message; + }, + toAmino(message: ProtocolVersion): ProtocolVersionAmino { + const obj: any = {}; + obj.p2p = message.p2p ? message.p2p.toString() : undefined; + obj.block = message.block ? message.block.toString() : undefined; + obj.app = message.app ? message.app.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { + return ProtocolVersion.fromAmino(object.value); + }, + fromProtoMsg(message: ProtocolVersionProtoMsg): ProtocolVersion { + return ProtocolVersion.decode(message.value); + }, + toProto(message: ProtocolVersion): Uint8Array { + return ProtocolVersion.encode(message).finish(); + }, + toProtoMsg(message: ProtocolVersion): ProtocolVersionProtoMsg { + return { + typeUrl: "/tendermint.p2p.ProtocolVersion", + value: ProtocolVersion.encode(message).finish() + }; } - }; - function createBaseNodeInfo(): NodeInfo { return { - protocolVersion: undefined, + protocolVersion: ProtocolVersion.fromPartial({}), nodeId: "", listenAddr: "", network: "", version: "", channels: new Uint8Array(), moniker: "", - other: undefined + other: NodeInfoOther.fromPartial({}) }; } - export const NodeInfo = { - encode(message: NodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.p2p.NodeInfo", + encode(message: NodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.protocolVersion !== undefined) { ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).ldelim(); } - if (message.nodeId !== "") { writer.uint32(18).string(message.nodeId); } - 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) { NodeInfoOther.encode(message.other, writer.uint32(66).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): NodeInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): NodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNodeInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.protocolVersion = ProtocolVersion.decode(reader, reader.uint32()); break; - case 2: message.nodeId = reader.string(); break; - case 3: message.listenAddr = reader.string(); break; - case 4: message.network = reader.string(); break; - case 5: message.version = reader.string(); break; - case 6: message.channels = reader.bytes(); break; - case 7: message.moniker = reader.string(); break; - case 8: message.other = NodeInfoOther.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): NodeInfo { + fromPartial(object: Partial): NodeInfo { const message = createBaseNodeInfo(); message.protocolVersion = object.protocolVersion !== undefined && object.protocolVersion !== null ? ProtocolVersion.fromPartial(object.protocolVersion) : undefined; message.nodeId = object.nodeId ?? ""; @@ -238,65 +308,138 @@ export const NodeInfo = { message.moniker = object.moniker ?? ""; message.other = object.other !== undefined && object.other !== null ? NodeInfoOther.fromPartial(object.other) : undefined; return message; + }, + fromAmino(object: NodeInfoAmino): NodeInfo { + const message = createBaseNodeInfo(); + if (object.protocol_version !== undefined && object.protocol_version !== null) { + message.protocolVersion = ProtocolVersion.fromAmino(object.protocol_version); + } + if (object.node_id !== undefined && object.node_id !== null) { + message.nodeId = object.node_id; + } + if (object.listen_addr !== undefined && object.listen_addr !== null) { + message.listenAddr = object.listen_addr; + } + if (object.network !== undefined && object.network !== null) { + message.network = object.network; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.channels !== undefined && object.channels !== null) { + message.channels = bytesFromBase64(object.channels); + } + if (object.moniker !== undefined && object.moniker !== null) { + message.moniker = object.moniker; + } + if (object.other !== undefined && object.other !== null) { + message.other = NodeInfoOther.fromAmino(object.other); + } + return message; + }, + toAmino(message: NodeInfo): NodeInfoAmino { + const obj: any = {}; + obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; + obj.node_id = message.nodeId; + obj.listen_addr = message.listenAddr; + obj.network = message.network; + obj.version = message.version; + obj.channels = message.channels ? base64FromBytes(message.channels) : undefined; + obj.moniker = message.moniker; + obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; + return obj; + }, + fromAminoMsg(object: NodeInfoAminoMsg): NodeInfo { + return NodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: NodeInfoProtoMsg): NodeInfo { + return NodeInfo.decode(message.value); + }, + toProto(message: NodeInfo): Uint8Array { + return NodeInfo.encode(message).finish(); + }, + toProtoMsg(message: NodeInfo): NodeInfoProtoMsg { + return { + typeUrl: "/tendermint.p2p.NodeInfo", + value: NodeInfo.encode(message).finish() + }; } - }; - function createBaseNodeInfoOther(): NodeInfoOther { return { txIndex: "", rpcAddress: "" }; } - export const NodeInfoOther = { - encode(message: NodeInfoOther, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.p2p.NodeInfoOther", + encode(message: NodeInfoOther, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txIndex !== "") { writer.uint32(10).string(message.txIndex); } - if (message.rpcAddress !== "") { writer.uint32(18).string(message.rpcAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): NodeInfoOther { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): NodeInfoOther { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseNodeInfoOther(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.txIndex = reader.string(); break; - case 2: message.rpcAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): NodeInfoOther { + fromPartial(object: Partial): NodeInfoOther { const message = createBaseNodeInfoOther(); message.txIndex = object.txIndex ?? ""; message.rpcAddress = object.rpcAddress ?? ""; return message; + }, + fromAmino(object: NodeInfoOtherAmino): NodeInfoOther { + const message = createBaseNodeInfoOther(); + if (object.tx_index !== undefined && object.tx_index !== null) { + message.txIndex = object.tx_index; + } + if (object.rpc_address !== undefined && object.rpc_address !== null) { + message.rpcAddress = object.rpc_address; + } + return message; + }, + toAmino(message: NodeInfoOther): NodeInfoOtherAmino { + const obj: any = {}; + obj.tx_index = message.txIndex; + obj.rpc_address = message.rpcAddress; + return obj; + }, + fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { + return NodeInfoOther.fromAmino(object.value); + }, + fromProtoMsg(message: NodeInfoOtherProtoMsg): NodeInfoOther { + return NodeInfoOther.decode(message.value); + }, + toProto(message: NodeInfoOther): Uint8Array { + return NodeInfoOther.encode(message).finish(); + }, + toProtoMsg(message: NodeInfoOther): NodeInfoOtherProtoMsg { + return { + typeUrl: "/tendermint.p2p.NodeInfoOther", + value: NodeInfoOther.encode(message).finish() + }; } - }; - function createBasePeerInfo(): PeerInfo { return { id: "", @@ -304,64 +447,88 @@ function createBasePeerInfo(): PeerInfo { lastConnected: undefined }; } - export const PeerInfo = { - encode(message: PeerInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.p2p.PeerInfo", + encode(message: PeerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); } - for (const v of message.addressInfo) { PeerAddressInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.lastConnected !== undefined) { Timestamp.encode(toTimestamp(message.lastConnected), writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PeerInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PeerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePeerInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.id = reader.string(); break; - case 2: message.addressInfo.push(PeerAddressInfo.decode(reader, reader.uint32())); break; - case 3: message.lastConnected = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PeerInfo { + fromPartial(object: Partial): PeerInfo { const message = createBasePeerInfo(); message.id = object.id ?? ""; message.addressInfo = object.addressInfo?.map(e => PeerAddressInfo.fromPartial(e)) || []; message.lastConnected = object.lastConnected ?? undefined; return message; + }, + fromAmino(object: PeerInfoAmino): PeerInfo { + const message = createBasePeerInfo(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + message.addressInfo = object.address_info?.map(e => PeerAddressInfo.fromAmino(e)) || []; + if (object.last_connected !== undefined && object.last_connected !== null) { + message.lastConnected = fromTimestamp(Timestamp.fromAmino(object.last_connected)); + } + return message; + }, + toAmino(message: PeerInfo): PeerInfoAmino { + const obj: any = {}; + obj.id = message.id; + if (message.addressInfo) { + obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); + } else { + obj.address_info = []; + } + obj.last_connected = message.lastConnected ? Timestamp.toAmino(toTimestamp(message.lastConnected)) : undefined; + return obj; + }, + fromAminoMsg(object: PeerInfoAminoMsg): PeerInfo { + return PeerInfo.fromAmino(object.value); + }, + fromProtoMsg(message: PeerInfoProtoMsg): PeerInfo { + return PeerInfo.decode(message.value); + }, + toProto(message: PeerInfo): Uint8Array { + return PeerInfo.encode(message).finish(); + }, + toProtoMsg(message: PeerInfo): PeerInfoProtoMsg { + return { + typeUrl: "/tendermint.p2p.PeerInfo", + value: PeerInfo.encode(message).finish() + }; } - }; - function createBasePeerAddressInfo(): PeerAddressInfo { return { address: "", @@ -370,69 +537,94 @@ function createBasePeerAddressInfo(): PeerAddressInfo { dialFailures: 0 }; } - export const PeerAddressInfo = { - encode(message: PeerAddressInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.p2p.PeerAddressInfo", + encode(message: PeerAddressInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.lastDialSuccess !== undefined) { Timestamp.encode(toTimestamp(message.lastDialSuccess), writer.uint32(18).fork()).ldelim(); } - if (message.lastDialFailure !== undefined) { Timestamp.encode(toTimestamp(message.lastDialFailure), writer.uint32(26).fork()).ldelim(); } - if (message.dialFailures !== 0) { writer.uint32(32).uint32(message.dialFailures); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PeerAddressInfo { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PeerAddressInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePeerAddressInfo(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.lastDialSuccess = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 3: message.lastDialFailure = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 4: message.dialFailures = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PeerAddressInfo { + fromPartial(object: Partial): PeerAddressInfo { const message = createBasePeerAddressInfo(); message.address = object.address ?? ""; message.lastDialSuccess = object.lastDialSuccess ?? undefined; message.lastDialFailure = object.lastDialFailure ?? undefined; message.dialFailures = object.dialFailures ?? 0; return message; + }, + fromAmino(object: PeerAddressInfoAmino): PeerAddressInfo { + const message = createBasePeerAddressInfo(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.last_dial_success !== undefined && object.last_dial_success !== null) { + message.lastDialSuccess = fromTimestamp(Timestamp.fromAmino(object.last_dial_success)); + } + if (object.last_dial_failure !== undefined && object.last_dial_failure !== null) { + message.lastDialFailure = fromTimestamp(Timestamp.fromAmino(object.last_dial_failure)); + } + if (object.dial_failures !== undefined && object.dial_failures !== null) { + message.dialFailures = object.dial_failures; + } + return message; + }, + toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { + const obj: any = {}; + obj.address = message.address; + obj.last_dial_success = message.lastDialSuccess ? Timestamp.toAmino(toTimestamp(message.lastDialSuccess)) : undefined; + obj.last_dial_failure = message.lastDialFailure ? Timestamp.toAmino(toTimestamp(message.lastDialFailure)) : undefined; + obj.dial_failures = message.dialFailures; + return obj; + }, + fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { + return PeerAddressInfo.fromAmino(object.value); + }, + fromProtoMsg(message: PeerAddressInfoProtoMsg): PeerAddressInfo { + return PeerAddressInfo.decode(message.value); + }, + toProto(message: PeerAddressInfo): Uint8Array { + return PeerAddressInfo.encode(message).finish(); + }, + toProtoMsg(message: PeerAddressInfo): PeerAddressInfoProtoMsg { + return { + typeUrl: "/tendermint.p2p.PeerAddressInfo", + value: PeerAddressInfo.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/types/block.ts b/src/codegen/tendermint/types/block.ts index 1e384d2..08b90c5 100644 --- a/src/codegen/tendermint/types/block.ts +++ b/src/codegen/tendermint/types/block.ts @@ -1,91 +1,128 @@ -import { Header, HeaderSDKType, Data, DataSDKType, Commit, CommitSDKType } from "./types"; -import { EvidenceList, EvidenceListSDKType } from "./evidence"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../helpers"; +import { Header, HeaderAmino, HeaderSDKType, Data, DataAmino, DataSDKType, Commit, CommitAmino, CommitSDKType } from "./types"; +import { EvidenceList, EvidenceListAmino, EvidenceListSDKType } from "./evidence"; +import { BinaryReader, BinaryWriter } from "../../binary"; export interface Block { - header?: Header; - data?: Data; - evidence?: EvidenceList; + header: Header; + data: Data; + evidence: EvidenceList; lastCommit?: Commit; } +export interface BlockProtoMsg { + typeUrl: "/tendermint.types.Block"; + value: Uint8Array; +} +export interface BlockAmino { + header?: HeaderAmino; + data?: DataAmino; + evidence?: EvidenceListAmino; + last_commit?: CommitAmino; +} +export interface BlockAminoMsg { + type: "/tendermint.types.Block"; + value: BlockAmino; +} export interface BlockSDKType { - header?: HeaderSDKType; - data?: DataSDKType; - evidence?: EvidenceListSDKType; + header: HeaderSDKType; + data: DataSDKType; + evidence: EvidenceListSDKType; last_commit?: CommitSDKType; } - function createBaseBlock(): Block { return { - header: undefined, - data: undefined, - evidence: undefined, + header: Header.fromPartial({}), + data: Data.fromPartial({}), + evidence: EvidenceList.fromPartial({}), lastCommit: undefined }; } - export const Block = { - encode(message: Block, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.Block", + encode(message: Block, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); } - if (message.data !== undefined) { Data.encode(message.data, writer.uint32(18).fork()).ldelim(); } - if (message.evidence !== undefined) { EvidenceList.encode(message.evidence, writer.uint32(26).fork()).ldelim(); } - if (message.lastCommit !== undefined) { Commit.encode(message.lastCommit, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Block { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBlock(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.header = Header.decode(reader, reader.uint32()); break; - case 2: message.data = Data.decode(reader, reader.uint32()); break; - case 3: message.evidence = EvidenceList.decode(reader, reader.uint32()); break; - case 4: message.lastCommit = Commit.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Block { + fromPartial(object: Partial): Block { const message = createBaseBlock(); message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; message.data = object.data !== undefined && object.data !== null ? Data.fromPartial(object.data) : undefined; message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceList.fromPartial(object.evidence) : undefined; message.lastCommit = object.lastCommit !== undefined && object.lastCommit !== null ? Commit.fromPartial(object.lastCommit) : undefined; return message; + }, + fromAmino(object: BlockAmino): Block { + const message = createBaseBlock(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.data !== undefined && object.data !== null) { + message.data = Data.fromAmino(object.data); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceList.fromAmino(object.evidence); + } + if (object.last_commit !== undefined && object.last_commit !== null) { + message.lastCommit = Commit.fromAmino(object.last_commit); + } + return message; + }, + toAmino(message: Block): BlockAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.data = message.data ? Data.toAmino(message.data) : undefined; + obj.evidence = message.evidence ? EvidenceList.toAmino(message.evidence) : undefined; + obj.last_commit = message.lastCommit ? Commit.toAmino(message.lastCommit) : undefined; + return obj; + }, + fromAminoMsg(object: BlockAminoMsg): Block { + return Block.fromAmino(object.value); + }, + fromProtoMsg(message: BlockProtoMsg): Block { + return Block.decode(message.value); + }, + toProto(message: Block): Uint8Array { + return Block.encode(message).finish(); + }, + toProtoMsg(message: Block): BlockProtoMsg { + return { + typeUrl: "/tendermint.types.Block", + value: Block.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/types/evidence.ts b/src/codegen/tendermint/types/evidence.ts index 8cf8b58..e51429d 100644 --- a/src/codegen/tendermint/types/evidence.ts +++ b/src/codegen/tendermint/types/evidence.ts @@ -1,325 +1,470 @@ -import { Vote, VoteSDKType, LightBlock, LightBlockSDKType } from "./types"; +import { Vote, VoteAmino, VoteSDKType, LightBlock, LightBlockAmino, LightBlockSDKType } from "./types"; import { Timestamp } from "../../google/protobuf/timestamp"; -import { Validator, ValidatorSDKType } from "./validator"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, toTimestamp, Long, fromTimestamp } from "../../helpers"; +import { Validator, ValidatorAmino, ValidatorSDKType } from "./validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { toTimestamp, fromTimestamp } from "../../helpers"; export interface Evidence { duplicateVoteEvidence?: DuplicateVoteEvidence; lightClientAttackEvidence?: LightClientAttackEvidence; } +export interface EvidenceProtoMsg { + typeUrl: "/tendermint.types.Evidence"; + value: Uint8Array; +} +export interface EvidenceAmino { + duplicate_vote_evidence?: DuplicateVoteEvidenceAmino; + light_client_attack_evidence?: LightClientAttackEvidenceAmino; +} +export interface EvidenceAminoMsg { + type: "/tendermint.types.Evidence"; + value: EvidenceAmino; +} export interface EvidenceSDKType { duplicate_vote_evidence?: DuplicateVoteEvidenceSDKType; light_client_attack_evidence?: LightClientAttackEvidenceSDKType; } /** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ - export interface DuplicateVoteEvidence { voteA?: Vote; voteB?: Vote; - totalVotingPower: Long; - validatorPower: Long; - timestamp?: Date; + totalVotingPower: bigint; + validatorPower: bigint; + timestamp: Date; +} +export interface DuplicateVoteEvidenceProtoMsg { + typeUrl: "/tendermint.types.DuplicateVoteEvidence"; + value: Uint8Array; +} +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidenceAmino { + vote_a?: VoteAmino; + vote_b?: VoteAmino; + total_voting_power?: string; + validator_power?: string; + timestamp?: string; +} +export interface DuplicateVoteEvidenceAminoMsg { + type: "/tendermint.types.DuplicateVoteEvidence"; + value: DuplicateVoteEvidenceAmino; } /** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ - export interface DuplicateVoteEvidenceSDKType { vote_a?: VoteSDKType; vote_b?: VoteSDKType; - total_voting_power: Long; - validator_power: Long; - timestamp?: Date; + total_voting_power: bigint; + validator_power: bigint; + timestamp: Date; } /** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ - export interface LightClientAttackEvidence { conflictingBlock?: LightBlock; - commonHeight: Long; + commonHeight: bigint; byzantineValidators: Validator[]; - totalVotingPower: Long; - timestamp?: Date; + totalVotingPower: bigint; + timestamp: Date; +} +export interface LightClientAttackEvidenceProtoMsg { + typeUrl: "/tendermint.types.LightClientAttackEvidence"; + value: Uint8Array; +} +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidenceAmino { + conflicting_block?: LightBlockAmino; + common_height?: string; + byzantine_validators?: ValidatorAmino[]; + total_voting_power?: string; + timestamp?: string; +} +export interface LightClientAttackEvidenceAminoMsg { + type: "/tendermint.types.LightClientAttackEvidence"; + value: LightClientAttackEvidenceAmino; } /** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ - export interface LightClientAttackEvidenceSDKType { conflicting_block?: LightBlockSDKType; - common_height: Long; + common_height: bigint; byzantine_validators: ValidatorSDKType[]; - total_voting_power: Long; - timestamp?: Date; + total_voting_power: bigint; + timestamp: Date; } export interface EvidenceList { evidence: Evidence[]; } +export interface EvidenceListProtoMsg { + typeUrl: "/tendermint.types.EvidenceList"; + value: Uint8Array; +} +export interface EvidenceListAmino { + evidence?: EvidenceAmino[]; +} +export interface EvidenceListAminoMsg { + type: "/tendermint.types.EvidenceList"; + value: EvidenceListAmino; +} export interface EvidenceListSDKType { evidence: EvidenceSDKType[]; } - function createBaseEvidence(): Evidence { return { duplicateVoteEvidence: undefined, lightClientAttackEvidence: undefined }; } - export const Evidence = { - encode(message: Evidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.Evidence", + encode(message: Evidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.duplicateVoteEvidence !== undefined) { DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).ldelim(); } - if (message.lightClientAttackEvidence !== undefined) { LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Evidence { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEvidence(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.duplicateVoteEvidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); break; - case 2: message.lightClientAttackEvidence = LightClientAttackEvidence.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Evidence { + fromPartial(object: Partial): Evidence { const message = createBaseEvidence(); message.duplicateVoteEvidence = object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) : undefined; message.lightClientAttackEvidence = object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) : undefined; return message; + }, + fromAmino(object: EvidenceAmino): Evidence { + const message = createBaseEvidence(); + if (object.duplicate_vote_evidence !== undefined && object.duplicate_vote_evidence !== null) { + message.duplicateVoteEvidence = DuplicateVoteEvidence.fromAmino(object.duplicate_vote_evidence); + } + if (object.light_client_attack_evidence !== undefined && object.light_client_attack_evidence !== null) { + message.lightClientAttackEvidence = LightClientAttackEvidence.fromAmino(object.light_client_attack_evidence); + } + return message; + }, + toAmino(message: Evidence): EvidenceAmino { + const obj: any = {}; + obj.duplicate_vote_evidence = message.duplicateVoteEvidence ? DuplicateVoteEvidence.toAmino(message.duplicateVoteEvidence) : undefined; + obj.light_client_attack_evidence = message.lightClientAttackEvidence ? LightClientAttackEvidence.toAmino(message.lightClientAttackEvidence) : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceAminoMsg): Evidence { + return Evidence.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceProtoMsg): Evidence { + return Evidence.decode(message.value); + }, + toProto(message: Evidence): Uint8Array { + return Evidence.encode(message).finish(); + }, + toProtoMsg(message: Evidence): EvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.Evidence", + value: Evidence.encode(message).finish() + }; } - }; - function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { return { voteA: undefined, voteB: undefined, - totalVotingPower: Long.ZERO, - validatorPower: Long.ZERO, - timestamp: undefined + totalVotingPower: BigInt(0), + validatorPower: BigInt(0), + timestamp: new Date() }; } - export const DuplicateVoteEvidence = { - encode(message: DuplicateVoteEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.DuplicateVoteEvidence", + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.voteA !== undefined) { Vote.encode(message.voteA, writer.uint32(10).fork()).ldelim(); } - if (message.voteB !== undefined) { Vote.encode(message.voteB, writer.uint32(18).fork()).ldelim(); } - - if (!message.totalVotingPower.isZero()) { + if (message.totalVotingPower !== BigInt(0)) { writer.uint32(24).int64(message.totalVotingPower); } - - if (!message.validatorPower.isZero()) { + if (message.validatorPower !== BigInt(0)) { writer.uint32(32).int64(message.validatorPower); } - if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DuplicateVoteEvidence { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuplicateVoteEvidence(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.voteA = Vote.decode(reader, reader.uint32()); break; - case 2: message.voteB = Vote.decode(reader, reader.uint32()); break; - case 3: - message.totalVotingPower = (reader.int64() as Long); + message.totalVotingPower = reader.int64(); break; - case 4: - message.validatorPower = (reader.int64() as Long); + message.validatorPower = reader.int64(); break; - case 5: message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): DuplicateVoteEvidence { + fromPartial(object: Partial): DuplicateVoteEvidence { const message = createBaseDuplicateVoteEvidence(); message.voteA = object.voteA !== undefined && object.voteA !== null ? Vote.fromPartial(object.voteA) : undefined; message.voteB = object.voteB !== undefined && object.voteB !== null ? Vote.fromPartial(object.voteB) : undefined; - message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? Long.fromValue(object.totalVotingPower) : Long.ZERO; - message.validatorPower = object.validatorPower !== undefined && object.validatorPower !== null ? Long.fromValue(object.validatorPower) : Long.ZERO; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + message.validatorPower = object.validatorPower !== undefined && object.validatorPower !== null ? BigInt(object.validatorPower.toString()) : BigInt(0); message.timestamp = object.timestamp ?? undefined; return message; + }, + fromAmino(object: DuplicateVoteEvidenceAmino): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + if (object.vote_a !== undefined && object.vote_a !== null) { + message.voteA = Vote.fromAmino(object.vote_a); + } + if (object.vote_b !== undefined && object.vote_b !== null) { + message.voteB = Vote.fromAmino(object.vote_b); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + if (object.validator_power !== undefined && object.validator_power !== null) { + message.validatorPower = BigInt(object.validator_power); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + return message; + }, + toAmino(message: DuplicateVoteEvidence): DuplicateVoteEvidenceAmino { + const obj: any = {}; + obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; + obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; + obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + return obj; + }, + fromAminoMsg(object: DuplicateVoteEvidenceAminoMsg): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromAmino(object.value); + }, + fromProtoMsg(message: DuplicateVoteEvidenceProtoMsg): DuplicateVoteEvidence { + return DuplicateVoteEvidence.decode(message.value); + }, + toProto(message: DuplicateVoteEvidence): Uint8Array { + return DuplicateVoteEvidence.encode(message).finish(); + }, + toProtoMsg(message: DuplicateVoteEvidence): DuplicateVoteEvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.DuplicateVoteEvidence", + value: DuplicateVoteEvidence.encode(message).finish() + }; } - }; - function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { return { conflictingBlock: undefined, - commonHeight: Long.ZERO, + commonHeight: BigInt(0), byzantineValidators: [], - totalVotingPower: Long.ZERO, - timestamp: undefined + totalVotingPower: BigInt(0), + timestamp: new Date() }; } - export const LightClientAttackEvidence = { - encode(message: LightClientAttackEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.LightClientAttackEvidence", + encode(message: LightClientAttackEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.conflictingBlock !== undefined) { LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).ldelim(); } - - if (!message.commonHeight.isZero()) { + if (message.commonHeight !== BigInt(0)) { writer.uint32(16).int64(message.commonHeight); } - for (const v of message.byzantineValidators) { Validator.encode(v!, writer.uint32(26).fork()).ldelim(); } - - if (!message.totalVotingPower.isZero()) { + if (message.totalVotingPower !== BigInt(0)) { writer.uint32(32).int64(message.totalVotingPower); } - if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): LightClientAttackEvidence { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseLightClientAttackEvidence(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.conflictingBlock = LightBlock.decode(reader, reader.uint32()); break; - case 2: - message.commonHeight = (reader.int64() as Long); + message.commonHeight = reader.int64(); break; - case 3: message.byzantineValidators.push(Validator.decode(reader, reader.uint32())); break; - case 4: - message.totalVotingPower = (reader.int64() as Long); + message.totalVotingPower = reader.int64(); break; - case 5: message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): LightClientAttackEvidence { + fromPartial(object: Partial): LightClientAttackEvidence { const message = createBaseLightClientAttackEvidence(); message.conflictingBlock = object.conflictingBlock !== undefined && object.conflictingBlock !== null ? LightBlock.fromPartial(object.conflictingBlock) : undefined; - message.commonHeight = object.commonHeight !== undefined && object.commonHeight !== null ? Long.fromValue(object.commonHeight) : Long.ZERO; + message.commonHeight = object.commonHeight !== undefined && object.commonHeight !== null ? BigInt(object.commonHeight.toString()) : BigInt(0); message.byzantineValidators = object.byzantineValidators?.map(e => Validator.fromPartial(e)) || []; - message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? Long.fromValue(object.totalVotingPower) : Long.ZERO; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); message.timestamp = object.timestamp ?? undefined; return message; + }, + fromAmino(object: LightClientAttackEvidenceAmino): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + if (object.conflicting_block !== undefined && object.conflicting_block !== null) { + message.conflictingBlock = LightBlock.fromAmino(object.conflicting_block); + } + if (object.common_height !== undefined && object.common_height !== null) { + message.commonHeight = BigInt(object.common_height); + } + message.byzantineValidators = object.byzantine_validators?.map(e => Validator.fromAmino(e)) || []; + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + return message; + }, + toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { + const obj: any = {}; + obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; + obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + if (message.byzantineValidators) { + obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.byzantine_validators = []; + } + obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + return obj; + }, + fromAminoMsg(object: LightClientAttackEvidenceAminoMsg): LightClientAttackEvidence { + return LightClientAttackEvidence.fromAmino(object.value); + }, + fromProtoMsg(message: LightClientAttackEvidenceProtoMsg): LightClientAttackEvidence { + return LightClientAttackEvidence.decode(message.value); + }, + toProto(message: LightClientAttackEvidence): Uint8Array { + return LightClientAttackEvidence.encode(message).finish(); + }, + toProtoMsg(message: LightClientAttackEvidence): LightClientAttackEvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.LightClientAttackEvidence", + value: LightClientAttackEvidence.encode(message).finish() + }; } - }; - function createBaseEvidenceList(): EvidenceList { return { evidence: [] }; } - export const EvidenceList = { - encode(message: EvidenceList, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.EvidenceList", + encode(message: EvidenceList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Evidence.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceList { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEvidenceList(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.evidence.push(Evidence.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EvidenceList { + fromPartial(object: Partial): EvidenceList { const message = createBaseEvidenceList(); message.evidence = object.evidence?.map(e => Evidence.fromPartial(e)) || []; return message; + }, + fromAmino(object: EvidenceListAmino): EvidenceList { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map(e => Evidence.fromAmino(e)) || []; + return message; + }, + toAmino(message: EvidenceList): EvidenceListAmino { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e) : undefined); + } else { + obj.evidence = []; + } + return obj; + }, + fromAminoMsg(object: EvidenceListAminoMsg): EvidenceList { + return EvidenceList.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceListProtoMsg): EvidenceList { + return EvidenceList.decode(message.value); + }, + toProto(message: EvidenceList): Uint8Array { + return EvidenceList.encode(message).finish(); + }, + toProtoMsg(message: EvidenceList): EvidenceListProtoMsg { + return { + typeUrl: "/tendermint.types.EvidenceList", + value: EvidenceList.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/types/params.ts b/src/codegen/tendermint/types/params.ts index 8239d81..44d9107 100644 --- a/src/codegen/tendermint/types/params.ts +++ b/src/codegen/tendermint/types/params.ts @@ -1,76 +1,98 @@ -import { Duration, DurationSDKType } from "../../google/protobuf/duration"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../helpers"; +import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../binary"; /** * ConsensusParams contains consensus critical parameters that determine the * validity of blocks. */ - export interface ConsensusParams { - block?: BlockParams; - evidence?: EvidenceParams; - validator?: ValidatorParams; - version?: VersionParams; + block: BlockParams; + evidence: EvidenceParams; + validator: ValidatorParams; + version: VersionParams; +} +export interface ConsensusParamsProtoMsg { + typeUrl: "/tendermint.types.ConsensusParams"; + value: Uint8Array; +} +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParamsAmino { + block?: BlockParamsAmino; + evidence?: EvidenceParamsAmino; + validator?: ValidatorParamsAmino; + version?: VersionParamsAmino; +} +export interface ConsensusParamsAminoMsg { + type: "/tendermint.types.ConsensusParams"; + value: ConsensusParamsAmino; } /** * ConsensusParams contains consensus critical parameters that determine the * validity of blocks. */ - export interface ConsensusParamsSDKType { - block?: BlockParamsSDKType; - evidence?: EvidenceParamsSDKType; - validator?: ValidatorParamsSDKType; - version?: VersionParamsSDKType; + block: BlockParamsSDKType; + evidence: EvidenceParamsSDKType; + validator: ValidatorParamsSDKType; + version: VersionParamsSDKType; } /** BlockParams contains limits on the block size. */ - export interface BlockParams { /** * Max block size, in bytes. * Note: must be greater than 0 */ - maxBytes: Long; + maxBytes: bigint; /** * Max gas per block. * Note: must be greater or equal to -1 */ - - maxGas: Long; + maxGas: bigint; /** * Minimum time increment between consecutive blocks (in milliseconds) If the * block header timestamp is ahead of the system clock, decrease this value. * * Not exposed to the application. */ - - timeIotaMs: Long; + timeIotaMs: bigint; +} +export interface BlockParamsProtoMsg { + typeUrl: "/tendermint.types.BlockParams"; + value: Uint8Array; } /** BlockParams contains limits on the block size. */ - -export interface BlockParamsSDKType { +export interface BlockParamsAmino { /** * Max block size, in bytes. * Note: must be greater than 0 */ - max_bytes: Long; + max_bytes?: string; /** * Max gas per block. * Note: must be greater or equal to -1 */ - - max_gas: Long; + max_gas?: string; /** * Minimum time increment between consecutive blocks (in milliseconds) If the * block header timestamp is ahead of the system clock, decrease this value. * * Not exposed to the application. */ - - time_iota_ms: Long; + time_iota_ms?: string; +} +export interface BlockParamsAminoMsg { + type: "/tendermint.types.BlockParams"; + value: BlockParamsAmino; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParamsSDKType { + max_bytes: bigint; + max_gas: bigint; + time_iota_ms: bigint; } /** EvidenceParams determine how we handle evidence of malfeasance. */ - export interface EvidenceParams { /** * Max age of evidence, in blocks. @@ -78,7 +100,7 @@ export interface EvidenceParams { * The basic formula for calculating this is: MaxAgeDuration / {average block * time}. */ - maxAgeNumBlocks: Long; + maxAgeNumBlocks: bigint; /** * Max age of evidence, in time. * @@ -86,26 +108,27 @@ export interface EvidenceParams { * 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; + maxAgeDuration: Duration; /** * This sets the maximum size of total evidence in bytes that can be committed in a single block. * and should fall comfortably under the max block bytes. * Default is 1048576 or 1MB */ - - maxBytes: Long; + maxBytes: bigint; +} +export interface EvidenceParamsProtoMsg { + typeUrl: "/tendermint.types.EvidenceParams"; + value: Uint8Array; } /** EvidenceParams determine how we handle evidence of malfeasance. */ - -export interface EvidenceParamsSDKType { +export interface EvidenceParamsAmino { /** * Max age of evidence, in blocks. * * The basic formula for calculating this is: MaxAgeDuration / {average block * time}. */ - max_age_num_blocks: Long; + max_age_num_blocks?: string; /** * Max age of evidence, in time. * @@ -113,409 +136,581 @@ export interface EvidenceParamsSDKType { * mechanism for handling [Nothing-At-Stake * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). */ - - max_age_duration?: DurationSDKType; + max_age_duration?: DurationAmino; /** * This sets the maximum size of total evidence in bytes that can be committed in a single block. * and should fall comfortably under the max block bytes. * Default is 1048576 or 1MB */ - - max_bytes: Long; + max_bytes?: string; +} +export interface EvidenceParamsAminoMsg { + type: "/tendermint.types.EvidenceParams"; + value: EvidenceParamsAmino; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParamsSDKType { + max_age_num_blocks: bigint; + max_age_duration: DurationSDKType; + max_bytes: bigint; } /** * ValidatorParams restrict the public key types validators can use. * NOTE: uses ABCI pubkey naming, not Amino names. */ - export interface ValidatorParams { pubKeyTypes: string[]; } +export interface ValidatorParamsProtoMsg { + typeUrl: "/tendermint.types.ValidatorParams"; + value: Uint8Array; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParamsAmino { + pub_key_types?: string[]; +} +export interface ValidatorParamsAminoMsg { + type: "/tendermint.types.ValidatorParams"; + value: ValidatorParamsAmino; +} /** * ValidatorParams restrict the public key types validators can use. * NOTE: uses ABCI pubkey naming, not Amino names. */ - export interface ValidatorParamsSDKType { pub_key_types: string[]; } /** VersionParams contains the ABCI application version. */ - export interface VersionParams { - appVersion: Long; + appVersion: bigint; +} +export interface VersionParamsProtoMsg { + typeUrl: "/tendermint.types.VersionParams"; + value: Uint8Array; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParamsAmino { + app_version?: string; +} +export interface VersionParamsAminoMsg { + type: "/tendermint.types.VersionParams"; + value: VersionParamsAmino; } /** VersionParams contains the ABCI application version. */ - export interface VersionParamsSDKType { - app_version: Long; + app_version: bigint; } /** * HashedParams is a subset of ConsensusParams. * * It is hashed into the Header.ConsensusHash. */ - export interface HashedParams { - blockMaxBytes: Long; - blockMaxGas: Long; + blockMaxBytes: bigint; + blockMaxGas: bigint; +} +export interface HashedParamsProtoMsg { + typeUrl: "/tendermint.types.HashedParams"; + value: Uint8Array; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParamsAmino { + block_max_bytes?: string; + block_max_gas?: string; +} +export interface HashedParamsAminoMsg { + type: "/tendermint.types.HashedParams"; + value: HashedParamsAmino; } /** * HashedParams is a subset of ConsensusParams. * * It is hashed into the Header.ConsensusHash. */ - export interface HashedParamsSDKType { - block_max_bytes: Long; - block_max_gas: Long; + block_max_bytes: bigint; + block_max_gas: bigint; } - function createBaseConsensusParams(): ConsensusParams { return { - block: undefined, - evidence: undefined, - validator: undefined, - version: undefined + block: BlockParams.fromPartial({}), + evidence: EvidenceParams.fromPartial({}), + validator: ValidatorParams.fromPartial({}), + version: VersionParams.fromPartial({}) }; } - export const ConsensusParams = { - encode(message: ConsensusParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.ConsensusParams", + encode(message: ConsensusParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.block !== undefined) { BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); } - if (message.evidence !== undefined) { EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim(); } - if (message.validator !== undefined) { ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim(); } - if (message.version !== undefined) { VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensusParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.block = BlockParams.decode(reader, reader.uint32()); break; - case 2: message.evidence = EvidenceParams.decode(reader, reader.uint32()); break; - case 3: message.validator = ValidatorParams.decode(reader, reader.uint32()); break; - case 4: message.version = VersionParams.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ConsensusParams { + fromPartial(object: Partial): ConsensusParams { const message = createBaseConsensusParams(); message.block = object.block !== undefined && object.block !== null ? BlockParams.fromPartial(object.block) : undefined; message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; message.version = object.version !== undefined && object.version !== null ? VersionParams.fromPartial(object.version) : undefined; return message; + }, + fromAmino(object: ConsensusParamsAmino): ConsensusParams { + const message = createBaseConsensusParams(); + if (object.block !== undefined && object.block !== null) { + message.block = BlockParams.fromAmino(object.block); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceParams.fromAmino(object.evidence); + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = ValidatorParams.fromAmino(object.validator); + } + if (object.version !== undefined && object.version !== null) { + message.version = VersionParams.fromAmino(object.version); + } + return message; + }, + toAmino(message: ConsensusParams): ConsensusParamsAmino { + const obj: any = {}; + obj.block = message.block ? BlockParams.toAmino(message.block) : undefined; + obj.evidence = message.evidence ? EvidenceParams.toAmino(message.evidence) : undefined; + obj.validator = message.validator ? ValidatorParams.toAmino(message.validator) : undefined; + obj.version = message.version ? VersionParams.toAmino(message.version) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusParamsAminoMsg): ConsensusParams { + return ConsensusParams.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusParamsProtoMsg): ConsensusParams { + return ConsensusParams.decode(message.value); + }, + toProto(message: ConsensusParams): Uint8Array { + return ConsensusParams.encode(message).finish(); + }, + toProtoMsg(message: ConsensusParams): ConsensusParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ConsensusParams", + value: ConsensusParams.encode(message).finish() + }; } - }; - function createBaseBlockParams(): BlockParams { return { - maxBytes: Long.ZERO, - maxGas: Long.ZERO, - timeIotaMs: Long.ZERO + maxBytes: BigInt(0), + maxGas: BigInt(0), + timeIotaMs: BigInt(0) }; } - export const BlockParams = { - encode(message: BlockParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.maxBytes.isZero()) { + typeUrl: "/tendermint.types.BlockParams", + encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxBytes !== BigInt(0)) { writer.uint32(8).int64(message.maxBytes); } - - if (!message.maxGas.isZero()) { + if (message.maxGas !== BigInt(0)) { writer.uint32(16).int64(message.maxGas); } - - if (!message.timeIotaMs.isZero()) { + if (message.timeIotaMs !== BigInt(0)) { writer.uint32(24).int64(message.timeIotaMs); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBlockParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.maxBytes = (reader.int64() as Long); + message.maxBytes = reader.int64(); break; - case 2: - message.maxGas = (reader.int64() as Long); + message.maxGas = reader.int64(); break; - case 3: - message.timeIotaMs = (reader.int64() as Long); + message.timeIotaMs = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BlockParams { + fromPartial(object: Partial): BlockParams { const message = createBaseBlockParams(); - message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? Long.fromValue(object.maxBytes) : Long.ZERO; - message.maxGas = object.maxGas !== undefined && object.maxGas !== null ? Long.fromValue(object.maxGas) : Long.ZERO; - message.timeIotaMs = object.timeIotaMs !== undefined && object.timeIotaMs !== null ? Long.fromValue(object.timeIotaMs) : Long.ZERO; + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); + message.maxGas = object.maxGas !== undefined && object.maxGas !== null ? BigInt(object.maxGas.toString()) : BigInt(0); + message.timeIotaMs = object.timeIotaMs !== undefined && object.timeIotaMs !== null ? BigInt(object.timeIotaMs.toString()) : BigInt(0); return message; + }, + fromAmino(object: BlockParamsAmino): BlockParams { + const message = createBaseBlockParams(); + if (object.max_bytes !== undefined && object.max_bytes !== null) { + message.maxBytes = BigInt(object.max_bytes); + } + if (object.max_gas !== undefined && object.max_gas !== null) { + message.maxGas = BigInt(object.max_gas); + } + if (object.time_iota_ms !== undefined && object.time_iota_ms !== null) { + message.timeIotaMs = BigInt(object.time_iota_ms); + } + return message; + }, + toAmino(message: BlockParams): BlockParamsAmino { + const obj: any = {}; + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { + return BlockParams.fromAmino(object.value); + }, + fromProtoMsg(message: BlockParamsProtoMsg): BlockParams { + return BlockParams.decode(message.value); + }, + toProto(message: BlockParams): Uint8Array { + return BlockParams.encode(message).finish(); + }, + toProtoMsg(message: BlockParams): BlockParamsProtoMsg { + return { + typeUrl: "/tendermint.types.BlockParams", + value: BlockParams.encode(message).finish() + }; } - }; - function createBaseEvidenceParams(): EvidenceParams { return { - maxAgeNumBlocks: Long.ZERO, - maxAgeDuration: undefined, - maxBytes: Long.ZERO + maxAgeNumBlocks: BigInt(0), + maxAgeDuration: Duration.fromPartial({}), + maxBytes: BigInt(0) }; } - export const EvidenceParams = { - encode(message: EvidenceParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.maxAgeNumBlocks.isZero()) { + typeUrl: "/tendermint.types.EvidenceParams", + encode(message: EvidenceParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxAgeNumBlocks !== BigInt(0)) { writer.uint32(8).int64(message.maxAgeNumBlocks); } - if (message.maxAgeDuration !== undefined) { Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim(); } - - if (!message.maxBytes.isZero()) { + if (message.maxBytes !== BigInt(0)) { writer.uint32(24).int64(message.maxBytes); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEvidenceParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.maxAgeNumBlocks = (reader.int64() as Long); + message.maxAgeNumBlocks = reader.int64(); break; - case 2: message.maxAgeDuration = Duration.decode(reader, reader.uint32()); break; - case 3: - message.maxBytes = (reader.int64() as Long); + message.maxBytes = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EvidenceParams { + fromPartial(object: Partial): EvidenceParams { const message = createBaseEvidenceParams(); - message.maxAgeNumBlocks = object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null ? Long.fromValue(object.maxAgeNumBlocks) : Long.ZERO; + message.maxAgeNumBlocks = object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null ? BigInt(object.maxAgeNumBlocks.toString()) : BigInt(0); message.maxAgeDuration = object.maxAgeDuration !== undefined && object.maxAgeDuration !== null ? Duration.fromPartial(object.maxAgeDuration) : undefined; - message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? Long.fromValue(object.maxBytes) : Long.ZERO; + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); return message; + }, + fromAmino(object: EvidenceParamsAmino): EvidenceParams { + const message = createBaseEvidenceParams(); + if (object.max_age_num_blocks !== undefined && object.max_age_num_blocks !== null) { + message.maxAgeNumBlocks = BigInt(object.max_age_num_blocks); + } + if (object.max_age_duration !== undefined && object.max_age_duration !== null) { + message.maxAgeDuration = Duration.fromAmino(object.max_age_duration); + } + if (object.max_bytes !== undefined && object.max_bytes !== null) { + message.maxBytes = BigInt(object.max_bytes); + } + return message; + }, + toAmino(message: EvidenceParams): EvidenceParamsAmino { + const obj: any = {}; + obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { + return EvidenceParams.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceParamsProtoMsg): EvidenceParams { + return EvidenceParams.decode(message.value); + }, + toProto(message: EvidenceParams): Uint8Array { + return EvidenceParams.encode(message).finish(); + }, + toProtoMsg(message: EvidenceParams): EvidenceParamsProtoMsg { + return { + typeUrl: "/tendermint.types.EvidenceParams", + value: EvidenceParams.encode(message).finish() + }; } - }; - function createBaseValidatorParams(): ValidatorParams { return { pubKeyTypes: [] }; } - export const ValidatorParams = { - encode(message: ValidatorParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.ValidatorParams", + encode(message: ValidatorParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pubKeyTypes) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidatorParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pubKeyTypes.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorParams { + fromPartial(object: Partial): ValidatorParams { const message = createBaseValidatorParams(); message.pubKeyTypes = object.pubKeyTypes?.map(e => e) || []; return message; + }, + fromAmino(object: ValidatorParamsAmino): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pub_key_types?.map(e => e) || []; + return message; + }, + toAmino(message: ValidatorParams): ValidatorParamsAmino { + const obj: any = {}; + if (message.pubKeyTypes) { + obj.pub_key_types = message.pubKeyTypes.map(e => e); + } else { + obj.pub_key_types = []; + } + return obj; + }, + fromAminoMsg(object: ValidatorParamsAminoMsg): ValidatorParams { + return ValidatorParams.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorParamsProtoMsg): ValidatorParams { + return ValidatorParams.decode(message.value); + }, + toProto(message: ValidatorParams): Uint8Array { + return ValidatorParams.encode(message).finish(); + }, + toProtoMsg(message: ValidatorParams): ValidatorParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ValidatorParams", + value: ValidatorParams.encode(message).finish() + }; } - }; - function createBaseVersionParams(): VersionParams { return { - appVersion: Long.UZERO + appVersion: BigInt(0) }; } - export const VersionParams = { - encode(message: VersionParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.appVersion.isZero()) { + typeUrl: "/tendermint.types.VersionParams", + encode(message: VersionParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.appVersion !== BigInt(0)) { writer.uint32(8).uint64(message.appVersion); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VersionParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVersionParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.appVersion = (reader.uint64() as Long); + message.appVersion = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): VersionParams { + fromPartial(object: Partial): VersionParams { const message = createBaseVersionParams(); - message.appVersion = object.appVersion !== undefined && object.appVersion !== null ? Long.fromValue(object.appVersion) : Long.UZERO; + message.appVersion = object.appVersion !== undefined && object.appVersion !== null ? BigInt(object.appVersion.toString()) : BigInt(0); return message; + }, + fromAmino(object: VersionParamsAmino): VersionParams { + const message = createBaseVersionParams(); + if (object.app_version !== undefined && object.app_version !== null) { + message.appVersion = BigInt(object.app_version); + } + return message; + }, + toAmino(message: VersionParams): VersionParamsAmino { + const obj: any = {}; + obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + return obj; + }, + fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { + return VersionParams.fromAmino(object.value); + }, + fromProtoMsg(message: VersionParamsProtoMsg): VersionParams { + return VersionParams.decode(message.value); + }, + toProto(message: VersionParams): Uint8Array { + return VersionParams.encode(message).finish(); + }, + toProtoMsg(message: VersionParams): VersionParamsProtoMsg { + return { + typeUrl: "/tendermint.types.VersionParams", + value: VersionParams.encode(message).finish() + }; } - }; - function createBaseHashedParams(): HashedParams { return { - blockMaxBytes: Long.ZERO, - blockMaxGas: Long.ZERO + blockMaxBytes: BigInt(0), + blockMaxGas: BigInt(0) }; } - export const HashedParams = { - encode(message: HashedParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.blockMaxBytes.isZero()) { + typeUrl: "/tendermint.types.HashedParams", + encode(message: HashedParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockMaxBytes !== BigInt(0)) { writer.uint32(8).int64(message.blockMaxBytes); } - - if (!message.blockMaxGas.isZero()) { + if (message.blockMaxGas !== BigInt(0)) { writer.uint32(16).int64(message.blockMaxGas); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): HashedParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHashedParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.blockMaxBytes = (reader.int64() as Long); + message.blockMaxBytes = reader.int64(); break; - case 2: - message.blockMaxGas = (reader.int64() as Long); + message.blockMaxGas = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): HashedParams { + fromPartial(object: Partial): HashedParams { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes !== undefined && object.blockMaxBytes !== null ? BigInt(object.blockMaxBytes.toString()) : BigInt(0); + message.blockMaxGas = object.blockMaxGas !== undefined && object.blockMaxGas !== null ? BigInt(object.blockMaxGas.toString()) : BigInt(0); + return message; + }, + fromAmino(object: HashedParamsAmino): HashedParams { const message = createBaseHashedParams(); - message.blockMaxBytes = object.blockMaxBytes !== undefined && object.blockMaxBytes !== null ? Long.fromValue(object.blockMaxBytes) : Long.ZERO; - message.blockMaxGas = object.blockMaxGas !== undefined && object.blockMaxGas !== null ? Long.fromValue(object.blockMaxGas) : Long.ZERO; + if (object.block_max_bytes !== undefined && object.block_max_bytes !== null) { + message.blockMaxBytes = BigInt(object.block_max_bytes); + } + if (object.block_max_gas !== undefined && object.block_max_gas !== null) { + message.blockMaxGas = BigInt(object.block_max_gas); + } return message; + }, + toAmino(message: HashedParams): HashedParamsAmino { + const obj: any = {}; + obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + return obj; + }, + fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { + return HashedParams.fromAmino(object.value); + }, + fromProtoMsg(message: HashedParamsProtoMsg): HashedParams { + return HashedParams.decode(message.value); + }, + toProto(message: HashedParams): Uint8Array { + return HashedParams.encode(message).finish(); + }, + toProtoMsg(message: HashedParams): HashedParamsProtoMsg { + return { + typeUrl: "/tendermint.types.HashedParams", + value: HashedParams.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/types/types.ts b/src/codegen/tendermint/types/types.ts index 41c4687..8ca13c9 100644 --- a/src/codegen/tendermint/types/types.ts +++ b/src/codegen/tendermint/types/types.ts @@ -1,11 +1,10 @@ -import { Proof, ProofSDKType } from "../crypto/proof"; -import { Consensus, ConsensusSDKType } from "../version/types"; +import { Proof, ProofAmino, ProofSDKType } from "../crypto/proof"; +import { Consensus, ConsensusAmino, ConsensusSDKType } from "../version/types"; import { Timestamp } from "../../google/protobuf/timestamp"; -import { ValidatorSet, ValidatorSetSDKType } from "./validator"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, toTimestamp, Long, fromTimestamp } from "../../helpers"; +import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "./validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; /** BlockIdFlag indicates which BlcokID the signature is for */ - export enum BlockIDFlag { BLOCK_ID_FLAG_UNKNOWN = 0, BLOCK_ID_FLAG_ABSENT = 1, @@ -13,33 +12,22 @@ export enum BlockIDFlag { BLOCK_ID_FLAG_NIL = 3, UNRECOGNIZED = -1, } -/** BlockIdFlag indicates which BlcokID the signature is for */ - -export enum BlockIDFlagSDKType { - BLOCK_ID_FLAG_UNKNOWN = 0, - BLOCK_ID_FLAG_ABSENT = 1, - BLOCK_ID_FLAG_COMMIT = 2, - BLOCK_ID_FLAG_NIL = 3, - UNRECOGNIZED = -1, -} +export const BlockIDFlagSDKType = BlockIDFlag; +export const BlockIDFlagAmino = BlockIDFlag; export function blockIDFlagFromJSON(object: any): BlockIDFlag { switch (object) { case 0: case "BLOCK_ID_FLAG_UNKNOWN": return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; - case 1: case "BLOCK_ID_FLAG_ABSENT": return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; - case 2: case "BLOCK_ID_FLAG_COMMIT": return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; - case 3: case "BLOCK_ID_FLAG_NIL": return BlockIDFlag.BLOCK_ID_FLAG_NIL; - case -1: case "UNRECOGNIZED": default: @@ -50,65 +38,43 @@ export function blockIDFlagToJSON(object: BlockIDFlag): string { switch (object) { case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: return "BLOCK_ID_FLAG_UNKNOWN"; - case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: return "BLOCK_ID_FLAG_ABSENT"; - case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: return "BLOCK_ID_FLAG_COMMIT"; - case BlockIDFlag.BLOCK_ID_FLAG_NIL: return "BLOCK_ID_FLAG_NIL"; - case BlockIDFlag.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** SignedMsgType is a type of signed message in the consensus. */ - export enum SignedMsgType { SIGNED_MSG_TYPE_UNKNOWN = 0, - - /** SIGNED_MSG_TYPE_PREVOTE - Votes */ - SIGNED_MSG_TYPE_PREVOTE = 1, - SIGNED_MSG_TYPE_PRECOMMIT = 2, - - /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ - SIGNED_MSG_TYPE_PROPOSAL = 32, - UNRECOGNIZED = -1, -} -/** SignedMsgType is a type of signed message in the consensus. */ - -export enum SignedMsgTypeSDKType { - SIGNED_MSG_TYPE_UNKNOWN = 0, - /** SIGNED_MSG_TYPE_PREVOTE - Votes */ SIGNED_MSG_TYPE_PREVOTE = 1, SIGNED_MSG_TYPE_PRECOMMIT = 2, - /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ SIGNED_MSG_TYPE_PROPOSAL = 32, UNRECOGNIZED = -1, } +export const SignedMsgTypeSDKType = SignedMsgType; +export const SignedMsgTypeAmino = SignedMsgType; export function signedMsgTypeFromJSON(object: any): SignedMsgType { switch (object) { case 0: case "SIGNED_MSG_TYPE_UNKNOWN": return SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; - case 1: case "SIGNED_MSG_TYPE_PREVOTE": return SignedMsgType.SIGNED_MSG_TYPE_PREVOTE; - case 2: case "SIGNED_MSG_TYPE_PRECOMMIT": return SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT; - case 32: case "SIGNED_MSG_TYPE_PROPOSAL": return SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL; - case -1: case "UNRECOGNIZED": default: @@ -119,29 +85,36 @@ export function signedMsgTypeToJSON(object: SignedMsgType): string { switch (object) { case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN: return "SIGNED_MSG_TYPE_UNKNOWN"; - case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE: return "SIGNED_MSG_TYPE_PREVOTE"; - case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT: return "SIGNED_MSG_TYPE_PRECOMMIT"; - case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL: return "SIGNED_MSG_TYPE_PROPOSAL"; - case SignedMsgType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** PartsetHeader */ - export interface PartSetHeader { total: number; hash: Uint8Array; } +export interface PartSetHeaderProtoMsg { + typeUrl: "/tendermint.types.PartSetHeader"; + value: Uint8Array; +} +/** PartsetHeader */ +export interface PartSetHeaderAmino { + total?: number; + hash?: string; +} +export interface PartSetHeaderAminoMsg { + type: "/tendermint.types.PartSetHeader"; + value: PartSetHeaderAmino; +} /** PartsetHeader */ - export interface PartSetHeaderSDKType { total: number; hash: Uint8Array; @@ -149,97 +122,127 @@ export interface PartSetHeaderSDKType { export interface Part { index: number; bytes: Uint8Array; - proof?: Proof; + proof: Proof; +} +export interface PartProtoMsg { + typeUrl: "/tendermint.types.Part"; + value: Uint8Array; +} +export interface PartAmino { + index?: number; + bytes?: string; + proof?: ProofAmino; +} +export interface PartAminoMsg { + type: "/tendermint.types.Part"; + value: PartAmino; } export interface PartSDKType { index: number; bytes: Uint8Array; - proof?: ProofSDKType; + proof: ProofSDKType; } /** BlockID */ - export interface BlockID { hash: Uint8Array; - partSetHeader?: PartSetHeader; + partSetHeader: PartSetHeader; +} +export interface BlockIDProtoMsg { + typeUrl: "/tendermint.types.BlockID"; + value: Uint8Array; +} +/** BlockID */ +export interface BlockIDAmino { + hash?: string; + part_set_header?: PartSetHeaderAmino; +} +export interface BlockIDAminoMsg { + type: "/tendermint.types.BlockID"; + value: BlockIDAmino; } /** BlockID */ - export interface BlockIDSDKType { hash: Uint8Array; - part_set_header?: PartSetHeaderSDKType; + part_set_header: PartSetHeaderSDKType; } /** Header defines the structure of a Tendermint block header. */ - export interface Header { /** basic block info */ - version?: Consensus; + version: Consensus; chainId: string; - height: Long; - time?: Date; + height: bigint; + time: Date; /** prev block info */ - - lastBlockId?: BlockID; + lastBlockId: BlockID; /** hashes of block data */ - lastCommitHash: Uint8Array; 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; lastResultsHash: Uint8Array; /** consensus info */ - evidenceHash: Uint8Array; /** original proposer of the block */ - proposerAddress: Uint8Array; } +export interface HeaderProtoMsg { + typeUrl: "/tendermint.types.Header"; + value: Uint8Array; +} /** Header defines the structure of a Tendermint block header. */ - -export interface HeaderSDKType { +export interface HeaderAmino { /** basic block info */ - version?: ConsensusSDKType; - chain_id: string; - height: Long; - time?: Date; + version?: ConsensusAmino; + chain_id?: string; + height?: string; + time?: string; /** prev block info */ - - last_block_id?: BlockIDSDKType; + last_block_id?: BlockIDAmino; /** hashes of block data */ - + last_commit_hash?: string; + data_hash?: string; + /** hashes from the app output from the prev block */ + validators_hash?: string; + /** validators for the next block */ + next_validators_hash?: string; + /** consensus params for current block */ + consensus_hash?: string; + /** state after txs from the previous block */ + app_hash?: string; + last_results_hash?: string; + /** consensus info */ + evidence_hash?: string; + /** original proposer of the block */ + proposer_address?: string; +} +export interface HeaderAminoMsg { + type: "/tendermint.types.Header"; + value: HeaderAmino; +} +/** Header defines the structure of a Tendermint block header. */ +export interface HeaderSDKType { + version: ConsensusSDKType; + chain_id: string; + height: bigint; + time: Date; + last_block_id: BlockIDSDKType; last_commit_hash: Uint8Array; data_hash: Uint8Array; - /** hashes from the app output from the prev block */ - validators_hash: Uint8Array; - /** validators for the next block */ - next_validators_hash: Uint8Array; - /** consensus params for current block */ - consensus_hash: Uint8Array; - /** state after txs from the previous block */ - app_hash: Uint8Array; last_results_hash: Uint8Array; - /** consensus info */ - evidence_hash: Uint8Array; - /** original proposer of the block */ - proposer_address: Uint8Array; } /** Data contains the set of transactions included in the block */ - export interface Data { /** * Txs that will be applied by state @ block.Height+1. @@ -248,104 +251,188 @@ export interface Data { */ txs: Uint8Array[]; } +export interface DataProtoMsg { + typeUrl: "/tendermint.types.Data"; + value: Uint8Array; +} /** Data contains the set of transactions included in the block */ - -export interface DataSDKType { +export interface DataAmino { /** * Txs that will be applied by state @ block.Height+1. * NOTE: not all txs here are valid. We're just agreeing on the order first. * This means that block.AppHash does not include these txs. */ + txs?: string[]; +} +export interface DataAminoMsg { + type: "/tendermint.types.Data"; + value: DataAmino; +} +/** Data contains the set of transactions included in the block */ +export interface DataSDKType { txs: Uint8Array[]; } /** * Vote represents a prevote, precommit, or commit vote from validators for * consensus. */ - export interface Vote { type: SignedMsgType; - height: Long; + height: bigint; round: number; /** zero if vote is nil. */ - - blockId?: BlockID; - timestamp?: Date; + blockId: BlockID; + timestamp: Date; validatorAddress: Uint8Array; validatorIndex: number; signature: Uint8Array; } +export interface VoteProtoMsg { + typeUrl: "/tendermint.types.Vote"; + value: Uint8Array; +} +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface VoteAmino { + type?: SignedMsgType; + height?: string; + round?: number; + /** zero if vote is nil. */ + block_id?: BlockIDAmino; + timestamp?: string; + validator_address?: string; + validator_index?: number; + signature?: string; +} +export interface VoteAminoMsg { + type: "/tendermint.types.Vote"; + value: VoteAmino; +} /** * Vote represents a prevote, precommit, or commit vote from validators for * consensus. */ - export interface VoteSDKType { - type: SignedMsgTypeSDKType; - height: Long; + type: SignedMsgType; + height: bigint; round: number; - /** zero if vote is nil. */ - - block_id?: BlockIDSDKType; - timestamp?: Date; + block_id: BlockIDSDKType; + timestamp: Date; validator_address: Uint8Array; validator_index: number; signature: Uint8Array; } /** Commit contains the evidence that a block was committed by a set of validators. */ - export interface Commit { - height: Long; + height: bigint; round: number; - blockId?: BlockID; + blockId: BlockID; signatures: CommitSig[]; } +export interface CommitProtoMsg { + typeUrl: "/tendermint.types.Commit"; + value: Uint8Array; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface CommitAmino { + height?: string; + round?: number; + block_id?: BlockIDAmino; + signatures?: CommitSigAmino[]; +} +export interface CommitAminoMsg { + type: "/tendermint.types.Commit"; + value: CommitAmino; +} /** Commit contains the evidence that a block was committed by a set of validators. */ - export interface CommitSDKType { - height: Long; + height: bigint; round: number; - block_id?: BlockIDSDKType; + block_id: BlockIDSDKType; signatures: CommitSigSDKType[]; } /** CommitSig is a part of the Vote included in a Commit. */ - export interface CommitSig { blockIdFlag: BlockIDFlag; validatorAddress: Uint8Array; - timestamp?: Date; + timestamp: Date; signature: Uint8Array; } +export interface CommitSigProtoMsg { + typeUrl: "/tendermint.types.CommitSig"; + value: Uint8Array; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSigAmino { + block_id_flag?: BlockIDFlag; + validator_address?: string; + timestamp?: string; + signature?: string; +} +export interface CommitSigAminoMsg { + type: "/tendermint.types.CommitSig"; + value: CommitSigAmino; +} /** CommitSig is a part of the Vote included in a Commit. */ - export interface CommitSigSDKType { - block_id_flag: BlockIDFlagSDKType; + block_id_flag: BlockIDFlag; validator_address: Uint8Array; - timestamp?: Date; + timestamp: Date; signature: Uint8Array; } export interface Proposal { type: SignedMsgType; - height: Long; + height: bigint; round: number; polRound: number; - blockId?: BlockID; - timestamp?: Date; + blockId: BlockID; + timestamp: Date; signature: Uint8Array; } +export interface ProposalProtoMsg { + typeUrl: "/tendermint.types.Proposal"; + value: Uint8Array; +} +export interface ProposalAmino { + type?: SignedMsgType; + height?: string; + round?: number; + pol_round?: number; + block_id?: BlockIDAmino; + timestamp?: string; + signature?: string; +} +export interface ProposalAminoMsg { + type: "/tendermint.types.Proposal"; + value: ProposalAmino; +} export interface ProposalSDKType { - type: SignedMsgTypeSDKType; - height: Long; + type: SignedMsgType; + height: bigint; round: number; pol_round: number; - block_id?: BlockIDSDKType; - timestamp?: Date; + block_id: BlockIDSDKType; + timestamp: Date; signature: Uint8Array; } export interface SignedHeader { header?: Header; commit?: Commit; } +export interface SignedHeaderProtoMsg { + typeUrl: "/tendermint.types.SignedHeader"; + value: Uint8Array; +} +export interface SignedHeaderAmino { + header?: HeaderAmino; + commit?: CommitAmino; +} +export interface SignedHeaderAminoMsg { + type: "/tendermint.types.SignedHeader"; + value: SignedHeaderAmino; +} export interface SignedHeaderSDKType { header?: HeaderSDKType; commit?: CommitSDKType; @@ -354,219 +441,318 @@ export interface LightBlock { signedHeader?: SignedHeader; validatorSet?: ValidatorSet; } +export interface LightBlockProtoMsg { + typeUrl: "/tendermint.types.LightBlock"; + value: Uint8Array; +} +export interface LightBlockAmino { + signed_header?: SignedHeaderAmino; + validator_set?: ValidatorSetAmino; +} +export interface LightBlockAminoMsg { + type: "/tendermint.types.LightBlock"; + value: LightBlockAmino; +} export interface LightBlockSDKType { signed_header?: SignedHeaderSDKType; validator_set?: ValidatorSetSDKType; } export interface BlockMeta { - blockId?: BlockID; - blockSize: Long; - header?: Header; - numTxs: Long; + blockId: BlockID; + blockSize: bigint; + header: Header; + numTxs: bigint; +} +export interface BlockMetaProtoMsg { + typeUrl: "/tendermint.types.BlockMeta"; + value: Uint8Array; +} +export interface BlockMetaAmino { + block_id?: BlockIDAmino; + block_size?: string; + header?: HeaderAmino; + num_txs?: string; +} +export interface BlockMetaAminoMsg { + type: "/tendermint.types.BlockMeta"; + value: BlockMetaAmino; } export interface BlockMetaSDKType { - block_id?: BlockIDSDKType; - block_size: Long; - header?: HeaderSDKType; - num_txs: Long; + block_id: BlockIDSDKType; + block_size: bigint; + header: HeaderSDKType; + num_txs: bigint; } /** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ - export interface TxProof { rootHash: Uint8Array; data: Uint8Array; proof?: Proof; } +export interface TxProofProtoMsg { + typeUrl: "/tendermint.types.TxProof"; + value: Uint8Array; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProofAmino { + root_hash?: string; + data?: string; + proof?: ProofAmino; +} +export interface TxProofAminoMsg { + type: "/tendermint.types.TxProof"; + value: TxProofAmino; +} /** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ - export interface TxProofSDKType { root_hash: Uint8Array; data: Uint8Array; proof?: ProofSDKType; } - function createBasePartSetHeader(): PartSetHeader { return { total: 0, hash: new Uint8Array() }; } - export const PartSetHeader = { - encode(message: PartSetHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.PartSetHeader", + encode(message: PartSetHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.total !== 0) { writer.uint32(8).uint32(message.total); } - if (message.hash.length !== 0) { writer.uint32(18).bytes(message.hash); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PartSetHeader { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePartSetHeader(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.total = reader.uint32(); break; - case 2: message.hash = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): PartSetHeader { + fromPartial(object: Partial): PartSetHeader { const message = createBasePartSetHeader(); message.total = object.total ?? 0; message.hash = object.hash ?? new Uint8Array(); return message; + }, + fromAmino(object: PartSetHeaderAmino): PartSetHeader { + const message = createBasePartSetHeader(); + if (object.total !== undefined && object.total !== null) { + message.total = object.total; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: PartSetHeader): PartSetHeaderAmino { + const obj: any = {}; + obj.total = message.total; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: PartSetHeaderAminoMsg): PartSetHeader { + return PartSetHeader.fromAmino(object.value); + }, + fromProtoMsg(message: PartSetHeaderProtoMsg): PartSetHeader { + return PartSetHeader.decode(message.value); + }, + toProto(message: PartSetHeader): Uint8Array { + return PartSetHeader.encode(message).finish(); + }, + toProtoMsg(message: PartSetHeader): PartSetHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.PartSetHeader", + value: PartSetHeader.encode(message).finish() + }; } - }; - function createBasePart(): Part { return { index: 0, bytes: new Uint8Array(), - proof: undefined + proof: Proof.fromPartial({}) }; } - export const Part = { - encode(message: Part, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.Part", + encode(message: Part, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== 0) { writer.uint32(8).uint32(message.index); } - if (message.bytes.length !== 0) { writer.uint32(18).bytes(message.bytes); } - if (message.proof !== undefined) { Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Part { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePart(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.index = reader.uint32(); break; - case 2: message.bytes = reader.bytes(); break; - case 3: message.proof = Proof.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Part { + fromPartial(object: Partial): Part { const message = createBasePart(); message.index = object.index ?? 0; message.bytes = object.bytes ?? new Uint8Array(); message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; return message; + }, + fromAmino(object: PartAmino): Part { + const message = createBasePart(); + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.bytes !== undefined && object.bytes !== null) { + message.bytes = bytesFromBase64(object.bytes); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: Part): PartAmino { + const obj: any = {}; + obj.index = message.index; + obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: PartAminoMsg): Part { + return Part.fromAmino(object.value); + }, + fromProtoMsg(message: PartProtoMsg): Part { + return Part.decode(message.value); + }, + toProto(message: Part): Uint8Array { + return Part.encode(message).finish(); + }, + toProtoMsg(message: Part): PartProtoMsg { + return { + typeUrl: "/tendermint.types.Part", + value: Part.encode(message).finish() + }; } - }; - function createBaseBlockID(): BlockID { return { hash: new Uint8Array(), - partSetHeader: undefined + partSetHeader: PartSetHeader.fromPartial({}) }; } - export const BlockID = { - encode(message: BlockID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.BlockID", + encode(message: BlockID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); } - if (message.partSetHeader !== undefined) { PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BlockID { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBlockID(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = reader.bytes(); break; - case 2: message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BlockID { + fromPartial(object: Partial): BlockID { const message = createBaseBlockID(); message.hash = object.hash ?? new Uint8Array(); message.partSetHeader = object.partSetHeader !== undefined && object.partSetHeader !== null ? PartSetHeader.fromPartial(object.partSetHeader) : undefined; return message; + }, + fromAmino(object: BlockIDAmino): BlockID { + const message = createBaseBlockID(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.part_set_header !== undefined && object.part_set_header !== null) { + message.partSetHeader = PartSetHeader.fromAmino(object.part_set_header); + } + return message; + }, + toAmino(message: BlockID): BlockIDAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.part_set_header = message.partSetHeader ? PartSetHeader.toAmino(message.partSetHeader) : undefined; + return obj; + }, + fromAminoMsg(object: BlockIDAminoMsg): BlockID { + return BlockID.fromAmino(object.value); + }, + fromProtoMsg(message: BlockIDProtoMsg): BlockID { + return BlockID.decode(message.value); + }, + toProto(message: BlockID): Uint8Array { + return BlockID.encode(message).finish(); + }, + toProtoMsg(message: BlockID): BlockIDProtoMsg { + return { + typeUrl: "/tendermint.types.BlockID", + value: BlockID.encode(message).finish() + }; } - }; - function createBaseHeader(): Header { return { - version: undefined, + version: Consensus.fromPartial({}), chainId: "", - height: Long.ZERO, - time: undefined, - lastBlockId: undefined, + height: BigInt(0), + time: new Date(), + lastBlockId: BlockID.fromPartial({}), lastCommitHash: new Uint8Array(), dataHash: new Uint8Array(), validatorsHash: new Uint8Array(), @@ -578,147 +764,114 @@ function createBaseHeader(): Header { proposerAddress: new Uint8Array() }; } - export const Header = { - encode(message: Header, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.Header", + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== undefined) { Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); } - if (message.chainId !== "") { writer.uint32(18).string(message.chainId); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(24).int64(message.height); } - if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); } - if (message.lastBlockId !== undefined) { BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim(); } - if (message.lastCommitHash.length !== 0) { writer.uint32(50).bytes(message.lastCommitHash); } - if (message.dataHash.length !== 0) { writer.uint32(58).bytes(message.dataHash); } - if (message.validatorsHash.length !== 0) { writer.uint32(66).bytes(message.validatorsHash); } - if (message.nextValidatorsHash.length !== 0) { writer.uint32(74).bytes(message.nextValidatorsHash); } - if (message.consensusHash.length !== 0) { writer.uint32(82).bytes(message.consensusHash); } - if (message.appHash.length !== 0) { writer.uint32(90).bytes(message.appHash); } - if (message.lastResultsHash.length !== 0) { writer.uint32(98).bytes(message.lastResultsHash); } - if (message.evidenceHash.length !== 0) { writer.uint32(106).bytes(message.evidenceHash); } - if (message.proposerAddress.length !== 0) { writer.uint32(114).bytes(message.proposerAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Header { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseHeader(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.version = Consensus.decode(reader, reader.uint32()); break; - case 2: message.chainId = reader.string(); break; - case 3: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 4: message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 5: message.lastBlockId = BlockID.decode(reader, reader.uint32()); break; - case 6: message.lastCommitHash = reader.bytes(); break; - case 7: message.dataHash = reader.bytes(); break; - case 8: message.validatorsHash = reader.bytes(); break; - case 9: message.nextValidatorsHash = reader.bytes(); break; - case 10: message.consensusHash = reader.bytes(); break; - case 11: message.appHash = reader.bytes(); break; - case 12: message.lastResultsHash = reader.bytes(); break; - case 13: message.evidenceHash = reader.bytes(); break; - case 14: message.proposerAddress = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial
): Header { + fromPartial(object: Partial
): Header { const message = createBaseHeader(); message.version = object.version !== undefined && object.version !== null ? Consensus.fromPartial(object.version) : undefined; message.chainId = object.chainId ?? ""; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.time = object.time ?? undefined; message.lastBlockId = object.lastBlockId !== undefined && object.lastBlockId !== null ? BlockID.fromPartial(object.lastBlockId) : undefined; message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(); @@ -731,159 +884,235 @@ export const Header = { message.evidenceHash = object.evidenceHash ?? new Uint8Array(); message.proposerAddress = object.proposerAddress ?? new Uint8Array(); return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.version !== undefined && object.version !== null) { + message.version = Consensus.fromAmino(object.version); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.last_block_id !== undefined && object.last_block_id !== null) { + message.lastBlockId = BlockID.fromAmino(object.last_block_id); + } + if (object.last_commit_hash !== undefined && object.last_commit_hash !== null) { + message.lastCommitHash = bytesFromBase64(object.last_commit_hash); + } + if (object.data_hash !== undefined && object.data_hash !== null) { + message.dataHash = bytesFromBase64(object.data_hash); + } + if (object.validators_hash !== undefined && object.validators_hash !== null) { + message.validatorsHash = bytesFromBase64(object.validators_hash); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.consensus_hash !== undefined && object.consensus_hash !== null) { + message.consensusHash = bytesFromBase64(object.consensus_hash); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + if (object.last_results_hash !== undefined && object.last_results_hash !== null) { + message.lastResultsHash = bytesFromBase64(object.last_results_hash); + } + if (object.evidence_hash !== undefined && object.evidence_hash !== null) { + message.evidenceHash = bytesFromBase64(object.evidence_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.version = message.version ? Consensus.toAmino(message.version) : undefined; + obj.chain_id = message.chainId; + obj.height = message.height ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; + obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; + obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; + obj.validators_hash = message.validatorsHash ? base64FromBytes(message.validatorsHash) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.consensus_hash = message.consensusHash ? base64FromBytes(message.consensusHash) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + obj.last_results_hash = message.lastResultsHash ? base64FromBytes(message.lastResultsHash) : undefined; + obj.evidence_hash = message.evidenceHash ? base64FromBytes(message.evidenceHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/tendermint.types.Header", + value: Header.encode(message).finish() + }; } - }; - function createBaseData(): Data { return { txs: [] }; } - export const Data = { - encode(message: Data, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.Data", + encode(message: Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { writer.uint32(10).bytes(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Data { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseData(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.txs.push(reader.bytes()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Data { + fromPartial(object: Partial): Data { const message = createBaseData(); message.txs = object.txs?.map(e => e) || []; return message; + }, + fromAmino(object: DataAmino): Data { + const message = createBaseData(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Data): DataAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = []; + } + return obj; + }, + fromAminoMsg(object: DataAminoMsg): Data { + return Data.fromAmino(object.value); + }, + fromProtoMsg(message: DataProtoMsg): Data { + return Data.decode(message.value); + }, + toProto(message: Data): Uint8Array { + return Data.encode(message).finish(); + }, + toProtoMsg(message: Data): DataProtoMsg { + return { + typeUrl: "/tendermint.types.Data", + value: Data.encode(message).finish() + }; } - }; - function createBaseVote(): Vote { return { type: 0, - height: Long.ZERO, + height: BigInt(0), round: 0, - blockId: undefined, - timestamp: undefined, + blockId: BlockID.fromPartial({}), + timestamp: new Date(), validatorAddress: new Uint8Array(), validatorIndex: 0, signature: new Uint8Array() }; } - export const Vote = { - encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(16).int64(message.height); } - if (message.round !== 0) { writer.uint32(24).int32(message.round); } - if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); } - if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); } - if (message.validatorAddress.length !== 0) { writer.uint32(50).bytes(message.validatorAddress); } - if (message.validatorIndex !== 0) { writer.uint32(56).int32(message.validatorIndex); } - if (message.signature.length !== 0) { writer.uint32(66).bytes(message.signature); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Vote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.type = (reader.int32() as any); break; - case 2: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 3: message.round = reader.int32(); break; - case 4: message.blockId = BlockID.decode(reader, reader.uint32()); break; - case 5: message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 6: message.validatorAddress = reader.bytes(); break; - case 7: message.validatorIndex = reader.int32(); break; - case 8: message.signature = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Vote { + fromPartial(object: Partial): Vote { const message = createBaseVote(); message.type = object.type ?? 0; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.round = object.round ?? 0; message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; message.timestamp = object.timestamp ?? undefined; @@ -891,450 +1120,647 @@ export const Vote = { message.validatorIndex = object.validatorIndex ?? 0; message.signature = object.signature ?? new Uint8Array(); return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.type !== undefined && object.type !== null) { + message.type = signedMsgTypeFromJSON(object.type); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.validator_index !== undefined && object.validator_index !== null) { + message.validatorIndex = object.validator_index; + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.type = signedMsgTypeToJSON(message.type); + obj.height = message.height ? message.height.toString() : undefined; + obj.round = message.round; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.validator_index = message.validatorIndex; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/tendermint.types.Vote", + value: Vote.encode(message).finish() + }; } - }; - function createBaseCommit(): Commit { return { - height: Long.ZERO, + height: BigInt(0), round: 0, - blockId: undefined, + blockId: BlockID.fromPartial({}), signatures: [] }; } - export const Commit = { - encode(message: Commit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.height.isZero()) { + typeUrl: "/tendermint.types.Commit", + encode(message: Commit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - if (message.round !== 0) { writer.uint32(16).int32(message.round); } - if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); } - for (const v of message.signatures) { CommitSig.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Commit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommit(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 2: message.round = reader.int32(); break; - case 3: message.blockId = BlockID.decode(reader, reader.uint32()); break; - case 4: message.signatures.push(CommitSig.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Commit { + fromPartial(object: Partial): Commit { const message = createBaseCommit(); - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.round = object.round ?? 0; message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; message.signatures = object.signatures?.map(e => CommitSig.fromPartial(e)) || []; return message; + }, + fromAmino(object: CommitAmino): Commit { + const message = createBaseCommit(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + message.signatures = object.signatures?.map(e => CommitSig.fromAmino(e)) || []; + return message; + }, + toAmino(message: Commit): CommitAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.round = message.round; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: CommitAminoMsg): Commit { + return Commit.fromAmino(object.value); + }, + fromProtoMsg(message: CommitProtoMsg): Commit { + return Commit.decode(message.value); + }, + toProto(message: Commit): Uint8Array { + return Commit.encode(message).finish(); + }, + toProtoMsg(message: Commit): CommitProtoMsg { + return { + typeUrl: "/tendermint.types.Commit", + value: Commit.encode(message).finish() + }; } - }; - function createBaseCommitSig(): CommitSig { return { blockIdFlag: 0, validatorAddress: new Uint8Array(), - timestamp: undefined, + timestamp: new Date(), signature: new Uint8Array() }; } - export const CommitSig = { - encode(message: CommitSig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.CommitSig", + encode(message: CommitSig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockIdFlag !== 0) { writer.uint32(8).int32(message.blockIdFlag); } - if (message.validatorAddress.length !== 0) { writer.uint32(18).bytes(message.validatorAddress); } - if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); } - if (message.signature.length !== 0) { writer.uint32(34).bytes(message.signature); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CommitSig { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCommitSig(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.blockIdFlag = (reader.int32() as any); break; - case 2: message.validatorAddress = reader.bytes(); break; - case 3: message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 4: message.signature = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): CommitSig { + fromPartial(object: Partial): CommitSig { const message = createBaseCommitSig(); message.blockIdFlag = object.blockIdFlag ?? 0; message.validatorAddress = object.validatorAddress ?? new Uint8Array(); message.timestamp = object.timestamp ?? undefined; message.signature = object.signature ?? new Uint8Array(); return message; + }, + fromAmino(object: CommitSigAmino): CommitSig { + const message = createBaseCommitSig(); + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = blockIDFlagFromJSON(object.block_id_flag); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: CommitSig): CommitSigAmino { + const obj: any = {}; + obj.block_id_flag = blockIDFlagToJSON(message.blockIdFlag); + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: CommitSigAminoMsg): CommitSig { + return CommitSig.fromAmino(object.value); + }, + fromProtoMsg(message: CommitSigProtoMsg): CommitSig { + return CommitSig.decode(message.value); + }, + toProto(message: CommitSig): Uint8Array { + return CommitSig.encode(message).finish(); + }, + toProtoMsg(message: CommitSig): CommitSigProtoMsg { + return { + typeUrl: "/tendermint.types.CommitSig", + value: CommitSig.encode(message).finish() + }; } - }; - function createBaseProposal(): Proposal { return { type: 0, - height: Long.ZERO, + height: BigInt(0), round: 0, polRound: 0, - blockId: undefined, - timestamp: undefined, + blockId: BlockID.fromPartial({}), + timestamp: new Date(), signature: new Uint8Array() }; } - export const Proposal = { - encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } - - if (!message.height.isZero()) { + if (message.height !== BigInt(0)) { writer.uint32(16).int64(message.height); } - if (message.round !== 0) { writer.uint32(24).int32(message.round); } - if (message.polRound !== 0) { writer.uint32(32).int32(message.polRound); } - if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim(); } - if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).ldelim(); } - if (message.signature.length !== 0) { writer.uint32(58).bytes(message.signature); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProposal(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.type = (reader.int32() as any); break; - case 2: - message.height = (reader.int64() as Long); + message.height = reader.int64(); break; - case 3: message.round = reader.int32(); break; - case 4: message.polRound = reader.int32(); break; - case 5: message.blockId = BlockID.decode(reader, reader.uint32()); break; - case 6: message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - case 7: message.signature = reader.bytes(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Proposal { + fromPartial(object: Partial): Proposal { const message = createBaseProposal(); message.type = object.type ?? 0; - message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.round = object.round ?? 0; message.polRound = object.polRound ?? 0; message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; message.timestamp = object.timestamp ?? undefined; message.signature = object.signature ?? new Uint8Array(); return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.type !== undefined && object.type !== null) { + message.type = signedMsgTypeFromJSON(object.type); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.pol_round !== undefined && object.pol_round !== null) { + message.polRound = object.pol_round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.type = signedMsgTypeToJSON(message.type); + obj.height = message.height ? message.height.toString() : undefined; + obj.round = message.round; + obj.pol_round = message.polRound; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/tendermint.types.Proposal", + value: Proposal.encode(message).finish() + }; } - }; - function createBaseSignedHeader(): SignedHeader { return { header: undefined, commit: undefined }; } - export const SignedHeader = { - encode(message: SignedHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.SignedHeader", + encode(message: SignedHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); } - if (message.commit !== undefined) { Commit.encode(message.commit, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignedHeader { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSignedHeader(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.header = Header.decode(reader, reader.uint32()); break; - case 2: message.commit = Commit.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SignedHeader { + fromPartial(object: Partial): SignedHeader { const message = createBaseSignedHeader(); message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; message.commit = object.commit !== undefined && object.commit !== null ? Commit.fromPartial(object.commit) : undefined; return message; + }, + fromAmino(object: SignedHeaderAmino): SignedHeader { + const message = createBaseSignedHeader(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = Commit.fromAmino(object.commit); + } + return message; + }, + toAmino(message: SignedHeader): SignedHeaderAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.commit = message.commit ? Commit.toAmino(message.commit) : undefined; + return obj; + }, + fromAminoMsg(object: SignedHeaderAminoMsg): SignedHeader { + return SignedHeader.fromAmino(object.value); + }, + fromProtoMsg(message: SignedHeaderProtoMsg): SignedHeader { + return SignedHeader.decode(message.value); + }, + toProto(message: SignedHeader): Uint8Array { + return SignedHeader.encode(message).finish(); + }, + toProtoMsg(message: SignedHeader): SignedHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.SignedHeader", + value: SignedHeader.encode(message).finish() + }; } - }; - function createBaseLightBlock(): LightBlock { return { signedHeader: undefined, validatorSet: undefined }; } - export const LightBlock = { - encode(message: LightBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.LightBlock", + encode(message: LightBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedHeader !== undefined) { SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); } - if (message.validatorSet !== undefined) { ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): LightBlock { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseLightBlock(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.signedHeader = SignedHeader.decode(reader, reader.uint32()); break; - case 2: message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): LightBlock { + fromPartial(object: Partial): LightBlock { const message = createBaseLightBlock(); message.signedHeader = object.signedHeader !== undefined && object.signedHeader !== null ? SignedHeader.fromPartial(object.signedHeader) : undefined; message.validatorSet = object.validatorSet !== undefined && object.validatorSet !== null ? ValidatorSet.fromPartial(object.validatorSet) : undefined; return message; + }, + fromAmino(object: LightBlockAmino): LightBlock { + const message = createBaseLightBlock(); + if (object.signed_header !== undefined && object.signed_header !== null) { + message.signedHeader = SignedHeader.fromAmino(object.signed_header); + } + if (object.validator_set !== undefined && object.validator_set !== null) { + message.validatorSet = ValidatorSet.fromAmino(object.validator_set); + } + return message; + }, + toAmino(message: LightBlock): LightBlockAmino { + const obj: any = {}; + obj.signed_header = message.signedHeader ? SignedHeader.toAmino(message.signedHeader) : undefined; + obj.validator_set = message.validatorSet ? ValidatorSet.toAmino(message.validatorSet) : undefined; + return obj; + }, + fromAminoMsg(object: LightBlockAminoMsg): LightBlock { + return LightBlock.fromAmino(object.value); + }, + fromProtoMsg(message: LightBlockProtoMsg): LightBlock { + return LightBlock.decode(message.value); + }, + toProto(message: LightBlock): Uint8Array { + return LightBlock.encode(message).finish(); + }, + toProtoMsg(message: LightBlock): LightBlockProtoMsg { + return { + typeUrl: "/tendermint.types.LightBlock", + value: LightBlock.encode(message).finish() + }; } - }; - function createBaseBlockMeta(): BlockMeta { return { - blockId: undefined, - blockSize: Long.ZERO, - header: undefined, - numTxs: Long.ZERO + blockId: BlockID.fromPartial({}), + blockSize: BigInt(0), + header: Header.fromPartial({}), + numTxs: BigInt(0) }; } - export const BlockMeta = { - encode(message: BlockMeta, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.BlockMeta", + encode(message: BlockMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); } - - if (!message.blockSize.isZero()) { + if (message.blockSize !== BigInt(0)) { writer.uint32(16).int64(message.blockSize); } - if (message.header !== undefined) { Header.encode(message.header, writer.uint32(26).fork()).ldelim(); } - - if (!message.numTxs.isZero()) { + if (message.numTxs !== BigInt(0)) { writer.uint32(32).int64(message.numTxs); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BlockMeta { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBlockMeta(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.blockId = BlockID.decode(reader, reader.uint32()); break; - case 2: - message.blockSize = (reader.int64() as Long); + message.blockSize = reader.int64(); break; - case 3: message.header = Header.decode(reader, reader.uint32()); break; - case 4: - message.numTxs = (reader.int64() as Long); + message.numTxs = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BlockMeta { + fromPartial(object: Partial): BlockMeta { const message = createBaseBlockMeta(); message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; - message.blockSize = object.blockSize !== undefined && object.blockSize !== null ? Long.fromValue(object.blockSize) : Long.ZERO; + message.blockSize = object.blockSize !== undefined && object.blockSize !== null ? BigInt(object.blockSize.toString()) : BigInt(0); message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; - message.numTxs = object.numTxs !== undefined && object.numTxs !== null ? Long.fromValue(object.numTxs) : Long.ZERO; + message.numTxs = object.numTxs !== undefined && object.numTxs !== null ? BigInt(object.numTxs.toString()) : BigInt(0); return message; + }, + fromAmino(object: BlockMetaAmino): BlockMeta { + const message = createBaseBlockMeta(); + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.block_size !== undefined && object.block_size !== null) { + message.blockSize = BigInt(object.block_size); + } + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.num_txs !== undefined && object.num_txs !== null) { + message.numTxs = BigInt(object.num_txs); + } + return message; + }, + toAmino(message: BlockMeta): BlockMetaAmino { + const obj: any = {}; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { + return BlockMeta.fromAmino(object.value); + }, + fromProtoMsg(message: BlockMetaProtoMsg): BlockMeta { + return BlockMeta.decode(message.value); + }, + toProto(message: BlockMeta): Uint8Array { + return BlockMeta.encode(message).finish(); + }, + toProtoMsg(message: BlockMeta): BlockMetaProtoMsg { + return { + typeUrl: "/tendermint.types.BlockMeta", + value: BlockMeta.encode(message).finish() + }; } - }; - function createBaseTxProof(): TxProof { return { rootHash: new Uint8Array(), @@ -1342,60 +1768,83 @@ function createBaseTxProof(): TxProof { proof: undefined }; } - export const TxProof = { - encode(message: TxProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.TxProof", + encode(message: TxProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rootHash.length !== 0) { writer.uint32(10).bytes(message.rootHash); } - if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } - if (message.proof !== undefined) { Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TxProof { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTxProof(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.rootHash = reader.bytes(); break; - case 2: message.data = reader.bytes(); break; - case 3: message.proof = Proof.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): TxProof { + fromPartial(object: Partial): TxProof { const message = createBaseTxProof(); message.rootHash = object.rootHash ?? new Uint8Array(); message.data = object.data ?? new Uint8Array(); message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; return message; + }, + fromAmino(object: TxProofAmino): TxProof { + const message = createBaseTxProof(); + if (object.root_hash !== undefined && object.root_hash !== null) { + message.rootHash = bytesFromBase64(object.root_hash); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: TxProof): TxProofAmino { + const obj: any = {}; + obj.root_hash = message.rootHash ? base64FromBytes(message.rootHash) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: TxProofAminoMsg): TxProof { + return TxProof.fromAmino(object.value); + }, + fromProtoMsg(message: TxProofProtoMsg): TxProof { + return TxProof.decode(message.value); + }, + toProto(message: TxProof): Uint8Array { + return TxProof.encode(message).finish(); + }, + toProtoMsg(message: TxProof): TxProofProtoMsg { + return { + typeUrl: "/tendermint.types.TxProof", + value: TxProof.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/types/validator.ts b/src/codegen/tendermint/types/validator.ts index d73052c..2dddbe6 100644 --- a/src/codegen/tendermint/types/validator.ts +++ b/src/codegen/tendermint/types/validator.ts @@ -1,228 +1,335 @@ -import { PublicKey, PublicKeySDKType } from "../crypto/keys"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../helpers"; +import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../helpers"; export interface ValidatorSet { validators: Validator[]; proposer?: Validator; - totalVotingPower: Long; + totalVotingPower: bigint; +} +export interface ValidatorSetProtoMsg { + typeUrl: "/tendermint.types.ValidatorSet"; + value: Uint8Array; +} +export interface ValidatorSetAmino { + validators?: ValidatorAmino[]; + proposer?: ValidatorAmino; + total_voting_power?: string; +} +export interface ValidatorSetAminoMsg { + type: "/tendermint.types.ValidatorSet"; + value: ValidatorSetAmino; } export interface ValidatorSetSDKType { validators: ValidatorSDKType[]; proposer?: ValidatorSDKType; - total_voting_power: Long; + total_voting_power: bigint; } export interface Validator { address: Uint8Array; - pubKey?: PublicKey; - votingPower: Long; - proposerPriority: Long; + pubKey: PublicKey; + votingPower: bigint; + proposerPriority: bigint; +} +export interface ValidatorProtoMsg { + typeUrl: "/tendermint.types.Validator"; + value: Uint8Array; +} +export interface ValidatorAmino { + address?: string; + pub_key?: PublicKeyAmino; + voting_power?: string; + proposer_priority?: string; +} +export interface ValidatorAminoMsg { + type: "/tendermint.types.Validator"; + value: ValidatorAmino; } export interface ValidatorSDKType { address: Uint8Array; - pub_key?: PublicKeySDKType; - voting_power: Long; - proposer_priority: Long; + pub_key: PublicKeySDKType; + voting_power: bigint; + proposer_priority: bigint; } export interface SimpleValidator { pubKey?: PublicKey; - votingPower: Long; + votingPower: bigint; +} +export interface SimpleValidatorProtoMsg { + typeUrl: "/tendermint.types.SimpleValidator"; + value: Uint8Array; +} +export interface SimpleValidatorAmino { + pub_key?: PublicKeyAmino; + voting_power?: string; +} +export interface SimpleValidatorAminoMsg { + type: "/tendermint.types.SimpleValidator"; + value: SimpleValidatorAmino; } export interface SimpleValidatorSDKType { pub_key?: PublicKeySDKType; - voting_power: Long; + voting_power: bigint; } - function createBaseValidatorSet(): ValidatorSet { return { validators: [], proposer: undefined, - totalVotingPower: Long.ZERO + totalVotingPower: BigInt(0) }; } - export const ValidatorSet = { - encode(message: ValidatorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.ValidatorSet", + encode(message: ValidatorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.proposer !== undefined) { Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim(); } - - if (!message.totalVotingPower.isZero()) { + if (message.totalVotingPower !== BigInt(0)) { writer.uint32(24).int64(message.totalVotingPower); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSet { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validators.push(Validator.decode(reader, reader.uint32())); break; - case 2: message.proposer = Validator.decode(reader, reader.uint32()); break; - case 3: - message.totalVotingPower = (reader.int64() as Long); + message.totalVotingPower = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ValidatorSet { + fromPartial(object: Partial): ValidatorSet { const message = createBaseValidatorSet(); message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; message.proposer = object.proposer !== undefined && object.proposer !== null ? Validator.fromPartial(object.proposer) : undefined; - message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? Long.fromValue(object.totalVotingPower) : Long.ZERO; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); return message; + }, + fromAmino(object: ValidatorSetAmino): ValidatorSet { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = Validator.fromAmino(object.proposer); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + return message; + }, + toAmino(message: ValidatorSet): ValidatorSetAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = []; + } + obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; + obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { + return ValidatorSet.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorSetProtoMsg): ValidatorSet { + return ValidatorSet.decode(message.value); + }, + toProto(message: ValidatorSet): Uint8Array { + return ValidatorSet.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSet): ValidatorSetProtoMsg { + return { + typeUrl: "/tendermint.types.ValidatorSet", + value: ValidatorSet.encode(message).finish() + }; } - }; - function createBaseValidator(): Validator { return { address: new Uint8Array(), - pubKey: undefined, - votingPower: Long.ZERO, - proposerPriority: Long.ZERO + pubKey: PublicKey.fromPartial({}), + votingPower: BigInt(0), + proposerPriority: BigInt(0) }; } - export const Validator = { - encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.Validator", + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address.length !== 0) { writer.uint32(10).bytes(message.address); } - if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); } - - if (!message.votingPower.isZero()) { + if (message.votingPower !== BigInt(0)) { writer.uint32(24).int64(message.votingPower); } - - if (!message.proposerPriority.isZero()) { + if (message.proposerPriority !== BigInt(0)) { writer.uint32(32).int64(message.proposerPriority); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Validator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseValidator(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.bytes(); break; - case 2: message.pubKey = PublicKey.decode(reader, reader.uint32()); break; - case 3: - message.votingPower = (reader.int64() as Long); + message.votingPower = reader.int64(); break; - case 4: - message.proposerPriority = (reader.int64() as Long); + message.proposerPriority = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Validator { + fromPartial(object: Partial): Validator { const message = createBaseValidator(); message.address = object.address ?? new Uint8Array(); message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; - message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? Long.fromValue(object.votingPower) : Long.ZERO; - message.proposerPriority = object.proposerPriority !== undefined && object.proposerPriority !== null ? Long.fromValue(object.proposerPriority) : Long.ZERO; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); + message.proposerPriority = object.proposerPriority !== undefined && object.proposerPriority !== null ? BigInt(object.proposerPriority.toString()) : BigInt(0); return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.address !== undefined && object.address !== null) { + message.address = bytesFromBase64(object.address); + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.voting_power !== undefined && object.voting_power !== null) { + message.votingPower = BigInt(object.voting_power); + } + if (object.proposer_priority !== undefined && object.proposer_priority !== null) { + message.proposerPriority = BigInt(object.proposer_priority); + } + return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address ? base64FromBytes(message.address) : undefined; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/tendermint.types.Validator", + value: Validator.encode(message).finish() + }; } - }; - function createBaseSimpleValidator(): SimpleValidator { return { pubKey: undefined, - votingPower: Long.ZERO + votingPower: BigInt(0) }; } - export const SimpleValidator = { - encode(message: SimpleValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/tendermint.types.SimpleValidator", + encode(message: SimpleValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); } - - if (!message.votingPower.isZero()) { + if (message.votingPower !== BigInt(0)) { writer.uint32(16).int64(message.votingPower); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SimpleValidator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSimpleValidator(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.pubKey = PublicKey.decode(reader, reader.uint32()); break; - case 2: - message.votingPower = (reader.int64() as Long); + message.votingPower = reader.int64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): SimpleValidator { + fromPartial(object: Partial): SimpleValidator { const message = createBaseSimpleValidator(); message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; - message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? Long.fromValue(object.votingPower) : Long.ZERO; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SimpleValidatorAmino): SimpleValidator { + const message = createBaseSimpleValidator(); + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.voting_power !== undefined && object.voting_power !== null) { + message.votingPower = BigInt(object.voting_power); + } return message; + }, + toAmino(message: SimpleValidator): SimpleValidatorAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { + return SimpleValidator.fromAmino(object.value); + }, + fromProtoMsg(message: SimpleValidatorProtoMsg): SimpleValidator { + return SimpleValidator.decode(message.value); + }, + toProto(message: SimpleValidator): Uint8Array { + return SimpleValidator.encode(message).finish(); + }, + toProtoMsg(message: SimpleValidator): SimpleValidatorProtoMsg { + return { + typeUrl: "/tendermint.types.SimpleValidator", + value: SimpleValidator.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/tendermint/version/types.ts b/src/codegen/tendermint/version/types.ts index aabca10..7b4cf3b 100644 --- a/src/codegen/tendermint/version/types.ts +++ b/src/codegen/tendermint/version/types.ts @@ -1,23 +1,37 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; /** * 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: Long; + protocol: bigint; software: string; } +export interface AppProtoMsg { + typeUrl: "/tendermint.version.App"; + value: Uint8Array; +} +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface AppAmino { + protocol?: string; + software?: string; +} +export interface AppAminoMsg { + type: "/tendermint.version.App"; + value: AppAmino; +} /** * 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 AppSDKType { - protocol: Long; + protocol: bigint; software: string; } /** @@ -25,128 +39,183 @@ export interface AppSDKType { * including all blockchain data structures and the rules of the application's * state transition machine. */ - export interface Consensus { - block: Long; - app: Long; + block: bigint; + app: bigint; +} +export interface ConsensusProtoMsg { + typeUrl: "/tendermint.version.Consensus"; + value: Uint8Array; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface ConsensusAmino { + block?: string; + app?: string; +} +export interface ConsensusAminoMsg { + type: "/tendermint.version.Consensus"; + value: ConsensusAmino; } /** * 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 ConsensusSDKType { - block: Long; - app: Long; + block: bigint; + app: bigint; } - function createBaseApp(): App { return { - protocol: Long.UZERO, + protocol: BigInt(0), software: "" }; } - export const App = { - encode(message: App, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.protocol.isZero()) { + typeUrl: "/tendermint.version.App", + encode(message: App, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.protocol !== BigInt(0)) { writer.uint32(8).uint64(message.protocol); } - if (message.software !== "") { writer.uint32(18).string(message.software); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): App { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseApp(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.protocol = (reader.uint64() as Long); + message.protocol = reader.uint64(); break; - case 2: message.software = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): App { + fromPartial(object: Partial): App { const message = createBaseApp(); - message.protocol = object.protocol !== undefined && object.protocol !== null ? Long.fromValue(object.protocol) : Long.UZERO; + message.protocol = object.protocol !== undefined && object.protocol !== null ? BigInt(object.protocol.toString()) : BigInt(0); message.software = object.software ?? ""; return message; + }, + fromAmino(object: AppAmino): App { + const message = createBaseApp(); + if (object.protocol !== undefined && object.protocol !== null) { + message.protocol = BigInt(object.protocol); + } + if (object.software !== undefined && object.software !== null) { + message.software = object.software; + } + return message; + }, + toAmino(message: App): AppAmino { + const obj: any = {}; + obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.software = message.software; + return obj; + }, + fromAminoMsg(object: AppAminoMsg): App { + return App.fromAmino(object.value); + }, + fromProtoMsg(message: AppProtoMsg): App { + return App.decode(message.value); + }, + toProto(message: App): Uint8Array { + return App.encode(message).finish(); + }, + toProtoMsg(message: App): AppProtoMsg { + return { + typeUrl: "/tendermint.version.App", + value: App.encode(message).finish() + }; } - }; - function createBaseConsensus(): Consensus { return { - block: Long.UZERO, - app: Long.UZERO + block: BigInt(0), + app: BigInt(0) }; } - export const Consensus = { - encode(message: Consensus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.block.isZero()) { + typeUrl: "/tendermint.version.Consensus", + encode(message: Consensus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.block !== BigInt(0)) { writer.uint32(8).uint64(message.block); } - - if (!message.app.isZero()) { + if (message.app !== BigInt(0)) { writer.uint32(16).uint64(message.app); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Consensus { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsensus(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.block = (reader.uint64() as Long); + message.block = reader.uint64(); break; - case 2: - message.app = (reader.uint64() as Long); + message.app = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Consensus { + fromPartial(object: Partial): Consensus { + const message = createBaseConsensus(); + message.block = object.block !== undefined && object.block !== null ? BigInt(object.block.toString()) : BigInt(0); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConsensusAmino): Consensus { const message = createBaseConsensus(); - message.block = object.block !== undefined && object.block !== null ? Long.fromValue(object.block) : Long.UZERO; - message.app = object.app !== undefined && object.app !== null ? Long.fromValue(object.app) : Long.UZERO; + if (object.block !== undefined && object.block !== null) { + message.block = BigInt(object.block); + } + if (object.app !== undefined && object.app !== null) { + message.app = BigInt(object.app); + } return message; + }, + toAmino(message: Consensus): ConsensusAmino { + const obj: any = {}; + obj.block = message.block ? message.block.toString() : undefined; + obj.app = message.app ? message.app.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusAminoMsg): Consensus { + return Consensus.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusProtoMsg): Consensus { + return Consensus.decode(message.value); + }, + toProto(message: Consensus): Uint8Array { + return Consensus.encode(message).finish(); + }, + toProtoMsg(message: Consensus): ConsensusProtoMsg { + return { + typeUrl: "/tendermint.version.Consensus", + value: Consensus.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/bundle.ts b/src/codegen/umee/bundle.ts index 8b734a2..6d13ea3 100644 --- a/src/codegen/umee/bundle.ts +++ b/src/codegen/umee/bundle.ts @@ -1,57 +1,152 @@ -import * as _137 from "./leverage/v1/events"; -import * as _138 from "./leverage/v1/genesis"; -import * as _139 from "./leverage/v1/gov"; -import * as _140 from "./leverage/v1/leverage"; -import * as _141 from "./leverage/v1/query"; -import * as _142 from "./leverage/v1/tx"; -import * as _143 from "./oracle/v1/events"; -import * as _144 from "./oracle/v1/genesis"; -import * as _145 from "./oracle/v1/oracle"; -import * as _146 from "./oracle/v1/query"; -import * as _147 from "./oracle/v1/tx"; -import * as _246 from "./leverage/v1/tx.amino"; -import * as _247 from "./oracle/v1/tx.amino"; -import * as _248 from "./leverage/v1/tx.registry"; -import * as _249 from "./oracle/v1/tx.registry"; -import * as _250 from "./leverage/v1/query.lcd"; -import * as _251 from "./oracle/v1/query.lcd"; -import * as _252 from "./leverage/v1/query.rpc.Query"; -import * as _253 from "./oracle/v1/query.rpc.Query"; -import * as _254 from "./leverage/v1/tx.rpc.msg"; -import * as _255 from "./oracle/v1/tx.rpc.msg"; -import * as _262 from "./lcd"; -import * as _263 from "./rpc.query"; -import * as _264 from "./rpc.tx"; +import * as _137 from "./incentive/v1/genesis"; +import * as _138 from "./incentive/v1/incentive"; +import * as _139 from "./incentive/v1/query"; +import * as _140 from "./incentive/v1/tx"; +import * as _141 from "./leverage/v1/events"; +import * as _142 from "./leverage/v1/genesis"; +import * as _143 from "./leverage/v1/leverage"; +import * as _144 from "./leverage/v1/query"; +import * as _145 from "./leverage/v1/tx"; +import * as _146 from "./metoken/v1/events"; +import * as _147 from "./metoken/v1/genesis"; +import * as _148 from "./metoken/v1/metoken"; +import * as _149 from "./metoken/v1/query"; +import * as _150 from "./metoken/v1/tx"; +import * as _151 from "./oracle/v1/events"; +import * as _152 from "./oracle/v1/genesis"; +import * as _153 from "./oracle/v1/oracle"; +import * as _154 from "./oracle/v1/query"; +import * as _155 from "./oracle/v1/tx"; +import * as _156 from "./ugov/v1/events"; +import * as _157 from "./ugov/v1/genesis"; +import * as _158 from "./ugov/v1/query"; +import * as _159 from "./ugov/v1/tx"; +import * as _160 from "./ugov/v1/ugov"; +import * as _161 from "./uibc/v1/events"; +import * as _162 from "./uibc/v1/genesis"; +import * as _163 from "./uibc/v1/query"; +import * as _164 from "./uibc/v1/quota"; +import * as _165 from "./uibc/v1/tx"; +import * as _264 from "./incentive/v1/tx.amino"; +import * as _265 from "./leverage/v1/tx.amino"; +import * as _266 from "./metoken/v1/tx.amino"; +import * as _267 from "./oracle/v1/tx.amino"; +import * as _268 from "./ugov/v1/tx.amino"; +import * as _269 from "./uibc/v1/tx.amino"; +import * as _270 from "./incentive/v1/tx.registry"; +import * as _271 from "./leverage/v1/tx.registry"; +import * as _272 from "./metoken/v1/tx.registry"; +import * as _273 from "./oracle/v1/tx.registry"; +import * as _274 from "./ugov/v1/tx.registry"; +import * as _275 from "./uibc/v1/tx.registry"; +import * as _276 from "./incentive/v1/query.lcd"; +import * as _277 from "./leverage/v1/query.lcd"; +import * as _278 from "./metoken/v1/query.lcd"; +import * as _279 from "./oracle/v1/query.lcd"; +import * as _280 from "./ugov/v1/query.lcd"; +import * as _281 from "./uibc/v1/query.lcd"; +import * as _282 from "./incentive/v1/query.rpc.Query"; +import * as _283 from "./leverage/v1/query.rpc.Query"; +import * as _284 from "./metoken/v1/query.rpc.Query"; +import * as _285 from "./oracle/v1/query.rpc.Query"; +import * as _286 from "./ugov/v1/query.rpc.Query"; +import * as _287 from "./uibc/v1/query.rpc.Query"; +import * as _288 from "./incentive/v1/tx.rpc.msg"; +import * as _289 from "./leverage/v1/tx.rpc.msg"; +import * as _290 from "./metoken/v1/tx.rpc.msg"; +import * as _291 from "./oracle/v1/tx.rpc.msg"; +import * as _292 from "./ugov/v1/tx.rpc.msg"; +import * as _293 from "./uibc/v1/tx.rpc.msg"; +import * as _300 from "./lcd"; +import * as _301 from "./rpc.query"; +import * as _302 from "./rpc.tx"; export namespace umee { - export namespace leverage { - export const v1 = { ..._137, + export namespace incentive { + export const v1 = { + ..._137, ..._138, ..._139, ..._140, - ..._141, - ..._142, - ..._246, - ..._248, - ..._250, - ..._252, - ..._254 + ..._264, + ..._270, + ..._276, + ..._282, + ..._288 }; } - export namespace oracle { - export const v1 = { ..._143, + export namespace leverage { + export const v1 = { + ..._141, + ..._142, + ..._143, ..._144, ..._145, + ..._265, + ..._271, + ..._277, + ..._283, + ..._289 + }; + } + export namespace metoken { + export const v1 = { ..._146, ..._147, - ..._247, - ..._249, - ..._251, - ..._253, - ..._255 + ..._148, + ..._149, + ..._150, + ..._266, + ..._272, + ..._278, + ..._284, + ..._290 + }; + } + export namespace oracle { + export const v1 = { + ..._151, + ..._152, + ..._153, + ..._154, + ..._155, + ..._267, + ..._273, + ..._279, + ..._285, + ..._291 + }; + } + export namespace ugov { + export const v1 = { + ..._156, + ..._157, + ..._158, + ..._159, + ..._160, + ..._268, + ..._274, + ..._280, + ..._286, + ..._292 + }; + } + export namespace uibc { + export const v1 = { + ..._161, + ..._162, + ..._163, + ..._164, + ..._165, + ..._269, + ..._275, + ..._281, + ..._287, + ..._293 }; } - export const ClientFactory = { ..._262, - ..._263, - ..._264 + export const ClientFactory = { + ..._300, + ..._301, + ..._302 }; } \ No newline at end of file diff --git a/src/codegen/umee/client.ts b/src/codegen/umee/client.ts index 0ab139c..970ce09 100644 --- a/src/codegen/umee/client.ts +++ b/src/codegen/umee/client.ts @@ -1,14 +1,27 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as umeeIncentiveV1TxRegistry from "./incentive/v1/tx.registry"; import * as umeeLeverageV1TxRegistry from "./leverage/v1/tx.registry"; +import * as umeeMetokenV1TxRegistry from "./metoken/v1/tx.registry"; import * as umeeOracleV1TxRegistry from "./oracle/v1/tx.registry"; +import * as umeeUgovV1TxRegistry from "./ugov/v1/tx.registry"; +import * as umeeUibcV1TxRegistry from "./uibc/v1/tx.registry"; +import * as umeeIncentiveV1TxAmino from "./incentive/v1/tx.amino"; import * as umeeLeverageV1TxAmino from "./leverage/v1/tx.amino"; +import * as umeeMetokenV1TxAmino from "./metoken/v1/tx.amino"; import * as umeeOracleV1TxAmino from "./oracle/v1/tx.amino"; -export const umeeAminoConverters = { ...umeeLeverageV1TxAmino.AminoConverter, - ...umeeOracleV1TxAmino.AminoConverter +import * as umeeUgovV1TxAmino from "./ugov/v1/tx.amino"; +import * as umeeUibcV1TxAmino from "./uibc/v1/tx.amino"; +export const umeeAminoConverters = { + ...umeeIncentiveV1TxAmino.AminoConverter, + ...umeeLeverageV1TxAmino.AminoConverter, + ...umeeMetokenV1TxAmino.AminoConverter, + ...umeeOracleV1TxAmino.AminoConverter, + ...umeeUgovV1TxAmino.AminoConverter, + ...umeeUibcV1TxAmino.AminoConverter }; -export const umeeProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...umeeLeverageV1TxRegistry.registry, ...umeeOracleV1TxRegistry.registry]; +export const umeeProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...umeeIncentiveV1TxRegistry.registry, ...umeeLeverageV1TxRegistry.registry, ...umeeMetokenV1TxRegistry.registry, ...umeeOracleV1TxRegistry.registry, ...umeeUgovV1TxRegistry.registry, ...umeeUibcV1TxRegistry.registry]; export const getSigningUmeeClientOptions = ({ defaultTypes = defaultRegistryTypes }: { @@ -18,7 +31,8 @@ export const getSigningUmeeClientOptions = ({ aminoTypes: AminoTypes; } => { const registry = new Registry([...defaultTypes, ...umeeProtoRegistry]); - const aminoTypes = new AminoTypes({ ...umeeAminoConverters + const aminoTypes = new AminoTypes({ + ...umeeAminoConverters }); return { registry, @@ -41,7 +55,7 @@ export const getSigningUmeeClient = async ({ defaultTypes }); const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { - registry, + registry: (registry as any), aminoTypes }); return client; diff --git a/src/codegen/umee/incentive/v1/genesis.ts b/src/codegen/umee/incentive/v1/genesis.ts new file mode 100644 index 0000000..c0cb121 --- /dev/null +++ b/src/codegen/umee/incentive/v1/genesis.ts @@ -0,0 +1,860 @@ +import { Params, ParamsAmino, ParamsSDKType, IncentiveProgram, IncentiveProgramAmino, IncentiveProgramSDKType } from "./incentive"; +import { Coin, CoinAmino, CoinSDKType, DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** GenesisState defines the x/incentive module's genesis state. */ +export interface GenesisState { + params: Params; + nextProgramId: number; + lastRewardsTime: bigint; + rewardTrackers: RewardTracker[]; + rewardAccumulators: RewardAccumulator[]; + upcomingPrograms: IncentiveProgram[]; + ongoingPrograms: IncentiveProgram[]; + completedPrograms: IncentiveProgram[]; + bonds: Bond[]; + accountUnbondings: AccountUnbondings[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/umee.incentive.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the x/incentive module's genesis state. */ +export interface GenesisStateAmino { + params?: ParamsAmino; + next_program_id?: number; + last_rewards_time?: string; + reward_trackers?: RewardTrackerAmino[]; + reward_accumulators?: RewardAccumulatorAmino[]; + upcoming_programs?: IncentiveProgramAmino[]; + ongoing_programs?: IncentiveProgramAmino[]; + completed_programs?: IncentiveProgramAmino[]; + bonds?: BondAmino[]; + account_unbondings?: AccountUnbondingsAmino[]; +} +export interface GenesisStateAminoMsg { + type: "/umee.incentive.v1.GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the x/incentive module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + next_program_id: number; + last_rewards_time: bigint; + reward_trackers: RewardTrackerSDKType[]; + reward_accumulators: RewardAccumulatorSDKType[]; + upcoming_programs: IncentiveProgramSDKType[]; + ongoing_programs: IncentiveProgramSDKType[]; + completed_programs: IncentiveProgramSDKType[]; + bonds: BondSDKType[]; + account_unbondings: AccountUnbondingsSDKType[]; +} +/** + * Bond tracks the amount of coins of one uToken denomination bonded + * by a single account. + */ +export interface Bond { + account: string; + uToken: Coin; +} +export interface BondProtoMsg { + typeUrl: "/umee.incentive.v1.Bond"; + value: Uint8Array; +} +/** + * Bond tracks the amount of coins of one uToken denomination bonded + * by a single account. + */ +export interface BondAmino { + account?: string; + uToken?: CoinAmino; +} +export interface BondAminoMsg { + type: "/umee.incentive.v1.Bond"; + value: BondAmino; +} +/** + * Bond tracks the amount of coins of one uToken denomination bonded + * by a single account. + */ +export interface BondSDKType { + account: string; + uToken: CoinSDKType; +} +/** + * RewardTracker tracks the value of a given lock denom's RewardAccumulator at the + * last time a specific account calculated pending rewards for it. When calculating + * available rewards, this value is used to determine the difference between the current + * RewardAccumulator for a uToken and the last value at which the user updated bonds or claimed + * tokens. Their pending rewards increase by only the rewards accrued in that time period. + */ +export interface RewardTracker { + account: string; + uToken: string; + rewards: DecCoin[]; +} +export interface RewardTrackerProtoMsg { + typeUrl: "/umee.incentive.v1.RewardTracker"; + value: Uint8Array; +} +/** + * RewardTracker tracks the value of a given lock denom's RewardAccumulator at the + * last time a specific account calculated pending rewards for it. When calculating + * available rewards, this value is used to determine the difference between the current + * RewardAccumulator for a uToken and the last value at which the user updated bonds or claimed + * tokens. Their pending rewards increase by only the rewards accrued in that time period. + */ +export interface RewardTrackerAmino { + account?: string; + uToken?: string; + rewards?: DecCoinAmino[]; +} +export interface RewardTrackerAminoMsg { + type: "/umee.incentive.v1.RewardTracker"; + value: RewardTrackerAmino; +} +/** + * RewardTracker tracks the value of a given lock denom's RewardAccumulator at the + * last time a specific account calculated pending rewards for it. When calculating + * available rewards, this value is used to determine the difference between the current + * RewardAccumulator for a uToken and the last value at which the user updated bonds or claimed + * tokens. Their pending rewards increase by only the rewards accrued in that time period. + */ +export interface RewardTrackerSDKType { + account: string; + uToken: string; + rewards: DecCoinSDKType[]; +} +/** + * RewardAccumulator is a global reward tracking struct that indicates the amount + * of rewards that a reference amount of a bonded uToken denom would have accumulated + * if it was bonded since genesis. To prevent rounding issues, the reference amount is + * 10^exponent of the uToken's smallest possible amount, generally matching the exponent + * of the associated base token registered with the leverage module. + */ +export interface RewardAccumulator { + uToken: string; + rewards: DecCoin[]; + exponent: number; +} +export interface RewardAccumulatorProtoMsg { + typeUrl: "/umee.incentive.v1.RewardAccumulator"; + value: Uint8Array; +} +/** + * RewardAccumulator is a global reward tracking struct that indicates the amount + * of rewards that a reference amount of a bonded uToken denom would have accumulated + * if it was bonded since genesis. To prevent rounding issues, the reference amount is + * 10^exponent of the uToken's smallest possible amount, generally matching the exponent + * of the associated base token registered with the leverage module. + */ +export interface RewardAccumulatorAmino { + uToken?: string; + rewards?: DecCoinAmino[]; + exponent?: number; +} +export interface RewardAccumulatorAminoMsg { + type: "/umee.incentive.v1.RewardAccumulator"; + value: RewardAccumulatorAmino; +} +/** + * RewardAccumulator is a global reward tracking struct that indicates the amount + * of rewards that a reference amount of a bonded uToken denom would have accumulated + * if it was bonded since genesis. To prevent rounding issues, the reference amount is + * 10^exponent of the uToken's smallest possible amount, generally matching the exponent + * of the associated base token registered with the leverage module. + */ +export interface RewardAccumulatorSDKType { + uToken: string; + rewards: DecCoinSDKType[]; + exponent: number; +} +/** + * Unbonding is a structure that tracks an in-progress token unbonding. + * It tracks both its start time and end time, so that if the module's + * unbonding time changes, the unbonding can complete at the earlier of + * its original end time or its new one based on the new parameter. + */ +export interface Unbonding { + start: bigint; + end: bigint; + uToken: Coin; +} +export interface UnbondingProtoMsg { + typeUrl: "/umee.incentive.v1.Unbonding"; + value: Uint8Array; +} +/** + * Unbonding is a structure that tracks an in-progress token unbonding. + * It tracks both its start time and end time, so that if the module's + * unbonding time changes, the unbonding can complete at the earlier of + * its original end time or its new one based on the new parameter. + */ +export interface UnbondingAmino { + start?: string; + end?: string; + uToken?: CoinAmino; +} +export interface UnbondingAminoMsg { + type: "/umee.incentive.v1.Unbonding"; + value: UnbondingAmino; +} +/** + * Unbonding is a structure that tracks an in-progress token unbonding. + * It tracks both its start time and end time, so that if the module's + * unbonding time changes, the unbonding can complete at the earlier of + * its original end time or its new one based on the new parameter. + */ +export interface UnbondingSDKType { + start: bigint; + end: bigint; + uToken: CoinSDKType; +} +/** + * AccountUnbondings is a structure that is used to store all of an account's unbondings + * for a single bonded uToken denom in both KVStore and genesis state. + */ +export interface AccountUnbondings { + account: string; + uToken: string; + unbondings: Unbonding[]; +} +export interface AccountUnbondingsProtoMsg { + typeUrl: "/umee.incentive.v1.AccountUnbondings"; + value: Uint8Array; +} +/** + * AccountUnbondings is a structure that is used to store all of an account's unbondings + * for a single bonded uToken denom in both KVStore and genesis state. + */ +export interface AccountUnbondingsAmino { + account?: string; + uToken?: string; + unbondings?: UnbondingAmino[]; +} +export interface AccountUnbondingsAminoMsg { + type: "/umee.incentive.v1.AccountUnbondings"; + value: AccountUnbondingsAmino; +} +/** + * AccountUnbondings is a structure that is used to store all of an account's unbondings + * for a single bonded uToken denom in both KVStore and genesis state. + */ +export interface AccountUnbondingsSDKType { + account: string; + uToken: string; + unbondings: UnbondingSDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + params: Params.fromPartial({}), + nextProgramId: 0, + lastRewardsTime: BigInt(0), + rewardTrackers: [], + rewardAccumulators: [], + upcomingPrograms: [], + ongoingPrograms: [], + completedPrograms: [], + bonds: [], + accountUnbondings: [] + }; +} +export const GenesisState = { + typeUrl: "/umee.incentive.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.nextProgramId !== 0) { + writer.uint32(16).uint32(message.nextProgramId); + } + if (message.lastRewardsTime !== BigInt(0)) { + writer.uint32(24).int64(message.lastRewardsTime); + } + for (const v of message.rewardTrackers) { + RewardTracker.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.rewardAccumulators) { + RewardAccumulator.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.upcomingPrograms) { + IncentiveProgram.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.ongoingPrograms) { + IncentiveProgram.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.completedPrograms) { + IncentiveProgram.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.bonds) { + Bond.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.accountUnbondings) { + AccountUnbondings.encode(v!, writer.uint32(82).fork()).ldelim(); + } + 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: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.nextProgramId = reader.uint32(); + break; + case 3: + message.lastRewardsTime = reader.int64(); + break; + case 4: + message.rewardTrackers.push(RewardTracker.decode(reader, reader.uint32())); + break; + case 5: + message.rewardAccumulators.push(RewardAccumulator.decode(reader, reader.uint32())); + break; + case 6: + message.upcomingPrograms.push(IncentiveProgram.decode(reader, reader.uint32())); + break; + case 7: + message.ongoingPrograms.push(IncentiveProgram.decode(reader, reader.uint32())); + break; + case 8: + message.completedPrograms.push(IncentiveProgram.decode(reader, reader.uint32())); + break; + case 9: + message.bonds.push(Bond.decode(reader, reader.uint32())); + break; + case 10: + message.accountUnbondings.push(AccountUnbondings.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.nextProgramId = object.nextProgramId ?? 0; + message.lastRewardsTime = object.lastRewardsTime !== undefined && object.lastRewardsTime !== null ? BigInt(object.lastRewardsTime.toString()) : BigInt(0); + message.rewardTrackers = object.rewardTrackers?.map(e => RewardTracker.fromPartial(e)) || []; + message.rewardAccumulators = object.rewardAccumulators?.map(e => RewardAccumulator.fromPartial(e)) || []; + message.upcomingPrograms = object.upcomingPrograms?.map(e => IncentiveProgram.fromPartial(e)) || []; + message.ongoingPrograms = object.ongoingPrograms?.map(e => IncentiveProgram.fromPartial(e)) || []; + message.completedPrograms = object.completedPrograms?.map(e => IncentiveProgram.fromPartial(e)) || []; + message.bonds = object.bonds?.map(e => Bond.fromPartial(e)) || []; + message.accountUnbondings = object.accountUnbondings?.map(e => AccountUnbondings.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + if (object.next_program_id !== undefined && object.next_program_id !== null) { + message.nextProgramId = object.next_program_id; + } + if (object.last_rewards_time !== undefined && object.last_rewards_time !== null) { + message.lastRewardsTime = BigInt(object.last_rewards_time); + } + message.rewardTrackers = object.reward_trackers?.map(e => RewardTracker.fromAmino(e)) || []; + message.rewardAccumulators = object.reward_accumulators?.map(e => RewardAccumulator.fromAmino(e)) || []; + message.upcomingPrograms = object.upcoming_programs?.map(e => IncentiveProgram.fromAmino(e)) || []; + message.ongoingPrograms = object.ongoing_programs?.map(e => IncentiveProgram.fromAmino(e)) || []; + message.completedPrograms = object.completed_programs?.map(e => IncentiveProgram.fromAmino(e)) || []; + message.bonds = object.bonds?.map(e => Bond.fromAmino(e)) || []; + message.accountUnbondings = object.account_unbondings?.map(e => AccountUnbondings.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.next_program_id = message.nextProgramId; + obj.last_rewards_time = message.lastRewardsTime ? message.lastRewardsTime.toString() : undefined; + if (message.rewardTrackers) { + obj.reward_trackers = message.rewardTrackers.map(e => e ? RewardTracker.toAmino(e) : undefined); + } else { + obj.reward_trackers = []; + } + if (message.rewardAccumulators) { + obj.reward_accumulators = message.rewardAccumulators.map(e => e ? RewardAccumulator.toAmino(e) : undefined); + } else { + obj.reward_accumulators = []; + } + if (message.upcomingPrograms) { + obj.upcoming_programs = message.upcomingPrograms.map(e => e ? IncentiveProgram.toAmino(e) : undefined); + } else { + obj.upcoming_programs = []; + } + if (message.ongoingPrograms) { + obj.ongoing_programs = message.ongoingPrograms.map(e => e ? IncentiveProgram.toAmino(e) : undefined); + } else { + obj.ongoing_programs = []; + } + if (message.completedPrograms) { + obj.completed_programs = message.completedPrograms.map(e => e ? IncentiveProgram.toAmino(e) : undefined); + } else { + obj.completed_programs = []; + } + if (message.bonds) { + obj.bonds = message.bonds.map(e => e ? Bond.toAmino(e) : undefined); + } else { + obj.bonds = []; + } + if (message.accountUnbondings) { + obj.account_unbondings = message.accountUnbondings.map(e => e ? AccountUnbondings.toAmino(e) : undefined); + } else { + obj.account_unbondings = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/umee.incentive.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; +function createBaseBond(): Bond { + return { + account: "", + uToken: Coin.fromPartial({}) + }; +} +export const Bond = { + typeUrl: "/umee.incentive.v1.Bond", + encode(message: Bond, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.uToken !== undefined) { + Coin.encode(message.uToken, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Bond { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.uToken = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Bond { + const message = createBaseBond(); + message.account = object.account ?? ""; + message.uToken = object.uToken !== undefined && object.uToken !== null ? Coin.fromPartial(object.uToken) : undefined; + return message; + }, + fromAmino(object: BondAmino): Bond { + const message = createBaseBond(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = Coin.fromAmino(object.uToken); + } + return message; + }, + toAmino(message: Bond): BondAmino { + const obj: any = {}; + obj.account = message.account; + obj.uToken = message.uToken ? Coin.toAmino(message.uToken) : undefined; + return obj; + }, + fromAminoMsg(object: BondAminoMsg): Bond { + return Bond.fromAmino(object.value); + }, + fromProtoMsg(message: BondProtoMsg): Bond { + return Bond.decode(message.value); + }, + toProto(message: Bond): Uint8Array { + return Bond.encode(message).finish(); + }, + toProtoMsg(message: Bond): BondProtoMsg { + return { + typeUrl: "/umee.incentive.v1.Bond", + value: Bond.encode(message).finish() + }; + } +}; +function createBaseRewardTracker(): RewardTracker { + return { + account: "", + uToken: "", + rewards: [] + }; +} +export const RewardTracker = { + typeUrl: "/umee.incentive.v1.RewardTracker", + encode(message: RewardTracker, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.uToken !== "") { + writer.uint32(18).string(message.uToken); + } + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RewardTracker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRewardTracker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.uToken = reader.string(); + break; + case 3: + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): RewardTracker { + const message = createBaseRewardTracker(); + message.account = object.account ?? ""; + message.uToken = object.uToken ?? ""; + message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: RewardTrackerAmino): RewardTracker { + const message = createBaseRewardTracker(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = object.uToken; + } + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: RewardTracker): RewardTrackerAmino { + const obj: any = {}; + obj.account = message.account; + obj.uToken = message.uToken; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + fromAminoMsg(object: RewardTrackerAminoMsg): RewardTracker { + return RewardTracker.fromAmino(object.value); + }, + fromProtoMsg(message: RewardTrackerProtoMsg): RewardTracker { + return RewardTracker.decode(message.value); + }, + toProto(message: RewardTracker): Uint8Array { + return RewardTracker.encode(message).finish(); + }, + toProtoMsg(message: RewardTracker): RewardTrackerProtoMsg { + return { + typeUrl: "/umee.incentive.v1.RewardTracker", + value: RewardTracker.encode(message).finish() + }; + } +}; +function createBaseRewardAccumulator(): RewardAccumulator { + return { + uToken: "", + rewards: [], + exponent: 0 + }; +} +export const RewardAccumulator = { + typeUrl: "/umee.incentive.v1.RewardAccumulator", + encode(message: RewardAccumulator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.uToken !== "") { + writer.uint32(10).string(message.uToken); + } + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.exponent !== 0) { + writer.uint32(24).uint32(message.exponent); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RewardAccumulator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRewardAccumulator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uToken = reader.string(); + break; + case 2: + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + case 3: + message.exponent = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): RewardAccumulator { + const message = createBaseRewardAccumulator(); + message.uToken = object.uToken ?? ""; + message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; + message.exponent = object.exponent ?? 0; + return message; + }, + fromAmino(object: RewardAccumulatorAmino): RewardAccumulator { + const message = createBaseRewardAccumulator(); + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = object.uToken; + } + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + return message; + }, + toAmino(message: RewardAccumulator): RewardAccumulatorAmino { + const obj: any = {}; + obj.uToken = message.uToken; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = []; + } + obj.exponent = message.exponent; + return obj; + }, + fromAminoMsg(object: RewardAccumulatorAminoMsg): RewardAccumulator { + return RewardAccumulator.fromAmino(object.value); + }, + fromProtoMsg(message: RewardAccumulatorProtoMsg): RewardAccumulator { + return RewardAccumulator.decode(message.value); + }, + toProto(message: RewardAccumulator): Uint8Array { + return RewardAccumulator.encode(message).finish(); + }, + toProtoMsg(message: RewardAccumulator): RewardAccumulatorProtoMsg { + return { + typeUrl: "/umee.incentive.v1.RewardAccumulator", + value: RewardAccumulator.encode(message).finish() + }; + } +}; +function createBaseUnbonding(): Unbonding { + return { + start: BigInt(0), + end: BigInt(0), + uToken: Coin.fromPartial({}) + }; +} +export const Unbonding = { + typeUrl: "/umee.incentive.v1.Unbonding", + encode(message: Unbonding, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== BigInt(0)) { + writer.uint32(8).int64(message.start); + } + if (message.end !== BigInt(0)) { + writer.uint32(16).int64(message.end); + } + if (message.uToken !== undefined) { + Coin.encode(message.uToken, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Unbonding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbonding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int64(); + break; + case 2: + message.end = reader.int64(); + break; + case 3: + message.uToken = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Unbonding { + const message = createBaseUnbonding(); + message.start = object.start !== undefined && object.start !== null ? BigInt(object.start.toString()) : BigInt(0); + message.end = object.end !== undefined && object.end !== null ? BigInt(object.end.toString()) : BigInt(0); + message.uToken = object.uToken !== undefined && object.uToken !== null ? Coin.fromPartial(object.uToken) : undefined; + return message; + }, + fromAmino(object: UnbondingAmino): Unbonding { + const message = createBaseUnbonding(); + if (object.start !== undefined && object.start !== null) { + message.start = BigInt(object.start); + } + if (object.end !== undefined && object.end !== null) { + message.end = BigInt(object.end); + } + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = Coin.fromAmino(object.uToken); + } + return message; + }, + toAmino(message: Unbonding): UnbondingAmino { + const obj: any = {}; + obj.start = message.start ? message.start.toString() : undefined; + obj.end = message.end ? message.end.toString() : undefined; + obj.uToken = message.uToken ? Coin.toAmino(message.uToken) : undefined; + return obj; + }, + fromAminoMsg(object: UnbondingAminoMsg): Unbonding { + return Unbonding.fromAmino(object.value); + }, + fromProtoMsg(message: UnbondingProtoMsg): Unbonding { + return Unbonding.decode(message.value); + }, + toProto(message: Unbonding): Uint8Array { + return Unbonding.encode(message).finish(); + }, + toProtoMsg(message: Unbonding): UnbondingProtoMsg { + return { + typeUrl: "/umee.incentive.v1.Unbonding", + value: Unbonding.encode(message).finish() + }; + } +}; +function createBaseAccountUnbondings(): AccountUnbondings { + return { + account: "", + uToken: "", + unbondings: [] + }; +} +export const AccountUnbondings = { + typeUrl: "/umee.incentive.v1.AccountUnbondings", + encode(message: AccountUnbondings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.uToken !== "") { + writer.uint32(18).string(message.uToken); + } + for (const v of message.unbondings) { + Unbonding.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AccountUnbondings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountUnbondings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.uToken = reader.string(); + break; + case 3: + message.unbondings.push(Unbonding.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): AccountUnbondings { + const message = createBaseAccountUnbondings(); + message.account = object.account ?? ""; + message.uToken = object.uToken ?? ""; + message.unbondings = object.unbondings?.map(e => Unbonding.fromPartial(e)) || []; + return message; + }, + fromAmino(object: AccountUnbondingsAmino): AccountUnbondings { + const message = createBaseAccountUnbondings(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = object.uToken; + } + message.unbondings = object.unbondings?.map(e => Unbonding.fromAmino(e)) || []; + return message; + }, + toAmino(message: AccountUnbondings): AccountUnbondingsAmino { + const obj: any = {}; + obj.account = message.account; + obj.uToken = message.uToken; + if (message.unbondings) { + obj.unbondings = message.unbondings.map(e => e ? Unbonding.toAmino(e) : undefined); + } else { + obj.unbondings = []; + } + return obj; + }, + fromAminoMsg(object: AccountUnbondingsAminoMsg): AccountUnbondings { + return AccountUnbondings.fromAmino(object.value); + }, + fromProtoMsg(message: AccountUnbondingsProtoMsg): AccountUnbondings { + return AccountUnbondings.decode(message.value); + }, + toProto(message: AccountUnbondings): Uint8Array { + return AccountUnbondings.encode(message).finish(); + }, + toProtoMsg(message: AccountUnbondings): AccountUnbondingsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.AccountUnbondings", + value: AccountUnbondings.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/incentive/v1/incentive.ts b/src/codegen/umee/incentive/v1/incentive.ts new file mode 100644 index 0000000..710c05c --- /dev/null +++ b/src/codegen/umee/incentive/v1/incentive.ts @@ -0,0 +1,390 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +/** Params defines the parameters for the incentive module. */ +export interface Params { + /** + * max_unbondings is the maximum amount of concurrent unbondings an address can have + * of each bonded uToken denom. Zero is interpreted as no limit. + */ + maxUnbondings: number; + /** unbonding_duration is the unbonding duration (in seconds). */ + unbondingDuration: bigint; + /** + * emergency_unbond_fee is the portion of a bond that is paid when it is instantly + * released using MsgEmergencyUnbond. For example, 0.01 is a 1% fee. Ranges 0-1. + */ + emergencyUnbondFee: string; +} +export interface ParamsProtoMsg { + typeUrl: "/umee.incentive.v1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the incentive module. */ +export interface ParamsAmino { + /** + * max_unbondings is the maximum amount of concurrent unbondings an address can have + * of each bonded uToken denom. Zero is interpreted as no limit. + */ + max_unbondings?: number; + /** unbonding_duration is the unbonding duration (in seconds). */ + unbonding_duration?: string; + /** + * emergency_unbond_fee is the portion of a bond that is paid when it is instantly + * released using MsgEmergencyUnbond. For example, 0.01 is a 1% fee. Ranges 0-1. + */ + emergency_unbond_fee?: string; +} +export interface ParamsAminoMsg { + type: "/umee.incentive.v1.Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the incentive module. */ +export interface ParamsSDKType { + max_unbondings: number; + unbonding_duration: bigint; + emergency_unbond_fee: string; +} +/** + * IncentiveProgram defines a liquidity mining incentive program on a single + * locked uToken denom that will run for a set amount of time. + */ +export interface IncentiveProgram { + /** + * ID uniquely identifies the incentive program after it has been created. + * It is zero when the program is being proposed by governance, and is set + * to its final value when the proposal passes. + */ + ID: number; + /** + * start_time is the unix time (in seconds) at which the incentives begin. + * If a program is passed after its intended start time, its start time + * will be increased to the current time, with program duration unchanged. + */ + startTime: bigint; + /** + * duration is the length of the incentive program from start time to + * completion in seconds. + */ + duration: bigint; + /** + * uToken is the incentivized uToken collateral denom. Suppliers who collateralize + * this asset then bond it to the incentive module are eligible for this program's + * rewards. + */ + uToken: string; + /** + * funded indicates whether a program bas been funded. This can happen when + * a program passes if funding from community fund, or any time before the + * program's start time if funding with MsgSponsor. A program that reaches + * its start time without being funded is cancelled. + */ + funded: boolean; + /** + * total_rewards are total amount of rewards which can be distributed to + * suppliers by this program. This is set to its final value when the program + * is proposed by governance. + */ + totalRewards: Coin; + /** + * remaining_rewards are total amount of this program's funded rewards + * which have not yet been allocated to suppliers. This is zero until the + * program is both passed by governance and funded, at which point it + * starts at the same value as total_rewards then begins decreasing + * to zero as the program runs to completion. + */ + remainingRewards: Coin; +} +export interface IncentiveProgramProtoMsg { + typeUrl: "/umee.incentive.v1.IncentiveProgram"; + value: Uint8Array; +} +/** + * IncentiveProgram defines a liquidity mining incentive program on a single + * locked uToken denom that will run for a set amount of time. + */ +export interface IncentiveProgramAmino { + /** + * ID uniquely identifies the incentive program after it has been created. + * It is zero when the program is being proposed by governance, and is set + * to its final value when the proposal passes. + */ + ID?: number; + /** + * start_time is the unix time (in seconds) at which the incentives begin. + * If a program is passed after its intended start time, its start time + * will be increased to the current time, with program duration unchanged. + */ + start_time?: string; + /** + * duration is the length of the incentive program from start time to + * completion in seconds. + */ + duration?: string; + /** + * uToken is the incentivized uToken collateral denom. Suppliers who collateralize + * this asset then bond it to the incentive module are eligible for this program's + * rewards. + */ + uToken?: string; + /** + * funded indicates whether a program bas been funded. This can happen when + * a program passes if funding from community fund, or any time before the + * program's start time if funding with MsgSponsor. A program that reaches + * its start time without being funded is cancelled. + */ + funded?: boolean; + /** + * total_rewards are total amount of rewards which can be distributed to + * suppliers by this program. This is set to its final value when the program + * is proposed by governance. + */ + total_rewards?: CoinAmino; + /** + * remaining_rewards are total amount of this program's funded rewards + * which have not yet been allocated to suppliers. This is zero until the + * program is both passed by governance and funded, at which point it + * starts at the same value as total_rewards then begins decreasing + * to zero as the program runs to completion. + */ + remaining_rewards?: CoinAmino; +} +export interface IncentiveProgramAminoMsg { + type: "/umee.incentive.v1.IncentiveProgram"; + value: IncentiveProgramAmino; +} +/** + * IncentiveProgram defines a liquidity mining incentive program on a single + * locked uToken denom that will run for a set amount of time. + */ +export interface IncentiveProgramSDKType { + ID: number; + start_time: bigint; + duration: bigint; + uToken: string; + funded: boolean; + total_rewards: CoinSDKType; + remaining_rewards: CoinSDKType; +} +function createBaseParams(): Params { + return { + maxUnbondings: 0, + unbondingDuration: BigInt(0), + emergencyUnbondFee: "" + }; +} +export const Params = { + typeUrl: "/umee.incentive.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxUnbondings !== 0) { + writer.uint32(8).uint32(message.maxUnbondings); + } + if (message.unbondingDuration !== BigInt(0)) { + writer.uint32(16).int64(message.unbondingDuration); + } + if (message.emergencyUnbondFee !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.emergencyUnbondFee, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxUnbondings = reader.uint32(); + break; + case 2: + message.unbondingDuration = reader.int64(); + break; + case 3: + message.emergencyUnbondFee = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.maxUnbondings = object.maxUnbondings ?? 0; + message.unbondingDuration = object.unbondingDuration !== undefined && object.unbondingDuration !== null ? BigInt(object.unbondingDuration.toString()) : BigInt(0); + message.emergencyUnbondFee = object.emergencyUnbondFee ?? ""; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.max_unbondings !== undefined && object.max_unbondings !== null) { + message.maxUnbondings = object.max_unbondings; + } + if (object.unbonding_duration !== undefined && object.unbonding_duration !== null) { + message.unbondingDuration = BigInt(object.unbonding_duration); + } + if (object.emergency_unbond_fee !== undefined && object.emergency_unbond_fee !== null) { + message.emergencyUnbondFee = object.emergency_unbond_fee; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.max_unbondings = message.maxUnbondings; + obj.unbonding_duration = message.unbondingDuration ? message.unbondingDuration.toString() : undefined; + obj.emergency_unbond_fee = message.emergencyUnbondFee; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +function createBaseIncentiveProgram(): IncentiveProgram { + return { + ID: 0, + startTime: BigInt(0), + duration: BigInt(0), + uToken: "", + funded: false, + totalRewards: Coin.fromPartial({}), + remainingRewards: Coin.fromPartial({}) + }; +} +export const IncentiveProgram = { + typeUrl: "/umee.incentive.v1.IncentiveProgram", + encode(message: IncentiveProgram, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.ID !== 0) { + writer.uint32(8).uint32(message.ID); + } + if (message.startTime !== BigInt(0)) { + writer.uint32(16).int64(message.startTime); + } + if (message.duration !== BigInt(0)) { + writer.uint32(24).int64(message.duration); + } + if (message.uToken !== "") { + writer.uint32(34).string(message.uToken); + } + if (message.funded === true) { + writer.uint32(40).bool(message.funded); + } + if (message.totalRewards !== undefined) { + Coin.encode(message.totalRewards, writer.uint32(50).fork()).ldelim(); + } + if (message.remainingRewards !== undefined) { + Coin.encode(message.remainingRewards, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IncentiveProgram { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIncentiveProgram(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ID = reader.uint32(); + break; + case 2: + message.startTime = reader.int64(); + break; + case 3: + message.duration = reader.int64(); + break; + case 4: + message.uToken = reader.string(); + break; + case 5: + message.funded = reader.bool(); + break; + case 6: + message.totalRewards = Coin.decode(reader, reader.uint32()); + break; + case 7: + message.remainingRewards = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): IncentiveProgram { + const message = createBaseIncentiveProgram(); + message.ID = object.ID ?? 0; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + message.duration = object.duration !== undefined && object.duration !== null ? BigInt(object.duration.toString()) : BigInt(0); + message.uToken = object.uToken ?? ""; + message.funded = object.funded ?? false; + message.totalRewards = object.totalRewards !== undefined && object.totalRewards !== null ? Coin.fromPartial(object.totalRewards) : undefined; + message.remainingRewards = object.remainingRewards !== undefined && object.remainingRewards !== null ? Coin.fromPartial(object.remainingRewards) : undefined; + return message; + }, + fromAmino(object: IncentiveProgramAmino): IncentiveProgram { + const message = createBaseIncentiveProgram(); + if (object.ID !== undefined && object.ID !== null) { + message.ID = object.ID; + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + if (object.duration !== undefined && object.duration !== null) { + message.duration = BigInt(object.duration); + } + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = object.uToken; + } + if (object.funded !== undefined && object.funded !== null) { + message.funded = object.funded; + } + if (object.total_rewards !== undefined && object.total_rewards !== null) { + message.totalRewards = Coin.fromAmino(object.total_rewards); + } + if (object.remaining_rewards !== undefined && object.remaining_rewards !== null) { + message.remainingRewards = Coin.fromAmino(object.remaining_rewards); + } + return message; + }, + toAmino(message: IncentiveProgram): IncentiveProgramAmino { + const obj: any = {}; + obj.ID = message.ID; + obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.duration = message.duration ? message.duration.toString() : undefined; + obj.uToken = message.uToken; + obj.funded = message.funded; + obj.total_rewards = message.totalRewards ? Coin.toAmino(message.totalRewards) : undefined; + obj.remaining_rewards = message.remainingRewards ? Coin.toAmino(message.remainingRewards) : undefined; + return obj; + }, + fromAminoMsg(object: IncentiveProgramAminoMsg): IncentiveProgram { + return IncentiveProgram.fromAmino(object.value); + }, + fromProtoMsg(message: IncentiveProgramProtoMsg): IncentiveProgram { + return IncentiveProgram.decode(message.value); + }, + toProto(message: IncentiveProgram): Uint8Array { + return IncentiveProgram.encode(message).finish(); + }, + toProtoMsg(message: IncentiveProgram): IncentiveProgramProtoMsg { + return { + typeUrl: "/umee.incentive.v1.IncentiveProgram", + value: IncentiveProgram.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/incentive/v1/query.lcd.ts b/src/codegen/umee/incentive/v1/query.lcd.ts new file mode 100644 index 0000000..038e75b --- /dev/null +++ b/src/codegen/umee/incentive/v1/query.lcd.ts @@ -0,0 +1,115 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryParams, QueryParamsResponseSDKType, QueryTotalBonded, QueryTotalBondedResponseSDKType, QueryTotalUnbonding, QueryTotalUnbondingResponseSDKType, QueryAccountBonds, QueryAccountBondsResponseSDKType, QueryPendingRewards, QueryPendingRewardsResponseSDKType, QueryCompletedIncentivePrograms, QueryCompletedIncentiveProgramsResponseSDKType, QueryOngoingIncentivePrograms, QueryOngoingIncentiveProgramsResponseSDKType, QueryUpcomingIncentivePrograms, QueryUpcomingIncentiveProgramsResponseSDKType, QueryIncentiveProgram, QueryIncentiveProgramResponseSDKType, QueryCurrentRates, QueryCurrentRatesResponseSDKType, QueryActualRates, QueryActualRatesResponseSDKType, QueryLastRewardTime, QueryLastRewardTimeResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.params = this.params.bind(this); + this.totalBonded = this.totalBonded.bind(this); + this.totalUnbonding = this.totalUnbonding.bind(this); + this.accountBonds = this.accountBonds.bind(this); + this.pendingRewards = this.pendingRewards.bind(this); + this.completedIncentivePrograms = this.completedIncentivePrograms.bind(this); + this.ongoingIncentivePrograms = this.ongoingIncentivePrograms.bind(this); + this.upcomingIncentivePrograms = this.upcomingIncentivePrograms.bind(this); + this.incentiveProgram = this.incentiveProgram.bind(this); + this.currentRates = this.currentRates.bind(this); + this.actualRates = this.actualRates.bind(this); + this.lastRewardTime = this.lastRewardTime.bind(this); + } + /* Params queries the parameters of the x/incentive module. */ + async params(_params: QueryParams = {}): Promise { + const endpoint = `umee/incentive/v1/params`; + return await this.req.get(endpoint); + } + /* TotalBonded queries the sum of all bonded collateral uTokens. */ + async totalBonded(params: QueryTotalBonded): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/incentive/v1/total_bonded`; + return await this.req.get(endpoint, options); + } + /* TotalUnbonding queries the sum of all unbonding collateral uTokens. */ + async totalUnbonding(params: QueryTotalUnbonding): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/incentive/v1/total_unbonding`; + return await this.req.get(endpoint, options); + } + /* AccountBonds queries all bonded collateral and unbondings associated with an account. */ + async accountBonds(params: QueryAccountBonds): Promise { + const endpoint = `umee/incentive/v1/account_bonds/${params.address}`; + return await this.req.get(endpoint); + } + /* PendingRewards queries unclaimed incentive rewards associated with an account. */ + async pendingRewards(params: QueryPendingRewards): Promise { + const endpoint = `umee/incentive/v1/pending_rewards/${params.address}`; + return await this.req.get(endpoint); + } + /* CompletedIncentivePrograms queries for all incentives programs that have been passed + by governance, and either run to completion or expired immediately due to not being funded. */ + async completedIncentivePrograms(_params: QueryCompletedIncentivePrograms = {}): Promise { + const endpoint = `umee/incentive/v1/programs/completed`; + return await this.req.get(endpoint); + } + /* OngoingIncentivePrograms queries for all incentives programs that have been passed + by governance, funded, and started but not yet completed. */ + async ongoingIncentivePrograms(_params: QueryOngoingIncentivePrograms = {}): Promise { + const endpoint = `umee/incentive/v1/programs/ongoing`; + return await this.req.get(endpoint); + } + /* UpcomingIncentivePrograms queries for all incentives programs that have been passed + by governance, but not yet started. They may or may not have been funded. */ + async upcomingIncentivePrograms(_params: QueryUpcomingIncentivePrograms = {}): Promise { + const endpoint = `umee/incentive/v1/programs/upcoming`; + return await this.req.get(endpoint); + } + /* IncentiveProgram queries a single incentive program by ID. */ + async incentiveProgram(params: QueryIncentiveProgram): Promise { + const endpoint = `umee/incentive/v1/program/${params.id}`; + return await this.req.get(endpoint); + } + /* CurrentRates queries the hypothetical return of a bonded uToken denomination + if current incentive rewards continued for one year. The response is an sdk.Coins + of base token rewards, per reference amount (usually 10^exponent of the uToken.) */ + async currentRates(params: QueryCurrentRates): Promise { + const options: any = { + params: {} + }; + if (typeof params?.uToken !== "undefined") { + options.params.uToken = params.uToken; + } + const endpoint = `umee/incentive/v1/current_rates`; + return await this.req.get(endpoint, options); + } + /* ActualRates queries the hypothetical return of a bonded uToken denomination + if current incentive rewards continued for one year. The response is an sdk.Dec + representing an oracle-adjusted APY. */ + async actualRates(params: QueryActualRates): Promise { + const options: any = { + params: {} + }; + if (typeof params?.uToken !== "undefined") { + options.params.uToken = params.uToken; + } + const endpoint = `umee/incentive/v1/actual_rates`; + return await this.req.get(endpoint, options); + } + /* LastRewardTime queries the last block time at which incentive rewards were calculated. */ + async lastRewardTime(_params: QueryLastRewardTime = {}): Promise { + const endpoint = `umee/incentive/v1/last_reward_time`; + return await this.req.get(endpoint); + } +} \ No newline at end of file diff --git a/src/codegen/umee/incentive/v1/query.rpc.Query.ts b/src/codegen/umee/incentive/v1/query.rpc.Query.ts new file mode 100644 index 0000000..d6cb943 --- /dev/null +++ b/src/codegen/umee/incentive/v1/query.rpc.Query.ts @@ -0,0 +1,168 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParams, QueryParamsResponse, QueryTotalBonded, QueryTotalBondedResponse, QueryTotalUnbonding, QueryTotalUnbondingResponse, QueryAccountBonds, QueryAccountBondsResponse, QueryPendingRewards, QueryPendingRewardsResponse, QueryCompletedIncentivePrograms, QueryCompletedIncentiveProgramsResponse, QueryOngoingIncentivePrograms, QueryOngoingIncentiveProgramsResponse, QueryUpcomingIncentivePrograms, QueryUpcomingIncentiveProgramsResponse, QueryIncentiveProgram, QueryIncentiveProgramResponse, QueryCurrentRates, QueryCurrentRatesResponse, QueryActualRates, QueryActualRatesResponse, QueryLastRewardTime, QueryLastRewardTimeResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of the x/incentive module. */ + params(request?: QueryParams): Promise; + /** TotalBonded queries the sum of all bonded collateral uTokens. */ + totalBonded(request: QueryTotalBonded): Promise; + /** TotalUnbonding queries the sum of all unbonding collateral uTokens. */ + totalUnbonding(request: QueryTotalUnbonding): Promise; + /** AccountBonds queries all bonded collateral and unbondings associated with an account. */ + accountBonds(request: QueryAccountBonds): Promise; + /** PendingRewards queries unclaimed incentive rewards associated with an account. */ + pendingRewards(request: QueryPendingRewards): Promise; + /** + * CompletedIncentivePrograms queries for all incentives programs that have been passed + * by governance, and either run to completion or expired immediately due to not being funded. + */ + completedIncentivePrograms(request?: QueryCompletedIncentivePrograms): Promise; + /** + * OngoingIncentivePrograms queries for all incentives programs that have been passed + * by governance, funded, and started but not yet completed. + */ + ongoingIncentivePrograms(request?: QueryOngoingIncentivePrograms): Promise; + /** + * UpcomingIncentivePrograms queries for all incentives programs that have been passed + * by governance, but not yet started. They may or may not have been funded. + */ + upcomingIncentivePrograms(request?: QueryUpcomingIncentivePrograms): Promise; + /** IncentiveProgram queries a single incentive program by ID. */ + incentiveProgram(request: QueryIncentiveProgram): Promise; + /** + * CurrentRates queries the hypothetical return of a bonded uToken denomination + * if current incentive rewards continued for one year. The response is an sdk.Coins + * of base token rewards, per reference amount (usually 10^exponent of the uToken.) + */ + currentRates(request: QueryCurrentRates): Promise; + /** + * ActualRates queries the hypothetical return of a bonded uToken denomination + * if current incentive rewards continued for one year. The response is an sdk.Dec + * representing an oracle-adjusted APY. + */ + actualRates(request: QueryActualRates): Promise; + /** LastRewardTime queries the last block time at which incentive rewards were calculated. */ + lastRewardTime(request?: QueryLastRewardTime): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.params = this.params.bind(this); + this.totalBonded = this.totalBonded.bind(this); + this.totalUnbonding = this.totalUnbonding.bind(this); + this.accountBonds = this.accountBonds.bind(this); + this.pendingRewards = this.pendingRewards.bind(this); + this.completedIncentivePrograms = this.completedIncentivePrograms.bind(this); + this.ongoingIncentivePrograms = this.ongoingIncentivePrograms.bind(this); + this.upcomingIncentivePrograms = this.upcomingIncentivePrograms.bind(this); + this.incentiveProgram = this.incentiveProgram.bind(this); + this.currentRates = this.currentRates.bind(this); + this.actualRates = this.actualRates.bind(this); + this.lastRewardTime = this.lastRewardTime.bind(this); + } + params(request: QueryParams = {}): Promise { + const data = QueryParams.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + } + totalBonded(request: QueryTotalBonded): Promise { + const data = QueryTotalBonded.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "TotalBonded", data); + return promise.then(data => QueryTotalBondedResponse.decode(new BinaryReader(data))); + } + totalUnbonding(request: QueryTotalUnbonding): Promise { + const data = QueryTotalUnbonding.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "TotalUnbonding", data); + return promise.then(data => QueryTotalUnbondingResponse.decode(new BinaryReader(data))); + } + accountBonds(request: QueryAccountBonds): Promise { + const data = QueryAccountBonds.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "AccountBonds", data); + return promise.then(data => QueryAccountBondsResponse.decode(new BinaryReader(data))); + } + pendingRewards(request: QueryPendingRewards): Promise { + const data = QueryPendingRewards.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "PendingRewards", data); + return promise.then(data => QueryPendingRewardsResponse.decode(new BinaryReader(data))); + } + completedIncentivePrograms(request: QueryCompletedIncentivePrograms = {}): Promise { + const data = QueryCompletedIncentivePrograms.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "CompletedIncentivePrograms", data); + return promise.then(data => QueryCompletedIncentiveProgramsResponse.decode(new BinaryReader(data))); + } + ongoingIncentivePrograms(request: QueryOngoingIncentivePrograms = {}): Promise { + const data = QueryOngoingIncentivePrograms.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "OngoingIncentivePrograms", data); + return promise.then(data => QueryOngoingIncentiveProgramsResponse.decode(new BinaryReader(data))); + } + upcomingIncentivePrograms(request: QueryUpcomingIncentivePrograms = {}): Promise { + const data = QueryUpcomingIncentivePrograms.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "UpcomingIncentivePrograms", data); + return promise.then(data => QueryUpcomingIncentiveProgramsResponse.decode(new BinaryReader(data))); + } + incentiveProgram(request: QueryIncentiveProgram): Promise { + const data = QueryIncentiveProgram.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "IncentiveProgram", data); + return promise.then(data => QueryIncentiveProgramResponse.decode(new BinaryReader(data))); + } + currentRates(request: QueryCurrentRates): Promise { + const data = QueryCurrentRates.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "CurrentRates", data); + return promise.then(data => QueryCurrentRatesResponse.decode(new BinaryReader(data))); + } + actualRates(request: QueryActualRates): Promise { + const data = QueryActualRates.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "ActualRates", data); + return promise.then(data => QueryActualRatesResponse.decode(new BinaryReader(data))); + } + lastRewardTime(request: QueryLastRewardTime = {}): Promise { + const data = QueryLastRewardTime.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Query", "LastRewardTime", data); + return promise.then(data => QueryLastRewardTimeResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParams): Promise { + return queryService.params(request); + }, + totalBonded(request: QueryTotalBonded): Promise { + return queryService.totalBonded(request); + }, + totalUnbonding(request: QueryTotalUnbonding): Promise { + return queryService.totalUnbonding(request); + }, + accountBonds(request: QueryAccountBonds): Promise { + return queryService.accountBonds(request); + }, + pendingRewards(request: QueryPendingRewards): Promise { + return queryService.pendingRewards(request); + }, + completedIncentivePrograms(request?: QueryCompletedIncentivePrograms): Promise { + return queryService.completedIncentivePrograms(request); + }, + ongoingIncentivePrograms(request?: QueryOngoingIncentivePrograms): Promise { + return queryService.ongoingIncentivePrograms(request); + }, + upcomingIncentivePrograms(request?: QueryUpcomingIncentivePrograms): Promise { + return queryService.upcomingIncentivePrograms(request); + }, + incentiveProgram(request: QueryIncentiveProgram): Promise { + return queryService.incentiveProgram(request); + }, + currentRates(request: QueryCurrentRates): Promise { + return queryService.currentRates(request); + }, + actualRates(request: QueryActualRates): Promise { + return queryService.actualRates(request); + }, + lastRewardTime(request?: QueryLastRewardTime): Promise { + return queryService.lastRewardTime(request); + } + }; +}; \ No newline at end of file diff --git a/src/codegen/umee/incentive/v1/query.ts b/src/codegen/umee/incentive/v1/query.ts new file mode 100644 index 0000000..1b15170 --- /dev/null +++ b/src/codegen/umee/incentive/v1/query.ts @@ -0,0 +1,2107 @@ +import { Params, ParamsAmino, ParamsSDKType, IncentiveProgram, IncentiveProgramAmino, IncentiveProgramSDKType } from "./incentive"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Unbonding, UnbondingAmino, UnbondingSDKType } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParams {} +export interface QueryParamsProtoMsg { + typeUrl: "/umee.incentive.v1.QueryParams"; + value: Uint8Array; +} +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParamsAmino {} +export interface QueryParamsAminoMsg { + type: "/umee.incentive.v1.QueryParams"; + value: QueryParamsAmino; +} +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParamsSDKType {} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponse { + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "/umee.incentive.v1.QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +/** QueryPendingRewards defines the request structure for the PendingRewards gRPC service handler. */ +export interface QueryPendingRewards { + address: string; +} +export interface QueryPendingRewardsProtoMsg { + typeUrl: "/umee.incentive.v1.QueryPendingRewards"; + value: Uint8Array; +} +/** QueryPendingRewards defines the request structure for the PendingRewards gRPC service handler. */ +export interface QueryPendingRewardsAmino { + address?: string; +} +export interface QueryPendingRewardsAminoMsg { + type: "/umee.incentive.v1.QueryPendingRewards"; + value: QueryPendingRewardsAmino; +} +/** QueryPendingRewards defines the request structure for the PendingRewards gRPC service handler. */ +export interface QueryPendingRewardsSDKType { + address: string; +} +/** QueryPendingRewardsResponse defines the response structure for the PendingRewards gRPC service handler. */ +export interface QueryPendingRewardsResponse { + rewards: Coin[]; +} +export interface QueryPendingRewardsResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryPendingRewardsResponse"; + value: Uint8Array; +} +/** QueryPendingRewardsResponse defines the response structure for the PendingRewards gRPC service handler. */ +export interface QueryPendingRewardsResponseAmino { + rewards?: CoinAmino[]; +} +export interface QueryPendingRewardsResponseAminoMsg { + type: "/umee.incentive.v1.QueryPendingRewardsResponse"; + value: QueryPendingRewardsResponseAmino; +} +/** QueryPendingRewardsResponse defines the response structure for the PendingRewards gRPC service handler. */ +export interface QueryPendingRewardsResponseSDKType { + rewards: CoinSDKType[]; +} +/** QueryAccountBonds defines the request structure for the AccountBonds gRPC service handler. */ +export interface QueryAccountBonds { + address: string; +} +export interface QueryAccountBondsProtoMsg { + typeUrl: "/umee.incentive.v1.QueryAccountBonds"; + value: Uint8Array; +} +/** QueryAccountBonds defines the request structure for the AccountBonds gRPC service handler. */ +export interface QueryAccountBondsAmino { + address?: string; +} +export interface QueryAccountBondsAminoMsg { + type: "/umee.incentive.v1.QueryAccountBonds"; + value: QueryAccountBondsAmino; +} +/** QueryAccountBonds defines the request structure for the AccountBonds gRPC service handler. */ +export interface QueryAccountBondsSDKType { + address: string; +} +/** QueryAccountBondsResponse defines the response structure for the AccountBonds gRPC service handler. */ +export interface QueryAccountBondsResponse { + bonded: Coin[]; + unbonding: Coin[]; + unbondings: Unbonding[]; +} +export interface QueryAccountBondsResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryAccountBondsResponse"; + value: Uint8Array; +} +/** QueryAccountBondsResponse defines the response structure for the AccountBonds gRPC service handler. */ +export interface QueryAccountBondsResponseAmino { + bonded?: CoinAmino[]; + unbonding?: CoinAmino[]; + unbondings?: UnbondingAmino[]; +} +export interface QueryAccountBondsResponseAminoMsg { + type: "/umee.incentive.v1.QueryAccountBondsResponse"; + value: QueryAccountBondsResponseAmino; +} +/** QueryAccountBondsResponse defines the response structure for the AccountBonds gRPC service handler. */ +export interface QueryAccountBondsResponseSDKType { + bonded: CoinSDKType[]; + unbonding: CoinSDKType[]; + unbondings: UnbondingSDKType[]; +} +/** QueryTotalBonded defines the request structure for the TotalBonded gRPC service handler. */ +export interface QueryTotalBonded { + /** denom is an optional field which causes the query to return the totals of only one uToken */ + denom: string; +} +export interface QueryTotalBondedProtoMsg { + typeUrl: "/umee.incentive.v1.QueryTotalBonded"; + value: Uint8Array; +} +/** QueryTotalBonded defines the request structure for the TotalBonded gRPC service handler. */ +export interface QueryTotalBondedAmino { + /** denom is an optional field which causes the query to return the totals of only one uToken */ + denom?: string; +} +export interface QueryTotalBondedAminoMsg { + type: "/umee.incentive.v1.QueryTotalBonded"; + value: QueryTotalBondedAmino; +} +/** QueryTotalBonded defines the request structure for the TotalBonded gRPC service handler. */ +export interface QueryTotalBondedSDKType { + denom: string; +} +/** QueryTotalBondedResponse defines the response structure for the TotalBonded gRPC service handler. */ +export interface QueryTotalBondedResponse { + bonded: Coin[]; +} +export interface QueryTotalBondedResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryTotalBondedResponse"; + value: Uint8Array; +} +/** QueryTotalBondedResponse defines the response structure for the TotalBonded gRPC service handler. */ +export interface QueryTotalBondedResponseAmino { + bonded?: CoinAmino[]; +} +export interface QueryTotalBondedResponseAminoMsg { + type: "/umee.incentive.v1.QueryTotalBondedResponse"; + value: QueryTotalBondedResponseAmino; +} +/** QueryTotalBondedResponse defines the response structure for the TotalBonded gRPC service handler. */ +export interface QueryTotalBondedResponseSDKType { + bonded: CoinSDKType[]; +} +/** QueryTotalUnbonding defines the request structure for the TotalUnbonding gRPC service handler. */ +export interface QueryTotalUnbonding { + /** denom is an optional field which causes the query to return the totals of only one uToken */ + denom: string; +} +export interface QueryTotalUnbondingProtoMsg { + typeUrl: "/umee.incentive.v1.QueryTotalUnbonding"; + value: Uint8Array; +} +/** QueryTotalUnbonding defines the request structure for the TotalUnbonding gRPC service handler. */ +export interface QueryTotalUnbondingAmino { + /** denom is an optional field which causes the query to return the totals of only one uToken */ + denom?: string; +} +export interface QueryTotalUnbondingAminoMsg { + type: "/umee.incentive.v1.QueryTotalUnbonding"; + value: QueryTotalUnbondingAmino; +} +/** QueryTotalUnbonding defines the request structure for the TotalUnbonding gRPC service handler. */ +export interface QueryTotalUnbondingSDKType { + denom: string; +} +/** QueryTotalUnbondingResponse defines the response structure for the TotalUnbonding gRPC service handler. */ +export interface QueryTotalUnbondingResponse { + unbonding: Coin[]; +} +export interface QueryTotalUnbondingResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryTotalUnbondingResponse"; + value: Uint8Array; +} +/** QueryTotalUnbondingResponse defines the response structure for the TotalUnbonding gRPC service handler. */ +export interface QueryTotalUnbondingResponseAmino { + unbonding?: CoinAmino[]; +} +export interface QueryTotalUnbondingResponseAminoMsg { + type: "/umee.incentive.v1.QueryTotalUnbondingResponse"; + value: QueryTotalUnbondingResponseAmino; +} +/** QueryTotalUnbondingResponse defines the response structure for the TotalUnbonding gRPC service handler. */ +export interface QueryTotalUnbondingResponseSDKType { + unbonding: CoinSDKType[]; +} +/** + * QueryUpcomingIncentivePrograms defines the request structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryUpcomingIncentivePrograms {} +export interface QueryUpcomingIncentiveProgramsProtoMsg { + typeUrl: "/umee.incentive.v1.QueryUpcomingIncentivePrograms"; + value: Uint8Array; +} +/** + * QueryUpcomingIncentivePrograms defines the request structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryUpcomingIncentiveProgramsAmino {} +export interface QueryUpcomingIncentiveProgramsAminoMsg { + type: "/umee.incentive.v1.QueryUpcomingIncentivePrograms"; + value: QueryUpcomingIncentiveProgramsAmino; +} +/** + * QueryUpcomingIncentivePrograms defines the request structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryUpcomingIncentiveProgramsSDKType {} +/** + * QueryUpcomingIncentiveProgramsResponse defines the response structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryUpcomingIncentiveProgramsResponse { + programs: IncentiveProgram[]; +} +export interface QueryUpcomingIncentiveProgramsResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryUpcomingIncentiveProgramsResponse"; + value: Uint8Array; +} +/** + * QueryUpcomingIncentiveProgramsResponse defines the response structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryUpcomingIncentiveProgramsResponseAmino { + programs?: IncentiveProgramAmino[]; +} +export interface QueryUpcomingIncentiveProgramsResponseAminoMsg { + type: "/umee.incentive.v1.QueryUpcomingIncentiveProgramsResponse"; + value: QueryUpcomingIncentiveProgramsResponseAmino; +} +/** + * QueryUpcomingIncentiveProgramsResponse defines the response structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryUpcomingIncentiveProgramsResponseSDKType { + programs: IncentiveProgramSDKType[]; +} +/** + * QueryOngoingIncentivePrograms defines the request structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryOngoingIncentivePrograms {} +export interface QueryOngoingIncentiveProgramsProtoMsg { + typeUrl: "/umee.incentive.v1.QueryOngoingIncentivePrograms"; + value: Uint8Array; +} +/** + * QueryOngoingIncentivePrograms defines the request structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryOngoingIncentiveProgramsAmino {} +export interface QueryOngoingIncentiveProgramsAminoMsg { + type: "/umee.incentive.v1.QueryOngoingIncentivePrograms"; + value: QueryOngoingIncentiveProgramsAmino; +} +/** + * QueryOngoingIncentivePrograms defines the request structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryOngoingIncentiveProgramsSDKType {} +/** + * QueryOngoingIncentiveProgramsResponse defines the response structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryOngoingIncentiveProgramsResponse { + programs: IncentiveProgram[]; +} +export interface QueryOngoingIncentiveProgramsResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryOngoingIncentiveProgramsResponse"; + value: Uint8Array; +} +/** + * QueryOngoingIncentiveProgramsResponse defines the response structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryOngoingIncentiveProgramsResponseAmino { + programs?: IncentiveProgramAmino[]; +} +export interface QueryOngoingIncentiveProgramsResponseAminoMsg { + type: "/umee.incentive.v1.QueryOngoingIncentiveProgramsResponse"; + value: QueryOngoingIncentiveProgramsResponseAmino; +} +/** + * QueryOngoingIncentiveProgramsResponse defines the response structure for the + * OngoingIncentivePrograms and UpcomingIncentivePrograms gRPC service handlers. + */ +export interface QueryOngoingIncentiveProgramsResponseSDKType { + programs: IncentiveProgramSDKType[]; +} +/** + * QueryCompletedIncentivePrograms defines the request structure for the + * CompletedIncentivePrograms gRPC service handler. + */ +export interface QueryCompletedIncentivePrograms {} +export interface QueryCompletedIncentiveProgramsProtoMsg { + typeUrl: "/umee.incentive.v1.QueryCompletedIncentivePrograms"; + value: Uint8Array; +} +/** + * QueryCompletedIncentivePrograms defines the request structure for the + * CompletedIncentivePrograms gRPC service handler. + */ +export interface QueryCompletedIncentiveProgramsAmino {} +export interface QueryCompletedIncentiveProgramsAminoMsg { + type: "/umee.incentive.v1.QueryCompletedIncentivePrograms"; + value: QueryCompletedIncentiveProgramsAmino; +} +/** + * QueryCompletedIncentivePrograms defines the request structure for the + * CompletedIncentivePrograms gRPC service handler. + */ +export interface QueryCompletedIncentiveProgramsSDKType {} +/** + * QueryCompletedIncentiveProgramsResponse defines the response structure for the + * CompletedIncentivePrograms gRPC service handler. + */ +export interface QueryCompletedIncentiveProgramsResponse { + programs: IncentiveProgram[]; +} +export interface QueryCompletedIncentiveProgramsResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryCompletedIncentiveProgramsResponse"; + value: Uint8Array; +} +/** + * QueryCompletedIncentiveProgramsResponse defines the response structure for the + * CompletedIncentivePrograms gRPC service handler. + */ +export interface QueryCompletedIncentiveProgramsResponseAmino { + programs?: IncentiveProgramAmino[]; +} +export interface QueryCompletedIncentiveProgramsResponseAminoMsg { + type: "/umee.incentive.v1.QueryCompletedIncentiveProgramsResponse"; + value: QueryCompletedIncentiveProgramsResponseAmino; +} +/** + * QueryCompletedIncentiveProgramsResponse defines the response structure for the + * CompletedIncentivePrograms gRPC service handler. + */ +export interface QueryCompletedIncentiveProgramsResponseSDKType { + programs: IncentiveProgramSDKType[]; +} +/** + * QueryIncentiveProgram defines the request structure for the IncentiveProgram + * gRPC service handler. + */ +export interface QueryIncentiveProgram { + /** ID specifies which program to query for */ + id: number; +} +export interface QueryIncentiveProgramProtoMsg { + typeUrl: "/umee.incentive.v1.QueryIncentiveProgram"; + value: Uint8Array; +} +/** + * QueryIncentiveProgram defines the request structure for the IncentiveProgram + * gRPC service handler. + */ +export interface QueryIncentiveProgramAmino { + /** ID specifies which program to query for */ + id?: number; +} +export interface QueryIncentiveProgramAminoMsg { + type: "/umee.incentive.v1.QueryIncentiveProgram"; + value: QueryIncentiveProgramAmino; +} +/** + * QueryIncentiveProgram defines the request structure for the IncentiveProgram + * gRPC service handler. + */ +export interface QueryIncentiveProgramSDKType { + id: number; +} +/** + * QueryIncentivePrograResponse defines the response structure for the + * IncentiveProgram gRPC service handler. + */ +export interface QueryIncentiveProgramResponse { + program: IncentiveProgram; +} +export interface QueryIncentiveProgramResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryIncentiveProgramResponse"; + value: Uint8Array; +} +/** + * QueryIncentivePrograResponse defines the response structure for the + * IncentiveProgram gRPC service handler. + */ +export interface QueryIncentiveProgramResponseAmino { + program?: IncentiveProgramAmino; +} +export interface QueryIncentiveProgramResponseAminoMsg { + type: "/umee.incentive.v1.QueryIncentiveProgramResponse"; + value: QueryIncentiveProgramResponseAmino; +} +/** + * QueryIncentivePrograResponse defines the response structure for the + * IncentiveProgram gRPC service handler. + */ +export interface QueryIncentiveProgramResponseSDKType { + program: IncentiveProgramSDKType; +} +/** QueryCurrentRates defines the request structure for the CurrentRates gRPC service handler. */ +export interface QueryCurrentRates { + /** uToken is the uToken denomination whose current annual rate of rewards is being queried */ + uToken: string; +} +export interface QueryCurrentRatesProtoMsg { + typeUrl: "/umee.incentive.v1.QueryCurrentRates"; + value: Uint8Array; +} +/** QueryCurrentRates defines the request structure for the CurrentRates gRPC service handler. */ +export interface QueryCurrentRatesAmino { + /** uToken is the uToken denomination whose current annual rate of rewards is being queried */ + uToken?: string; +} +export interface QueryCurrentRatesAminoMsg { + type: "/umee.incentive.v1.QueryCurrentRates"; + value: QueryCurrentRatesAmino; +} +/** QueryCurrentRates defines the request structure for the CurrentRates gRPC service handler. */ +export interface QueryCurrentRatesSDKType { + uToken: string; +} +/** QueryCurrentRatesResponse defines the response structure for the CurrentRates gRPC service handler. */ +export interface QueryCurrentRatesResponse { + /** + * Reference Bond is an amount of bonded uTokens (usually 10^exponent) whose current rewards are being + * calculated. This amount can be used to compute an individual user's rewards: for example, if a user has + * 2.5x the reference amount currently bonded, then they would receive 2.5x the rewards below annually + * at current rates. + */ + referenceBond: Coin; + /** + * Rewards are the amount of base token rewards that the reference amount of bonded uTokens would earn + * if current rates continued for a full year. + */ + rewards: Coin[]; +} +export interface QueryCurrentRatesResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryCurrentRatesResponse"; + value: Uint8Array; +} +/** QueryCurrentRatesResponse defines the response structure for the CurrentRates gRPC service handler. */ +export interface QueryCurrentRatesResponseAmino { + /** + * Reference Bond is an amount of bonded uTokens (usually 10^exponent) whose current rewards are being + * calculated. This amount can be used to compute an individual user's rewards: for example, if a user has + * 2.5x the reference amount currently bonded, then they would receive 2.5x the rewards below annually + * at current rates. + */ + reference_bond?: CoinAmino; + /** + * Rewards are the amount of base token rewards that the reference amount of bonded uTokens would earn + * if current rates continued for a full year. + */ + rewards?: CoinAmino[]; +} +export interface QueryCurrentRatesResponseAminoMsg { + type: "/umee.incentive.v1.QueryCurrentRatesResponse"; + value: QueryCurrentRatesResponseAmino; +} +/** QueryCurrentRatesResponse defines the response structure for the CurrentRates gRPC service handler. */ +export interface QueryCurrentRatesResponseSDKType { + reference_bond: CoinSDKType; + rewards: CoinSDKType[]; +} +/** + * QueryLastRewardTime defines the request structure for the LastRewardTime gRPC service + * handler. + */ +export interface QueryLastRewardTime {} +export interface QueryLastRewardTimeProtoMsg { + typeUrl: "/umee.incentive.v1.QueryLastRewardTime"; + value: Uint8Array; +} +/** + * QueryLastRewardTime defines the request structure for the LastRewardTime gRPC service + * handler. + */ +export interface QueryLastRewardTimeAmino {} +export interface QueryLastRewardTimeAminoMsg { + type: "/umee.incentive.v1.QueryLastRewardTime"; + value: QueryLastRewardTimeAmino; +} +/** + * QueryLastRewardTime defines the request structure for the LastRewardTime gRPC service + * handler. + */ +export interface QueryLastRewardTimeSDKType {} +/** + * QueryLastRewardTimeResponse defines the response structure for the LastRewardTime gRPC + * service handler. + */ +export interface QueryLastRewardTimeResponse { + time: bigint; +} +export interface QueryLastRewardTimeResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryLastRewardTimeResponse"; + value: Uint8Array; +} +/** + * QueryLastRewardTimeResponse defines the response structure for the LastRewardTime gRPC + * service handler. + */ +export interface QueryLastRewardTimeResponseAmino { + time?: string; +} +export interface QueryLastRewardTimeResponseAminoMsg { + type: "/umee.incentive.v1.QueryLastRewardTimeResponse"; + value: QueryLastRewardTimeResponseAmino; +} +/** + * QueryLastRewardTimeResponse defines the response structure for the LastRewardTime gRPC + * service handler. + */ +export interface QueryLastRewardTimeResponseSDKType { + time: bigint; +} +/** QueryActualRates defines the request structure for the ActualRates gRPC service handler. */ +export interface QueryActualRates { + /** uToken is the uToken denomination whose current annual rate of rewards is being queried */ + uToken: string; +} +export interface QueryActualRatesProtoMsg { + typeUrl: "/umee.incentive.v1.QueryActualRates"; + value: Uint8Array; +} +/** QueryActualRates defines the request structure for the ActualRates gRPC service handler. */ +export interface QueryActualRatesAmino { + /** uToken is the uToken denomination whose current annual rate of rewards is being queried */ + uToken?: string; +} +export interface QueryActualRatesAminoMsg { + type: "/umee.incentive.v1.QueryActualRates"; + value: QueryActualRatesAmino; +} +/** QueryActualRates defines the request structure for the ActualRates gRPC service handler. */ +export interface QueryActualRatesSDKType { + uToken: string; +} +/** QueryActualRatesResponse defines the response structure for the ActualRates gRPC service handler. */ +export interface QueryActualRatesResponse { + /** APY is the oracle price-adjusted APY of the bonded uToken. */ + APY: string; +} +export interface QueryActualRatesResponseProtoMsg { + typeUrl: "/umee.incentive.v1.QueryActualRatesResponse"; + value: Uint8Array; +} +/** QueryActualRatesResponse defines the response structure for the ActualRates gRPC service handler. */ +export interface QueryActualRatesResponseAmino { + /** APY is the oracle price-adjusted APY of the bonded uToken. */ + APY?: string; +} +export interface QueryActualRatesResponseAminoMsg { + type: "/umee.incentive.v1.QueryActualRatesResponse"; + value: QueryActualRatesResponseAmino; +} +/** QueryActualRatesResponse defines the response structure for the ActualRates gRPC service handler. */ +export interface QueryActualRatesResponseSDKType { + APY: string; +} +function createBaseQueryParams(): QueryParams { + return {}; +} +export const QueryParams = { + typeUrl: "/umee.incentive.v1.QueryParams", + encode(_: QueryParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryParams { + const message = createBaseQueryParams(); + return message; + }, + fromAmino(_: QueryParamsAmino): QueryParams { + const message = createBaseQueryParams(); + return message; + }, + toAmino(_: QueryParams): QueryParamsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsAminoMsg): QueryParams { + return QueryParams.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsProtoMsg): QueryParams { + return QueryParams.decode(message.value); + }, + toProto(message: QueryParams): Uint8Array { + return QueryParams.encode(message).finish(); + }, + toProtoMsg(message: QueryParams): QueryParamsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryParams", + value: QueryParams.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/umee.incentive.v1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryPendingRewards(): QueryPendingRewards { + return { + address: "" + }; +} +export const QueryPendingRewards = { + typeUrl: "/umee.incentive.v1.QueryPendingRewards", + encode(message: QueryPendingRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPendingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPendingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryPendingRewards { + const message = createBaseQueryPendingRewards(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryPendingRewardsAmino): QueryPendingRewards { + const message = createBaseQueryPendingRewards(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryPendingRewards): QueryPendingRewardsAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryPendingRewardsAminoMsg): QueryPendingRewards { + return QueryPendingRewards.fromAmino(object.value); + }, + fromProtoMsg(message: QueryPendingRewardsProtoMsg): QueryPendingRewards { + return QueryPendingRewards.decode(message.value); + }, + toProto(message: QueryPendingRewards): Uint8Array { + return QueryPendingRewards.encode(message).finish(); + }, + toProtoMsg(message: QueryPendingRewards): QueryPendingRewardsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryPendingRewards", + value: QueryPendingRewards.encode(message).finish() + }; + } +}; +function createBaseQueryPendingRewardsResponse(): QueryPendingRewardsResponse { + return { + rewards: [] + }; +} +export const QueryPendingRewardsResponse = { + typeUrl: "/umee.incentive.v1.QueryPendingRewardsResponse", + encode(message: QueryPendingRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rewards) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPendingRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPendingRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryPendingRewardsResponse { + const message = createBaseQueryPendingRewardsResponse(); + message.rewards = object.rewards?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryPendingRewardsResponseAmino): QueryPendingRewardsResponse { + const message = createBaseQueryPendingRewardsResponse(); + message.rewards = object.rewards?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryPendingRewardsResponse): QueryPendingRewardsResponseAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + fromAminoMsg(object: QueryPendingRewardsResponseAminoMsg): QueryPendingRewardsResponse { + return QueryPendingRewardsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryPendingRewardsResponseProtoMsg): QueryPendingRewardsResponse { + return QueryPendingRewardsResponse.decode(message.value); + }, + toProto(message: QueryPendingRewardsResponse): Uint8Array { + return QueryPendingRewardsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPendingRewardsResponse): QueryPendingRewardsResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryPendingRewardsResponse", + value: QueryPendingRewardsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAccountBonds(): QueryAccountBonds { + return { + address: "" + }; +} +export const QueryAccountBonds = { + typeUrl: "/umee.incentive.v1.QueryAccountBonds", + encode(message: QueryAccountBonds, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountBonds { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountBonds(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryAccountBonds { + const message = createBaseQueryAccountBonds(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryAccountBondsAmino): QueryAccountBonds { + const message = createBaseQueryAccountBonds(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountBonds): QueryAccountBondsAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountBondsAminoMsg): QueryAccountBonds { + return QueryAccountBonds.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAccountBondsProtoMsg): QueryAccountBonds { + return QueryAccountBonds.decode(message.value); + }, + toProto(message: QueryAccountBonds): Uint8Array { + return QueryAccountBonds.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountBonds): QueryAccountBondsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryAccountBonds", + value: QueryAccountBonds.encode(message).finish() + }; + } +}; +function createBaseQueryAccountBondsResponse(): QueryAccountBondsResponse { + return { + bonded: [], + unbonding: [], + unbondings: [] + }; +} +export const QueryAccountBondsResponse = { + typeUrl: "/umee.incentive.v1.QueryAccountBondsResponse", + encode(message: QueryAccountBondsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.bonded) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.unbonding) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.unbondings) { + Unbonding.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountBondsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountBondsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bonded.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.unbonding.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.unbondings.push(Unbonding.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryAccountBondsResponse { + const message = createBaseQueryAccountBondsResponse(); + message.bonded = object.bonded?.map(e => Coin.fromPartial(e)) || []; + message.unbonding = object.unbonding?.map(e => Coin.fromPartial(e)) || []; + message.unbondings = object.unbondings?.map(e => Unbonding.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryAccountBondsResponseAmino): QueryAccountBondsResponse { + const message = createBaseQueryAccountBondsResponse(); + message.bonded = object.bonded?.map(e => Coin.fromAmino(e)) || []; + message.unbonding = object.unbonding?.map(e => Coin.fromAmino(e)) || []; + message.unbondings = object.unbondings?.map(e => Unbonding.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryAccountBondsResponse): QueryAccountBondsResponseAmino { + const obj: any = {}; + if (message.bonded) { + obj.bonded = message.bonded.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.bonded = []; + } + if (message.unbonding) { + obj.unbonding = message.unbonding.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.unbonding = []; + } + if (message.unbondings) { + obj.unbondings = message.unbondings.map(e => e ? Unbonding.toAmino(e) : undefined); + } else { + obj.unbondings = []; + } + return obj; + }, + fromAminoMsg(object: QueryAccountBondsResponseAminoMsg): QueryAccountBondsResponse { + return QueryAccountBondsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAccountBondsResponseProtoMsg): QueryAccountBondsResponse { + return QueryAccountBondsResponse.decode(message.value); + }, + toProto(message: QueryAccountBondsResponse): Uint8Array { + return QueryAccountBondsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountBondsResponse): QueryAccountBondsResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryAccountBondsResponse", + value: QueryAccountBondsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryTotalBonded(): QueryTotalBonded { + return { + denom: "" + }; +} +export const QueryTotalBonded = { + typeUrl: "/umee.incentive.v1.QueryTotalBonded", + encode(message: QueryTotalBonded, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalBonded { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalBonded(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryTotalBonded { + const message = createBaseQueryTotalBonded(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryTotalBondedAmino): QueryTotalBonded { + const message = createBaseQueryTotalBonded(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryTotalBonded): QueryTotalBondedAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryTotalBondedAminoMsg): QueryTotalBonded { + return QueryTotalBonded.fromAmino(object.value); + }, + fromProtoMsg(message: QueryTotalBondedProtoMsg): QueryTotalBonded { + return QueryTotalBonded.decode(message.value); + }, + toProto(message: QueryTotalBonded): Uint8Array { + return QueryTotalBonded.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalBonded): QueryTotalBondedProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryTotalBonded", + value: QueryTotalBonded.encode(message).finish() + }; + } +}; +function createBaseQueryTotalBondedResponse(): QueryTotalBondedResponse { + return { + bonded: [] + }; +} +export const QueryTotalBondedResponse = { + typeUrl: "/umee.incentive.v1.QueryTotalBondedResponse", + encode(message: QueryTotalBondedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.bonded) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalBondedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalBondedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bonded.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryTotalBondedResponse { + const message = createBaseQueryTotalBondedResponse(); + message.bonded = object.bonded?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryTotalBondedResponseAmino): QueryTotalBondedResponse { + const message = createBaseQueryTotalBondedResponse(); + message.bonded = object.bonded?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryTotalBondedResponse): QueryTotalBondedResponseAmino { + const obj: any = {}; + if (message.bonded) { + obj.bonded = message.bonded.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.bonded = []; + } + return obj; + }, + fromAminoMsg(object: QueryTotalBondedResponseAminoMsg): QueryTotalBondedResponse { + return QueryTotalBondedResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryTotalBondedResponseProtoMsg): QueryTotalBondedResponse { + return QueryTotalBondedResponse.decode(message.value); + }, + toProto(message: QueryTotalBondedResponse): Uint8Array { + return QueryTotalBondedResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalBondedResponse): QueryTotalBondedResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryTotalBondedResponse", + value: QueryTotalBondedResponse.encode(message).finish() + }; + } +}; +function createBaseQueryTotalUnbonding(): QueryTotalUnbonding { + return { + denom: "" + }; +} +export const QueryTotalUnbonding = { + typeUrl: "/umee.incentive.v1.QueryTotalUnbonding", + encode(message: QueryTotalUnbonding, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalUnbonding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalUnbonding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryTotalUnbonding { + const message = createBaseQueryTotalUnbonding(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryTotalUnbondingAmino): QueryTotalUnbonding { + const message = createBaseQueryTotalUnbonding(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryTotalUnbonding): QueryTotalUnbondingAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryTotalUnbondingAminoMsg): QueryTotalUnbonding { + return QueryTotalUnbonding.fromAmino(object.value); + }, + fromProtoMsg(message: QueryTotalUnbondingProtoMsg): QueryTotalUnbonding { + return QueryTotalUnbonding.decode(message.value); + }, + toProto(message: QueryTotalUnbonding): Uint8Array { + return QueryTotalUnbonding.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalUnbonding): QueryTotalUnbondingProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryTotalUnbonding", + value: QueryTotalUnbonding.encode(message).finish() + }; + } +}; +function createBaseQueryTotalUnbondingResponse(): QueryTotalUnbondingResponse { + return { + unbonding: [] + }; +} +export const QueryTotalUnbondingResponse = { + typeUrl: "/umee.incentive.v1.QueryTotalUnbondingResponse", + encode(message: QueryTotalUnbondingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.unbonding) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalUnbondingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalUnbondingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbonding.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryTotalUnbondingResponse { + const message = createBaseQueryTotalUnbondingResponse(); + message.unbonding = object.unbonding?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryTotalUnbondingResponseAmino): QueryTotalUnbondingResponse { + const message = createBaseQueryTotalUnbondingResponse(); + message.unbonding = object.unbonding?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryTotalUnbondingResponse): QueryTotalUnbondingResponseAmino { + const obj: any = {}; + if (message.unbonding) { + obj.unbonding = message.unbonding.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.unbonding = []; + } + return obj; + }, + fromAminoMsg(object: QueryTotalUnbondingResponseAminoMsg): QueryTotalUnbondingResponse { + return QueryTotalUnbondingResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryTotalUnbondingResponseProtoMsg): QueryTotalUnbondingResponse { + return QueryTotalUnbondingResponse.decode(message.value); + }, + toProto(message: QueryTotalUnbondingResponse): Uint8Array { + return QueryTotalUnbondingResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalUnbondingResponse): QueryTotalUnbondingResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryTotalUnbondingResponse", + value: QueryTotalUnbondingResponse.encode(message).finish() + }; + } +}; +function createBaseQueryUpcomingIncentivePrograms(): QueryUpcomingIncentivePrograms { + return {}; +} +export const QueryUpcomingIncentivePrograms = { + typeUrl: "/umee.incentive.v1.QueryUpcomingIncentivePrograms", + encode(_: QueryUpcomingIncentivePrograms, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpcomingIncentivePrograms { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpcomingIncentivePrograms(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryUpcomingIncentivePrograms { + const message = createBaseQueryUpcomingIncentivePrograms(); + return message; + }, + fromAmino(_: QueryUpcomingIncentiveProgramsAmino): QueryUpcomingIncentivePrograms { + const message = createBaseQueryUpcomingIncentivePrograms(); + return message; + }, + toAmino(_: QueryUpcomingIncentivePrograms): QueryUpcomingIncentiveProgramsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryUpcomingIncentiveProgramsAminoMsg): QueryUpcomingIncentivePrograms { + return QueryUpcomingIncentivePrograms.fromAmino(object.value); + }, + fromProtoMsg(message: QueryUpcomingIncentiveProgramsProtoMsg): QueryUpcomingIncentivePrograms { + return QueryUpcomingIncentivePrograms.decode(message.value); + }, + toProto(message: QueryUpcomingIncentivePrograms): Uint8Array { + return QueryUpcomingIncentivePrograms.encode(message).finish(); + }, + toProtoMsg(message: QueryUpcomingIncentivePrograms): QueryUpcomingIncentiveProgramsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryUpcomingIncentivePrograms", + value: QueryUpcomingIncentivePrograms.encode(message).finish() + }; + } +}; +function createBaseQueryUpcomingIncentiveProgramsResponse(): QueryUpcomingIncentiveProgramsResponse { + return { + programs: [] + }; +} +export const QueryUpcomingIncentiveProgramsResponse = { + typeUrl: "/umee.incentive.v1.QueryUpcomingIncentiveProgramsResponse", + encode(message: QueryUpcomingIncentiveProgramsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.programs) { + IncentiveProgram.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpcomingIncentiveProgramsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpcomingIncentiveProgramsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.programs.push(IncentiveProgram.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryUpcomingIncentiveProgramsResponse { + const message = createBaseQueryUpcomingIncentiveProgramsResponse(); + message.programs = object.programs?.map(e => IncentiveProgram.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryUpcomingIncentiveProgramsResponseAmino): QueryUpcomingIncentiveProgramsResponse { + const message = createBaseQueryUpcomingIncentiveProgramsResponse(); + message.programs = object.programs?.map(e => IncentiveProgram.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryUpcomingIncentiveProgramsResponse): QueryUpcomingIncentiveProgramsResponseAmino { + const obj: any = {}; + if (message.programs) { + obj.programs = message.programs.map(e => e ? IncentiveProgram.toAmino(e) : undefined); + } else { + obj.programs = []; + } + return obj; + }, + fromAminoMsg(object: QueryUpcomingIncentiveProgramsResponseAminoMsg): QueryUpcomingIncentiveProgramsResponse { + return QueryUpcomingIncentiveProgramsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryUpcomingIncentiveProgramsResponseProtoMsg): QueryUpcomingIncentiveProgramsResponse { + return QueryUpcomingIncentiveProgramsResponse.decode(message.value); + }, + toProto(message: QueryUpcomingIncentiveProgramsResponse): Uint8Array { + return QueryUpcomingIncentiveProgramsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUpcomingIncentiveProgramsResponse): QueryUpcomingIncentiveProgramsResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryUpcomingIncentiveProgramsResponse", + value: QueryUpcomingIncentiveProgramsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryOngoingIncentivePrograms(): QueryOngoingIncentivePrograms { + return {}; +} +export const QueryOngoingIncentivePrograms = { + typeUrl: "/umee.incentive.v1.QueryOngoingIncentivePrograms", + encode(_: QueryOngoingIncentivePrograms, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryOngoingIncentivePrograms { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOngoingIncentivePrograms(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryOngoingIncentivePrograms { + const message = createBaseQueryOngoingIncentivePrograms(); + return message; + }, + fromAmino(_: QueryOngoingIncentiveProgramsAmino): QueryOngoingIncentivePrograms { + const message = createBaseQueryOngoingIncentivePrograms(); + return message; + }, + toAmino(_: QueryOngoingIncentivePrograms): QueryOngoingIncentiveProgramsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryOngoingIncentiveProgramsAminoMsg): QueryOngoingIncentivePrograms { + return QueryOngoingIncentivePrograms.fromAmino(object.value); + }, + fromProtoMsg(message: QueryOngoingIncentiveProgramsProtoMsg): QueryOngoingIncentivePrograms { + return QueryOngoingIncentivePrograms.decode(message.value); + }, + toProto(message: QueryOngoingIncentivePrograms): Uint8Array { + return QueryOngoingIncentivePrograms.encode(message).finish(); + }, + toProtoMsg(message: QueryOngoingIncentivePrograms): QueryOngoingIncentiveProgramsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryOngoingIncentivePrograms", + value: QueryOngoingIncentivePrograms.encode(message).finish() + }; + } +}; +function createBaseQueryOngoingIncentiveProgramsResponse(): QueryOngoingIncentiveProgramsResponse { + return { + programs: [] + }; +} +export const QueryOngoingIncentiveProgramsResponse = { + typeUrl: "/umee.incentive.v1.QueryOngoingIncentiveProgramsResponse", + encode(message: QueryOngoingIncentiveProgramsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.programs) { + IncentiveProgram.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryOngoingIncentiveProgramsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOngoingIncentiveProgramsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.programs.push(IncentiveProgram.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryOngoingIncentiveProgramsResponse { + const message = createBaseQueryOngoingIncentiveProgramsResponse(); + message.programs = object.programs?.map(e => IncentiveProgram.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryOngoingIncentiveProgramsResponseAmino): QueryOngoingIncentiveProgramsResponse { + const message = createBaseQueryOngoingIncentiveProgramsResponse(); + message.programs = object.programs?.map(e => IncentiveProgram.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryOngoingIncentiveProgramsResponse): QueryOngoingIncentiveProgramsResponseAmino { + const obj: any = {}; + if (message.programs) { + obj.programs = message.programs.map(e => e ? IncentiveProgram.toAmino(e) : undefined); + } else { + obj.programs = []; + } + return obj; + }, + fromAminoMsg(object: QueryOngoingIncentiveProgramsResponseAminoMsg): QueryOngoingIncentiveProgramsResponse { + return QueryOngoingIncentiveProgramsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryOngoingIncentiveProgramsResponseProtoMsg): QueryOngoingIncentiveProgramsResponse { + return QueryOngoingIncentiveProgramsResponse.decode(message.value); + }, + toProto(message: QueryOngoingIncentiveProgramsResponse): Uint8Array { + return QueryOngoingIncentiveProgramsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryOngoingIncentiveProgramsResponse): QueryOngoingIncentiveProgramsResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryOngoingIncentiveProgramsResponse", + value: QueryOngoingIncentiveProgramsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryCompletedIncentivePrograms(): QueryCompletedIncentivePrograms { + return {}; +} +export const QueryCompletedIncentivePrograms = { + typeUrl: "/umee.incentive.v1.QueryCompletedIncentivePrograms", + encode(_: QueryCompletedIncentivePrograms, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCompletedIncentivePrograms { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCompletedIncentivePrograms(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryCompletedIncentivePrograms { + const message = createBaseQueryCompletedIncentivePrograms(); + return message; + }, + fromAmino(_: QueryCompletedIncentiveProgramsAmino): QueryCompletedIncentivePrograms { + const message = createBaseQueryCompletedIncentivePrograms(); + return message; + }, + toAmino(_: QueryCompletedIncentivePrograms): QueryCompletedIncentiveProgramsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryCompletedIncentiveProgramsAminoMsg): QueryCompletedIncentivePrograms { + return QueryCompletedIncentivePrograms.fromAmino(object.value); + }, + fromProtoMsg(message: QueryCompletedIncentiveProgramsProtoMsg): QueryCompletedIncentivePrograms { + return QueryCompletedIncentivePrograms.decode(message.value); + }, + toProto(message: QueryCompletedIncentivePrograms): Uint8Array { + return QueryCompletedIncentivePrograms.encode(message).finish(); + }, + toProtoMsg(message: QueryCompletedIncentivePrograms): QueryCompletedIncentiveProgramsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryCompletedIncentivePrograms", + value: QueryCompletedIncentivePrograms.encode(message).finish() + }; + } +}; +function createBaseQueryCompletedIncentiveProgramsResponse(): QueryCompletedIncentiveProgramsResponse { + return { + programs: [] + }; +} +export const QueryCompletedIncentiveProgramsResponse = { + typeUrl: "/umee.incentive.v1.QueryCompletedIncentiveProgramsResponse", + encode(message: QueryCompletedIncentiveProgramsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.programs) { + IncentiveProgram.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCompletedIncentiveProgramsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCompletedIncentiveProgramsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.programs.push(IncentiveProgram.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryCompletedIncentiveProgramsResponse { + const message = createBaseQueryCompletedIncentiveProgramsResponse(); + message.programs = object.programs?.map(e => IncentiveProgram.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryCompletedIncentiveProgramsResponseAmino): QueryCompletedIncentiveProgramsResponse { + const message = createBaseQueryCompletedIncentiveProgramsResponse(); + message.programs = object.programs?.map(e => IncentiveProgram.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryCompletedIncentiveProgramsResponse): QueryCompletedIncentiveProgramsResponseAmino { + const obj: any = {}; + if (message.programs) { + obj.programs = message.programs.map(e => e ? IncentiveProgram.toAmino(e) : undefined); + } else { + obj.programs = []; + } + return obj; + }, + fromAminoMsg(object: QueryCompletedIncentiveProgramsResponseAminoMsg): QueryCompletedIncentiveProgramsResponse { + return QueryCompletedIncentiveProgramsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryCompletedIncentiveProgramsResponseProtoMsg): QueryCompletedIncentiveProgramsResponse { + return QueryCompletedIncentiveProgramsResponse.decode(message.value); + }, + toProto(message: QueryCompletedIncentiveProgramsResponse): Uint8Array { + return QueryCompletedIncentiveProgramsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCompletedIncentiveProgramsResponse): QueryCompletedIncentiveProgramsResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryCompletedIncentiveProgramsResponse", + value: QueryCompletedIncentiveProgramsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryIncentiveProgram(): QueryIncentiveProgram { + return { + id: 0 + }; +} +export const QueryIncentiveProgram = { + typeUrl: "/umee.incentive.v1.QueryIncentiveProgram", + encode(message: QueryIncentiveProgram, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryIncentiveProgram { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryIncentiveProgram(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryIncentiveProgram { + const message = createBaseQueryIncentiveProgram(); + message.id = object.id ?? 0; + return message; + }, + fromAmino(object: QueryIncentiveProgramAmino): QueryIncentiveProgram { + const message = createBaseQueryIncentiveProgram(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + return message; + }, + toAmino(message: QueryIncentiveProgram): QueryIncentiveProgramAmino { + const obj: any = {}; + obj.id = message.id; + return obj; + }, + fromAminoMsg(object: QueryIncentiveProgramAminoMsg): QueryIncentiveProgram { + return QueryIncentiveProgram.fromAmino(object.value); + }, + fromProtoMsg(message: QueryIncentiveProgramProtoMsg): QueryIncentiveProgram { + return QueryIncentiveProgram.decode(message.value); + }, + toProto(message: QueryIncentiveProgram): Uint8Array { + return QueryIncentiveProgram.encode(message).finish(); + }, + toProtoMsg(message: QueryIncentiveProgram): QueryIncentiveProgramProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryIncentiveProgram", + value: QueryIncentiveProgram.encode(message).finish() + }; + } +}; +function createBaseQueryIncentiveProgramResponse(): QueryIncentiveProgramResponse { + return { + program: IncentiveProgram.fromPartial({}) + }; +} +export const QueryIncentiveProgramResponse = { + typeUrl: "/umee.incentive.v1.QueryIncentiveProgramResponse", + encode(message: QueryIncentiveProgramResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.program !== undefined) { + IncentiveProgram.encode(message.program, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryIncentiveProgramResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryIncentiveProgramResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.program = IncentiveProgram.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryIncentiveProgramResponse { + const message = createBaseQueryIncentiveProgramResponse(); + message.program = object.program !== undefined && object.program !== null ? IncentiveProgram.fromPartial(object.program) : undefined; + return message; + }, + fromAmino(object: QueryIncentiveProgramResponseAmino): QueryIncentiveProgramResponse { + const message = createBaseQueryIncentiveProgramResponse(); + if (object.program !== undefined && object.program !== null) { + message.program = IncentiveProgram.fromAmino(object.program); + } + return message; + }, + toAmino(message: QueryIncentiveProgramResponse): QueryIncentiveProgramResponseAmino { + const obj: any = {}; + obj.program = message.program ? IncentiveProgram.toAmino(message.program) : undefined; + return obj; + }, + fromAminoMsg(object: QueryIncentiveProgramResponseAminoMsg): QueryIncentiveProgramResponse { + return QueryIncentiveProgramResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryIncentiveProgramResponseProtoMsg): QueryIncentiveProgramResponse { + return QueryIncentiveProgramResponse.decode(message.value); + }, + toProto(message: QueryIncentiveProgramResponse): Uint8Array { + return QueryIncentiveProgramResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryIncentiveProgramResponse): QueryIncentiveProgramResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryIncentiveProgramResponse", + value: QueryIncentiveProgramResponse.encode(message).finish() + }; + } +}; +function createBaseQueryCurrentRates(): QueryCurrentRates { + return { + uToken: "" + }; +} +export const QueryCurrentRates = { + typeUrl: "/umee.incentive.v1.QueryCurrentRates", + encode(message: QueryCurrentRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.uToken !== "") { + writer.uint32(10).string(message.uToken); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryCurrentRates { + const message = createBaseQueryCurrentRates(); + message.uToken = object.uToken ?? ""; + return message; + }, + fromAmino(object: QueryCurrentRatesAmino): QueryCurrentRates { + const message = createBaseQueryCurrentRates(); + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = object.uToken; + } + return message; + }, + toAmino(message: QueryCurrentRates): QueryCurrentRatesAmino { + const obj: any = {}; + obj.uToken = message.uToken; + return obj; + }, + fromAminoMsg(object: QueryCurrentRatesAminoMsg): QueryCurrentRates { + return QueryCurrentRates.fromAmino(object.value); + }, + fromProtoMsg(message: QueryCurrentRatesProtoMsg): QueryCurrentRates { + return QueryCurrentRates.decode(message.value); + }, + toProto(message: QueryCurrentRates): Uint8Array { + return QueryCurrentRates.encode(message).finish(); + }, + toProtoMsg(message: QueryCurrentRates): QueryCurrentRatesProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryCurrentRates", + value: QueryCurrentRates.encode(message).finish() + }; + } +}; +function createBaseQueryCurrentRatesResponse(): QueryCurrentRatesResponse { + return { + referenceBond: Coin.fromPartial({}), + rewards: [] + }; +} +export const QueryCurrentRatesResponse = { + typeUrl: "/umee.incentive.v1.QueryCurrentRatesResponse", + encode(message: QueryCurrentRatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.referenceBond !== undefined) { + Coin.encode(message.referenceBond, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.rewards) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentRatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentRatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.referenceBond = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.rewards.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryCurrentRatesResponse { + const message = createBaseQueryCurrentRatesResponse(); + message.referenceBond = object.referenceBond !== undefined && object.referenceBond !== null ? Coin.fromPartial(object.referenceBond) : undefined; + message.rewards = object.rewards?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryCurrentRatesResponseAmino): QueryCurrentRatesResponse { + const message = createBaseQueryCurrentRatesResponse(); + if (object.reference_bond !== undefined && object.reference_bond !== null) { + message.referenceBond = Coin.fromAmino(object.reference_bond); + } + message.rewards = object.rewards?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryCurrentRatesResponse): QueryCurrentRatesResponseAmino { + const obj: any = {}; + obj.reference_bond = message.referenceBond ? Coin.toAmino(message.referenceBond) : undefined; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + fromAminoMsg(object: QueryCurrentRatesResponseAminoMsg): QueryCurrentRatesResponse { + return QueryCurrentRatesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryCurrentRatesResponseProtoMsg): QueryCurrentRatesResponse { + return QueryCurrentRatesResponse.decode(message.value); + }, + toProto(message: QueryCurrentRatesResponse): Uint8Array { + return QueryCurrentRatesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCurrentRatesResponse): QueryCurrentRatesResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryCurrentRatesResponse", + value: QueryCurrentRatesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryLastRewardTime(): QueryLastRewardTime { + return {}; +} +export const QueryLastRewardTime = { + typeUrl: "/umee.incentive.v1.QueryLastRewardTime", + encode(_: QueryLastRewardTime, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryLastRewardTime { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLastRewardTime(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryLastRewardTime { + const message = createBaseQueryLastRewardTime(); + return message; + }, + fromAmino(_: QueryLastRewardTimeAmino): QueryLastRewardTime { + const message = createBaseQueryLastRewardTime(); + return message; + }, + toAmino(_: QueryLastRewardTime): QueryLastRewardTimeAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryLastRewardTimeAminoMsg): QueryLastRewardTime { + return QueryLastRewardTime.fromAmino(object.value); + }, + fromProtoMsg(message: QueryLastRewardTimeProtoMsg): QueryLastRewardTime { + return QueryLastRewardTime.decode(message.value); + }, + toProto(message: QueryLastRewardTime): Uint8Array { + return QueryLastRewardTime.encode(message).finish(); + }, + toProtoMsg(message: QueryLastRewardTime): QueryLastRewardTimeProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryLastRewardTime", + value: QueryLastRewardTime.encode(message).finish() + }; + } +}; +function createBaseQueryLastRewardTimeResponse(): QueryLastRewardTimeResponse { + return { + time: BigInt(0) + }; +} +export const QueryLastRewardTimeResponse = { + typeUrl: "/umee.incentive.v1.QueryLastRewardTimeResponse", + encode(message: QueryLastRewardTimeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.time !== BigInt(0)) { + writer.uint32(8).int64(message.time); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryLastRewardTimeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLastRewardTimeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.time = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryLastRewardTimeResponse { + const message = createBaseQueryLastRewardTimeResponse(); + message.time = object.time !== undefined && object.time !== null ? BigInt(object.time.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryLastRewardTimeResponseAmino): QueryLastRewardTimeResponse { + const message = createBaseQueryLastRewardTimeResponse(); + if (object.time !== undefined && object.time !== null) { + message.time = BigInt(object.time); + } + return message; + }, + toAmino(message: QueryLastRewardTimeResponse): QueryLastRewardTimeResponseAmino { + const obj: any = {}; + obj.time = message.time ? message.time.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryLastRewardTimeResponseAminoMsg): QueryLastRewardTimeResponse { + return QueryLastRewardTimeResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryLastRewardTimeResponseProtoMsg): QueryLastRewardTimeResponse { + return QueryLastRewardTimeResponse.decode(message.value); + }, + toProto(message: QueryLastRewardTimeResponse): Uint8Array { + return QueryLastRewardTimeResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryLastRewardTimeResponse): QueryLastRewardTimeResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryLastRewardTimeResponse", + value: QueryLastRewardTimeResponse.encode(message).finish() + }; + } +}; +function createBaseQueryActualRates(): QueryActualRates { + return { + uToken: "" + }; +} +export const QueryActualRates = { + typeUrl: "/umee.incentive.v1.QueryActualRates", + encode(message: QueryActualRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.uToken !== "") { + writer.uint32(10).string(message.uToken); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryActualRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryActualRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryActualRates { + const message = createBaseQueryActualRates(); + message.uToken = object.uToken ?? ""; + return message; + }, + fromAmino(object: QueryActualRatesAmino): QueryActualRates { + const message = createBaseQueryActualRates(); + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = object.uToken; + } + return message; + }, + toAmino(message: QueryActualRates): QueryActualRatesAmino { + const obj: any = {}; + obj.uToken = message.uToken; + return obj; + }, + fromAminoMsg(object: QueryActualRatesAminoMsg): QueryActualRates { + return QueryActualRates.fromAmino(object.value); + }, + fromProtoMsg(message: QueryActualRatesProtoMsg): QueryActualRates { + return QueryActualRates.decode(message.value); + }, + toProto(message: QueryActualRates): Uint8Array { + return QueryActualRates.encode(message).finish(); + }, + toProtoMsg(message: QueryActualRates): QueryActualRatesProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryActualRates", + value: QueryActualRates.encode(message).finish() + }; + } +}; +function createBaseQueryActualRatesResponse(): QueryActualRatesResponse { + return { + APY: "" + }; +} +export const QueryActualRatesResponse = { + typeUrl: "/umee.incentive.v1.QueryActualRatesResponse", + encode(message: QueryActualRatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.APY !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.APY, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryActualRatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryActualRatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.APY = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryActualRatesResponse { + const message = createBaseQueryActualRatesResponse(); + message.APY = object.APY ?? ""; + return message; + }, + fromAmino(object: QueryActualRatesResponseAmino): QueryActualRatesResponse { + const message = createBaseQueryActualRatesResponse(); + if (object.APY !== undefined && object.APY !== null) { + message.APY = object.APY; + } + return message; + }, + toAmino(message: QueryActualRatesResponse): QueryActualRatesResponseAmino { + const obj: any = {}; + obj.APY = message.APY; + return obj; + }, + fromAminoMsg(object: QueryActualRatesResponseAminoMsg): QueryActualRatesResponse { + return QueryActualRatesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryActualRatesResponseProtoMsg): QueryActualRatesResponse { + return QueryActualRatesResponse.decode(message.value); + }, + toProto(message: QueryActualRatesResponse): Uint8Array { + return QueryActualRatesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryActualRatesResponse): QueryActualRatesResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.QueryActualRatesResponse", + value: QueryActualRatesResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/incentive/v1/tx.amino.ts b/src/codegen/umee/incentive/v1/tx.amino.ts new file mode 100644 index 0000000..e06eb59 --- /dev/null +++ b/src/codegen/umee/incentive/v1/tx.amino.ts @@ -0,0 +1,38 @@ +import { MsgClaim, MsgBond, MsgBeginUnbonding, MsgEmergencyUnbond, MsgSponsor, MsgGovSetParams, MsgGovCreatePrograms } from "./tx"; +export const AminoConverter = { + "/umee.incentive.v1.MsgClaim": { + aminoType: "/umee.incentive.v1.MsgClaim", + toAmino: MsgClaim.toAmino, + fromAmino: MsgClaim.fromAmino + }, + "/umee.incentive.v1.MsgBond": { + aminoType: "/umee.incentive.v1.MsgBond", + toAmino: MsgBond.toAmino, + fromAmino: MsgBond.fromAmino + }, + "/umee.incentive.v1.MsgBeginUnbonding": { + aminoType: "/umee.incentive.v1.MsgBeginUnbonding", + toAmino: MsgBeginUnbonding.toAmino, + fromAmino: MsgBeginUnbonding.fromAmino + }, + "/umee.incentive.v1.MsgEmergencyUnbond": { + aminoType: "/umee.incentive.v1.MsgEmergencyUnbond", + toAmino: MsgEmergencyUnbond.toAmino, + fromAmino: MsgEmergencyUnbond.fromAmino + }, + "/umee.incentive.v1.MsgSponsor": { + aminoType: "/umee.incentive.v1.MsgSponsor", + toAmino: MsgSponsor.toAmino, + fromAmino: MsgSponsor.fromAmino + }, + "/umee.incentive.v1.MsgGovSetParams": { + aminoType: "/umee.incentive.v1.MsgGovSetParams", + toAmino: MsgGovSetParams.toAmino, + fromAmino: MsgGovSetParams.fromAmino + }, + "/umee.incentive.v1.MsgGovCreatePrograms": { + aminoType: "/umee.incentive.v1.MsgGovCreatePrograms", + toAmino: MsgGovCreatePrograms.toAmino, + fromAmino: MsgGovCreatePrograms.fromAmino + } +}; \ No newline at end of file diff --git a/src/codegen/umee/incentive/v1/tx.registry.ts b/src/codegen/umee/incentive/v1/tx.registry.ts new file mode 100644 index 0000000..b9ab80a --- /dev/null +++ b/src/codegen/umee/incentive/v1/tx.registry.ts @@ -0,0 +1,142 @@ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgClaim, MsgBond, MsgBeginUnbonding, MsgEmergencyUnbond, MsgSponsor, MsgGovSetParams, MsgGovCreatePrograms } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/umee.incentive.v1.MsgClaim", MsgClaim], ["/umee.incentive.v1.MsgBond", MsgBond], ["/umee.incentive.v1.MsgBeginUnbonding", MsgBeginUnbonding], ["/umee.incentive.v1.MsgEmergencyUnbond", MsgEmergencyUnbond], ["/umee.incentive.v1.MsgSponsor", MsgSponsor], ["/umee.incentive.v1.MsgGovSetParams", MsgGovSetParams], ["/umee.incentive.v1.MsgGovCreatePrograms", MsgGovCreatePrograms]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + claim(value: MsgClaim) { + return { + typeUrl: "/umee.incentive.v1.MsgClaim", + value: MsgClaim.encode(value).finish() + }; + }, + bond(value: MsgBond) { + return { + typeUrl: "/umee.incentive.v1.MsgBond", + value: MsgBond.encode(value).finish() + }; + }, + beginUnbonding(value: MsgBeginUnbonding) { + return { + typeUrl: "/umee.incentive.v1.MsgBeginUnbonding", + value: MsgBeginUnbonding.encode(value).finish() + }; + }, + emergencyUnbond(value: MsgEmergencyUnbond) { + return { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbond", + value: MsgEmergencyUnbond.encode(value).finish() + }; + }, + sponsor(value: MsgSponsor) { + return { + typeUrl: "/umee.incentive.v1.MsgSponsor", + value: MsgSponsor.encode(value).finish() + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.incentive.v1.MsgGovSetParams", + value: MsgGovSetParams.encode(value).finish() + }; + }, + govCreatePrograms(value: MsgGovCreatePrograms) { + return { + typeUrl: "/umee.incentive.v1.MsgGovCreatePrograms", + value: MsgGovCreatePrograms.encode(value).finish() + }; + } + }, + withTypeUrl: { + claim(value: MsgClaim) { + return { + typeUrl: "/umee.incentive.v1.MsgClaim", + value + }; + }, + bond(value: MsgBond) { + return { + typeUrl: "/umee.incentive.v1.MsgBond", + value + }; + }, + beginUnbonding(value: MsgBeginUnbonding) { + return { + typeUrl: "/umee.incentive.v1.MsgBeginUnbonding", + value + }; + }, + emergencyUnbond(value: MsgEmergencyUnbond) { + return { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbond", + value + }; + }, + sponsor(value: MsgSponsor) { + return { + typeUrl: "/umee.incentive.v1.MsgSponsor", + value + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.incentive.v1.MsgGovSetParams", + value + }; + }, + govCreatePrograms(value: MsgGovCreatePrograms) { + return { + typeUrl: "/umee.incentive.v1.MsgGovCreatePrograms", + value + }; + } + }, + fromPartial: { + claim(value: MsgClaim) { + return { + typeUrl: "/umee.incentive.v1.MsgClaim", + value: MsgClaim.fromPartial(value) + }; + }, + bond(value: MsgBond) { + return { + typeUrl: "/umee.incentive.v1.MsgBond", + value: MsgBond.fromPartial(value) + }; + }, + beginUnbonding(value: MsgBeginUnbonding) { + return { + typeUrl: "/umee.incentive.v1.MsgBeginUnbonding", + value: MsgBeginUnbonding.fromPartial(value) + }; + }, + emergencyUnbond(value: MsgEmergencyUnbond) { + return { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbond", + value: MsgEmergencyUnbond.fromPartial(value) + }; + }, + sponsor(value: MsgSponsor) { + return { + typeUrl: "/umee.incentive.v1.MsgSponsor", + value: MsgSponsor.fromPartial(value) + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.incentive.v1.MsgGovSetParams", + value: MsgGovSetParams.fromPartial(value) + }; + }, + govCreatePrograms(value: MsgGovCreatePrograms) { + return { + typeUrl: "/umee.incentive.v1.MsgGovCreatePrograms", + value: MsgGovCreatePrograms.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/src/codegen/umee/incentive/v1/tx.rpc.msg.ts b/src/codegen/umee/incentive/v1/tx.rpc.msg.ts new file mode 100644 index 0000000..9f893d7 --- /dev/null +++ b/src/codegen/umee/incentive/v1/tx.rpc.msg.ts @@ -0,0 +1,77 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgClaim, MsgClaimResponse, MsgBond, MsgBondResponse, MsgBeginUnbonding, MsgBeginUnbondingResponse, MsgEmergencyUnbond, MsgEmergencyUnbondResponse, MsgSponsor, MsgSponsorResponse, MsgGovSetParams, MsgGovSetParamsResponse, MsgGovCreatePrograms, MsgGovCreateProgramsResponse } from "./tx"; +/** Msg defines the x/incentive module's Msg service. */ +export interface Msg { + /** Claim defines a method for claiming any pending incentive rewards. */ + claim(request: MsgClaim): Promise; + /** Bond defines a method for bonding uToken collateral. */ + bond(request: MsgBond): Promise; + /** + * BeginUnbonding defines a method for starting to unbond uToken collateral. + * Only max_unbondings unbondings can be active at per user, per denom, at once. + */ + beginUnbonding(request: MsgBeginUnbonding): Promise; + /** + * EmergencyUnbond defines a method for instantly unbonding uToken collateral in exchange for a fee. + * This can finish existing unbondings or unbond bonded tokens, and is not restricted by max_unbondings. + */ + emergencyUnbond(request: MsgEmergencyUnbond): Promise; + /** + * Sponsor defines a permissionless method for sponsoring an upcoming, not yet funded incentive program. + * The sponsor must be a single account and the MsgSponsor must fully cover the expected program rewards. + */ + sponsor(request: MsgSponsor): Promise; + /** GovSetParams is used by governance proposals to update parameters. */ + govSetParams(request: MsgGovSetParams): Promise; + /** GovCreatePrograms is used by governance proposals to create and optionally fund incentive programs. */ + govCreatePrograms(request: MsgGovCreatePrograms): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.claim = this.claim.bind(this); + this.bond = this.bond.bind(this); + this.beginUnbonding = this.beginUnbonding.bind(this); + this.emergencyUnbond = this.emergencyUnbond.bind(this); + this.sponsor = this.sponsor.bind(this); + this.govSetParams = this.govSetParams.bind(this); + this.govCreatePrograms = this.govCreatePrograms.bind(this); + } + claim(request: MsgClaim): Promise { + const data = MsgClaim.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Msg", "Claim", data); + return promise.then(data => MsgClaimResponse.decode(new BinaryReader(data))); + } + bond(request: MsgBond): Promise { + const data = MsgBond.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Msg", "Bond", data); + return promise.then(data => MsgBondResponse.decode(new BinaryReader(data))); + } + beginUnbonding(request: MsgBeginUnbonding): Promise { + const data = MsgBeginUnbonding.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Msg", "BeginUnbonding", data); + return promise.then(data => MsgBeginUnbondingResponse.decode(new BinaryReader(data))); + } + emergencyUnbond(request: MsgEmergencyUnbond): Promise { + const data = MsgEmergencyUnbond.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Msg", "EmergencyUnbond", data); + return promise.then(data => MsgEmergencyUnbondResponse.decode(new BinaryReader(data))); + } + sponsor(request: MsgSponsor): Promise { + const data = MsgSponsor.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Msg", "Sponsor", data); + return promise.then(data => MsgSponsorResponse.decode(new BinaryReader(data))); + } + govSetParams(request: MsgGovSetParams): Promise { + const data = MsgGovSetParams.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Msg", "GovSetParams", data); + return promise.then(data => MsgGovSetParamsResponse.decode(new BinaryReader(data))); + } + govCreatePrograms(request: MsgGovCreatePrograms): Promise { + const data = MsgGovCreatePrograms.encode(request).finish(); + const promise = this.rpc.request("umee.incentive.v1.Msg", "GovCreatePrograms", data); + return promise.then(data => MsgGovCreateProgramsResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/src/codegen/umee/incentive/v1/tx.ts b/src/codegen/umee/incentive/v1/tx.ts new file mode 100644 index 0000000..80f3c7d --- /dev/null +++ b/src/codegen/umee/incentive/v1/tx.ts @@ -0,0 +1,1207 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsAmino, ParamsSDKType, IncentiveProgram, IncentiveProgramAmino, IncentiveProgramSDKType } from "./incentive"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** MsgClaim represents a account's request to claim pending rewards. */ +export interface MsgClaim { + account: string; +} +export interface MsgClaimProtoMsg { + typeUrl: "/umee.incentive.v1.MsgClaim"; + value: Uint8Array; +} +/** MsgClaim represents a account's request to claim pending rewards. */ +export interface MsgClaimAmino { + account?: string; +} +export interface MsgClaimAminoMsg { + type: "/umee.incentive.v1.MsgClaim"; + value: MsgClaimAmino; +} +/** MsgClaim represents a account's request to claim pending rewards. */ +export interface MsgClaimSDKType { + account: string; +} +/** MsgClaimResponse defines the Msg/Claim response type. */ +export interface MsgClaimResponse { + amount: Coin[]; +} +export interface MsgClaimResponseProtoMsg { + typeUrl: "/umee.incentive.v1.MsgClaimResponse"; + value: Uint8Array; +} +/** MsgClaimResponse defines the Msg/Claim response type. */ +export interface MsgClaimResponseAmino { + amount?: CoinAmino[]; +} +export interface MsgClaimResponseAminoMsg { + type: "/umee.incentive.v1.MsgClaimResponse"; + value: MsgClaimResponseAmino; +} +/** MsgClaimResponse defines the Msg/Claim response type. */ +export interface MsgClaimResponseSDKType { + amount: CoinSDKType[]; +} +/** MsgBond represents a account's request to bond uToken collateral. */ +export interface MsgBond { + account: string; + uToken: Coin; +} +export interface MsgBondProtoMsg { + typeUrl: "/umee.incentive.v1.MsgBond"; + value: Uint8Array; +} +/** MsgBond represents a account's request to bond uToken collateral. */ +export interface MsgBondAmino { + account?: string; + uToken?: CoinAmino; +} +export interface MsgBondAminoMsg { + type: "/umee.incentive.v1.MsgBond"; + value: MsgBondAmino; +} +/** MsgBond represents a account's request to bond uToken collateral. */ +export interface MsgBondSDKType { + account: string; + uToken: CoinSDKType; +} +/** MsgBondResponse defines the Msg/Lock response type. */ +export interface MsgBondResponse {} +export interface MsgBondResponseProtoMsg { + typeUrl: "/umee.incentive.v1.MsgBondResponse"; + value: Uint8Array; +} +/** MsgBondResponse defines the Msg/Lock response type. */ +export interface MsgBondResponseAmino {} +export interface MsgBondResponseAminoMsg { + type: "/umee.incentive.v1.MsgBondResponse"; + value: MsgBondResponseAmino; +} +/** MsgBondResponse defines the Msg/Lock response type. */ +export interface MsgBondResponseSDKType {} +/** MsgBeginUnbonding represents a account's request to begin unbonding uToken collateral. */ +export interface MsgBeginUnbonding { + account: string; + uToken: Coin; +} +export interface MsgBeginUnbondingProtoMsg { + typeUrl: "/umee.incentive.v1.MsgBeginUnbonding"; + value: Uint8Array; +} +/** MsgBeginUnbonding represents a account's request to begin unbonding uToken collateral. */ +export interface MsgBeginUnbondingAmino { + account?: string; + uToken?: CoinAmino; +} +export interface MsgBeginUnbondingAminoMsg { + type: "/umee.incentive.v1.MsgBeginUnbonding"; + value: MsgBeginUnbondingAmino; +} +/** MsgBeginUnbonding represents a account's request to begin unbonding uToken collateral. */ +export interface MsgBeginUnbondingSDKType { + account: string; + uToken: CoinSDKType; +} +/** MsgBeginUnbondingResponse defines the Msg/BeginUnbonding response type. */ +export interface MsgBeginUnbondingResponse {} +export interface MsgBeginUnbondingResponseProtoMsg { + typeUrl: "/umee.incentive.v1.MsgBeginUnbondingResponse"; + value: Uint8Array; +} +/** MsgBeginUnbondingResponse defines the Msg/BeginUnbonding response type. */ +export interface MsgBeginUnbondingResponseAmino {} +export interface MsgBeginUnbondingResponseAminoMsg { + type: "/umee.incentive.v1.MsgBeginUnbondingResponse"; + value: MsgBeginUnbondingResponseAmino; +} +/** MsgBeginUnbondingResponse defines the Msg/BeginUnbonding response type. */ +export interface MsgBeginUnbondingResponseSDKType {} +/** MsgEmergencyUnbond represents a account's request to instantly unbond uToken collateral for a fee. */ +export interface MsgEmergencyUnbond { + account: string; + uToken: Coin; +} +export interface MsgEmergencyUnbondProtoMsg { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbond"; + value: Uint8Array; +} +/** MsgEmergencyUnbond represents a account's request to instantly unbond uToken collateral for a fee. */ +export interface MsgEmergencyUnbondAmino { + account?: string; + uToken?: CoinAmino; +} +export interface MsgEmergencyUnbondAminoMsg { + type: "/umee.incentive.v1.MsgEmergencyUnbond"; + value: MsgEmergencyUnbondAmino; +} +/** MsgEmergencyUnbond represents a account's request to instantly unbond uToken collateral for a fee. */ +export interface MsgEmergencyUnbondSDKType { + account: string; + uToken: CoinSDKType; +} +/** MsgEmergencyUnbondResponse defines the Msg/EmergencyUnbond response type. */ +export interface MsgEmergencyUnbondResponse {} +export interface MsgEmergencyUnbondResponseProtoMsg { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbondResponse"; + value: Uint8Array; +} +/** MsgEmergencyUnbondResponse defines the Msg/EmergencyUnbond response type. */ +export interface MsgEmergencyUnbondResponseAmino {} +export interface MsgEmergencyUnbondResponseAminoMsg { + type: "/umee.incentive.v1.MsgEmergencyUnbondResponse"; + value: MsgEmergencyUnbondResponseAmino; +} +/** MsgEmergencyUnbondResponse defines the Msg/EmergencyUnbond response type. */ +export interface MsgEmergencyUnbondResponseSDKType {} +/** + * MsgSponsor represents a sponsor's request to fund rewards for an incentive program. + * The program must have been passed by governance, not yet started, and not yet funded. + * Funded assets must be the full amount required by the program. + */ +export interface MsgSponsor { + /** Sponsor bech32 account address */ + sponsor: string; + program: number; +} +export interface MsgSponsorProtoMsg { + typeUrl: "/umee.incentive.v1.MsgSponsor"; + value: Uint8Array; +} +/** + * MsgSponsor represents a sponsor's request to fund rewards for an incentive program. + * The program must have been passed by governance, not yet started, and not yet funded. + * Funded assets must be the full amount required by the program. + */ +export interface MsgSponsorAmino { + /** Sponsor bech32 account address */ + sponsor?: string; + program?: number; +} +export interface MsgSponsorAminoMsg { + type: "/umee.incentive.v1.MsgSponsor"; + value: MsgSponsorAmino; +} +/** + * MsgSponsor represents a sponsor's request to fund rewards for an incentive program. + * The program must have been passed by governance, not yet started, and not yet funded. + * Funded assets must be the full amount required by the program. + */ +export interface MsgSponsorSDKType { + sponsor: string; + program: number; +} +/** MsgSponsorResponse defines the Msg/Sponsor response type. */ +export interface MsgSponsorResponse {} +export interface MsgSponsorResponseProtoMsg { + typeUrl: "/umee.incentive.v1.MsgSponsorResponse"; + value: Uint8Array; +} +/** MsgSponsorResponse defines the Msg/Sponsor response type. */ +export interface MsgSponsorResponseAmino {} +export interface MsgSponsorResponseAminoMsg { + type: "/umee.incentive.v1.MsgSponsorResponse"; + value: MsgSponsorResponseAmino; +} +/** MsgSponsorResponse defines the Msg/Sponsor response type. */ +export interface MsgSponsorResponseSDKType {} +/** MsgGovSetParams is used by governance to update module parameters. */ +export interface MsgGovSetParams { + /** authority must be the address of the governance account. */ + authority: string; + params: Params; +} +export interface MsgGovSetParamsProtoMsg { + typeUrl: "/umee.incentive.v1.MsgGovSetParams"; + value: Uint8Array; +} +/** MsgGovSetParams is used by governance to update module parameters. */ +export interface MsgGovSetParamsAmino { + /** authority must be the address of the governance account. */ + authority?: string; + params?: ParamsAmino; +} +export interface MsgGovSetParamsAminoMsg { + type: "/umee.incentive.v1.MsgGovSetParams"; + value: MsgGovSetParamsAmino; +} +/** MsgGovSetParams is used by governance to update module parameters. */ +export interface MsgGovSetParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** MsgGovSetParamsResponse defines the Msg/SetParams response type. */ +export interface MsgGovSetParamsResponse {} +export interface MsgGovSetParamsResponseProtoMsg { + typeUrl: "/umee.incentive.v1.MsgGovSetParamsResponse"; + value: Uint8Array; +} +/** MsgGovSetParamsResponse defines the Msg/SetParams response type. */ +export interface MsgGovSetParamsResponseAmino {} +export interface MsgGovSetParamsResponseAminoMsg { + type: "/umee.incentive.v1.MsgGovSetParamsResponse"; + value: MsgGovSetParamsResponseAmino; +} +/** MsgGovSetParamsResponse defines the Msg/SetParams response type. */ +export interface MsgGovSetParamsResponseSDKType {} +/** + * MsgGovCreatePrograms is used by governance to create one or more incentive programs. + * There are two funding scenarios, depending on from_community_fund. + * If it is true,the programs' total rewards will be automatically withdrawn from + * the (parameter) community_fund_address to the incentive module account when this + * message is passed. (Insufficient funds cause the parameter to be treated as false.) + * If it is false, a MsgSponsor funding each program's full amount must be submitted + * after this message passes, but before the program's start_time, or the program + * will be cancelled when it would otherwise start. + */ +export interface MsgGovCreatePrograms { + /** authority must be the address of the governance account. */ + authority: string; + programs: IncentiveProgram[]; + /** from_community_fund defines the source of funds for proposed incentive programs. */ + fromCommunityFund: boolean; +} +export interface MsgGovCreateProgramsProtoMsg { + typeUrl: "/umee.incentive.v1.MsgGovCreatePrograms"; + value: Uint8Array; +} +/** + * MsgGovCreatePrograms is used by governance to create one or more incentive programs. + * There are two funding scenarios, depending on from_community_fund. + * If it is true,the programs' total rewards will be automatically withdrawn from + * the (parameter) community_fund_address to the incentive module account when this + * message is passed. (Insufficient funds cause the parameter to be treated as false.) + * If it is false, a MsgSponsor funding each program's full amount must be submitted + * after this message passes, but before the program's start_time, or the program + * will be cancelled when it would otherwise start. + */ +export interface MsgGovCreateProgramsAmino { + /** authority must be the address of the governance account. */ + authority?: string; + programs?: IncentiveProgramAmino[]; + /** from_community_fund defines the source of funds for proposed incentive programs. */ + from_community_fund?: boolean; +} +export interface MsgGovCreateProgramsAminoMsg { + type: "/umee.incentive.v1.MsgGovCreatePrograms"; + value: MsgGovCreateProgramsAmino; +} +/** + * MsgGovCreatePrograms is used by governance to create one or more incentive programs. + * There are two funding scenarios, depending on from_community_fund. + * If it is true,the programs' total rewards will be automatically withdrawn from + * the (parameter) community_fund_address to the incentive module account when this + * message is passed. (Insufficient funds cause the parameter to be treated as false.) + * If it is false, a MsgSponsor funding each program's full amount must be submitted + * after this message passes, but before the program's start_time, or the program + * will be cancelled when it would otherwise start. + */ +export interface MsgGovCreateProgramsSDKType { + authority: string; + programs: IncentiveProgramSDKType[]; + from_community_fund: boolean; +} +/** MsgGovCreateProgramsResponse defines the Msg/CreatePrograms response type. */ +export interface MsgGovCreateProgramsResponse {} +export interface MsgGovCreateProgramsResponseProtoMsg { + typeUrl: "/umee.incentive.v1.MsgGovCreateProgramsResponse"; + value: Uint8Array; +} +/** MsgGovCreateProgramsResponse defines the Msg/CreatePrograms response type. */ +export interface MsgGovCreateProgramsResponseAmino {} +export interface MsgGovCreateProgramsResponseAminoMsg { + type: "/umee.incentive.v1.MsgGovCreateProgramsResponse"; + value: MsgGovCreateProgramsResponseAmino; +} +/** MsgGovCreateProgramsResponse defines the Msg/CreatePrograms response type. */ +export interface MsgGovCreateProgramsResponseSDKType {} +function createBaseMsgClaim(): MsgClaim { + return { + account: "" + }; +} +export const MsgClaim = { + typeUrl: "/umee.incentive.v1.MsgClaim", + encode(message: MsgClaim, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgClaim { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClaim(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgClaim { + const message = createBaseMsgClaim(); + message.account = object.account ?? ""; + return message; + }, + fromAmino(object: MsgClaimAmino): MsgClaim { + const message = createBaseMsgClaim(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + return message; + }, + toAmino(message: MsgClaim): MsgClaimAmino { + const obj: any = {}; + obj.account = message.account; + return obj; + }, + fromAminoMsg(object: MsgClaimAminoMsg): MsgClaim { + return MsgClaim.fromAmino(object.value); + }, + fromProtoMsg(message: MsgClaimProtoMsg): MsgClaim { + return MsgClaim.decode(message.value); + }, + toProto(message: MsgClaim): Uint8Array { + return MsgClaim.encode(message).finish(); + }, + toProtoMsg(message: MsgClaim): MsgClaimProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgClaim", + value: MsgClaim.encode(message).finish() + }; + } +}; +function createBaseMsgClaimResponse(): MsgClaimResponse { + return { + amount: [] + }; +} +export const MsgClaimResponse = { + typeUrl: "/umee.incentive.v1.MsgClaimResponse", + encode(message: MsgClaimResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgClaimResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClaimResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgClaimResponse { + const message = createBaseMsgClaimResponse(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgClaimResponseAmino): MsgClaimResponse { + const message = createBaseMsgClaimResponse(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgClaimResponse): MsgClaimResponseAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgClaimResponseAminoMsg): MsgClaimResponse { + return MsgClaimResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgClaimResponseProtoMsg): MsgClaimResponse { + return MsgClaimResponse.decode(message.value); + }, + toProto(message: MsgClaimResponse): Uint8Array { + return MsgClaimResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgClaimResponse): MsgClaimResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgClaimResponse", + value: MsgClaimResponse.encode(message).finish() + }; + } +}; +function createBaseMsgBond(): MsgBond { + return { + account: "", + uToken: Coin.fromPartial({}) + }; +} +export const MsgBond = { + typeUrl: "/umee.incentive.v1.MsgBond", + encode(message: MsgBond, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.uToken !== undefined) { + Coin.encode(message.uToken, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgBond { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.uToken = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgBond { + const message = createBaseMsgBond(); + message.account = object.account ?? ""; + message.uToken = object.uToken !== undefined && object.uToken !== null ? Coin.fromPartial(object.uToken) : undefined; + return message; + }, + fromAmino(object: MsgBondAmino): MsgBond { + const message = createBaseMsgBond(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = Coin.fromAmino(object.uToken); + } + return message; + }, + toAmino(message: MsgBond): MsgBondAmino { + const obj: any = {}; + obj.account = message.account; + obj.uToken = message.uToken ? Coin.toAmino(message.uToken) : undefined; + return obj; + }, + fromAminoMsg(object: MsgBondAminoMsg): MsgBond { + return MsgBond.fromAmino(object.value); + }, + fromProtoMsg(message: MsgBondProtoMsg): MsgBond { + return MsgBond.decode(message.value); + }, + toProto(message: MsgBond): Uint8Array { + return MsgBond.encode(message).finish(); + }, + toProtoMsg(message: MsgBond): MsgBondProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgBond", + value: MsgBond.encode(message).finish() + }; + } +}; +function createBaseMsgBondResponse(): MsgBondResponse { + return {}; +} +export const MsgBondResponse = { + typeUrl: "/umee.incentive.v1.MsgBondResponse", + encode(_: MsgBondResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgBondResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgBondResponse { + const message = createBaseMsgBondResponse(); + return message; + }, + fromAmino(_: MsgBondResponseAmino): MsgBondResponse { + const message = createBaseMsgBondResponse(); + return message; + }, + toAmino(_: MsgBondResponse): MsgBondResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgBondResponseAminoMsg): MsgBondResponse { + return MsgBondResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgBondResponseProtoMsg): MsgBondResponse { + return MsgBondResponse.decode(message.value); + }, + toProto(message: MsgBondResponse): Uint8Array { + return MsgBondResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgBondResponse): MsgBondResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgBondResponse", + value: MsgBondResponse.encode(message).finish() + }; + } +}; +function createBaseMsgBeginUnbonding(): MsgBeginUnbonding { + return { + account: "", + uToken: Coin.fromPartial({}) + }; +} +export const MsgBeginUnbonding = { + typeUrl: "/umee.incentive.v1.MsgBeginUnbonding", + encode(message: MsgBeginUnbonding, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.uToken !== undefined) { + Coin.encode(message.uToken, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginUnbonding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginUnbonding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.uToken = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgBeginUnbonding { + const message = createBaseMsgBeginUnbonding(); + message.account = object.account ?? ""; + message.uToken = object.uToken !== undefined && object.uToken !== null ? Coin.fromPartial(object.uToken) : undefined; + return message; + }, + fromAmino(object: MsgBeginUnbondingAmino): MsgBeginUnbonding { + const message = createBaseMsgBeginUnbonding(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = Coin.fromAmino(object.uToken); + } + return message; + }, + toAmino(message: MsgBeginUnbonding): MsgBeginUnbondingAmino { + const obj: any = {}; + obj.account = message.account; + obj.uToken = message.uToken ? Coin.toAmino(message.uToken) : undefined; + return obj; + }, + fromAminoMsg(object: MsgBeginUnbondingAminoMsg): MsgBeginUnbonding { + return MsgBeginUnbonding.fromAmino(object.value); + }, + fromProtoMsg(message: MsgBeginUnbondingProtoMsg): MsgBeginUnbonding { + return MsgBeginUnbonding.decode(message.value); + }, + toProto(message: MsgBeginUnbonding): Uint8Array { + return MsgBeginUnbonding.encode(message).finish(); + }, + toProtoMsg(message: MsgBeginUnbonding): MsgBeginUnbondingProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgBeginUnbonding", + value: MsgBeginUnbonding.encode(message).finish() + }; + } +}; +function createBaseMsgBeginUnbondingResponse(): MsgBeginUnbondingResponse { + return {}; +} +export const MsgBeginUnbondingResponse = { + typeUrl: "/umee.incentive.v1.MsgBeginUnbondingResponse", + encode(_: MsgBeginUnbondingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginUnbondingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginUnbondingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgBeginUnbondingResponse { + const message = createBaseMsgBeginUnbondingResponse(); + return message; + }, + fromAmino(_: MsgBeginUnbondingResponseAmino): MsgBeginUnbondingResponse { + const message = createBaseMsgBeginUnbondingResponse(); + return message; + }, + toAmino(_: MsgBeginUnbondingResponse): MsgBeginUnbondingResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgBeginUnbondingResponseAminoMsg): MsgBeginUnbondingResponse { + return MsgBeginUnbondingResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgBeginUnbondingResponseProtoMsg): MsgBeginUnbondingResponse { + return MsgBeginUnbondingResponse.decode(message.value); + }, + toProto(message: MsgBeginUnbondingResponse): Uint8Array { + return MsgBeginUnbondingResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgBeginUnbondingResponse): MsgBeginUnbondingResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgBeginUnbondingResponse", + value: MsgBeginUnbondingResponse.encode(message).finish() + }; + } +}; +function createBaseMsgEmergencyUnbond(): MsgEmergencyUnbond { + return { + account: "", + uToken: Coin.fromPartial({}) + }; +} +export const MsgEmergencyUnbond = { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbond", + encode(message: MsgEmergencyUnbond, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.uToken !== undefined) { + Coin.encode(message.uToken, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgEmergencyUnbond { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEmergencyUnbond(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.uToken = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgEmergencyUnbond { + const message = createBaseMsgEmergencyUnbond(); + message.account = object.account ?? ""; + message.uToken = object.uToken !== undefined && object.uToken !== null ? Coin.fromPartial(object.uToken) : undefined; + return message; + }, + fromAmino(object: MsgEmergencyUnbondAmino): MsgEmergencyUnbond { + const message = createBaseMsgEmergencyUnbond(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + if (object.uToken !== undefined && object.uToken !== null) { + message.uToken = Coin.fromAmino(object.uToken); + } + return message; + }, + toAmino(message: MsgEmergencyUnbond): MsgEmergencyUnbondAmino { + const obj: any = {}; + obj.account = message.account; + obj.uToken = message.uToken ? Coin.toAmino(message.uToken) : undefined; + return obj; + }, + fromAminoMsg(object: MsgEmergencyUnbondAminoMsg): MsgEmergencyUnbond { + return MsgEmergencyUnbond.fromAmino(object.value); + }, + fromProtoMsg(message: MsgEmergencyUnbondProtoMsg): MsgEmergencyUnbond { + return MsgEmergencyUnbond.decode(message.value); + }, + toProto(message: MsgEmergencyUnbond): Uint8Array { + return MsgEmergencyUnbond.encode(message).finish(); + }, + toProtoMsg(message: MsgEmergencyUnbond): MsgEmergencyUnbondProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbond", + value: MsgEmergencyUnbond.encode(message).finish() + }; + } +}; +function createBaseMsgEmergencyUnbondResponse(): MsgEmergencyUnbondResponse { + return {}; +} +export const MsgEmergencyUnbondResponse = { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbondResponse", + encode(_: MsgEmergencyUnbondResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgEmergencyUnbondResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEmergencyUnbondResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgEmergencyUnbondResponse { + const message = createBaseMsgEmergencyUnbondResponse(); + return message; + }, + fromAmino(_: MsgEmergencyUnbondResponseAmino): MsgEmergencyUnbondResponse { + const message = createBaseMsgEmergencyUnbondResponse(); + return message; + }, + toAmino(_: MsgEmergencyUnbondResponse): MsgEmergencyUnbondResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgEmergencyUnbondResponseAminoMsg): MsgEmergencyUnbondResponse { + return MsgEmergencyUnbondResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgEmergencyUnbondResponseProtoMsg): MsgEmergencyUnbondResponse { + return MsgEmergencyUnbondResponse.decode(message.value); + }, + toProto(message: MsgEmergencyUnbondResponse): Uint8Array { + return MsgEmergencyUnbondResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgEmergencyUnbondResponse): MsgEmergencyUnbondResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgEmergencyUnbondResponse", + value: MsgEmergencyUnbondResponse.encode(message).finish() + }; + } +}; +function createBaseMsgSponsor(): MsgSponsor { + return { + sponsor: "", + program: 0 + }; +} +export const MsgSponsor = { + typeUrl: "/umee.incentive.v1.MsgSponsor", + encode(message: MsgSponsor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sponsor !== "") { + writer.uint32(10).string(message.sponsor); + } + if (message.program !== 0) { + writer.uint32(16).uint32(message.program); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSponsor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSponsor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sponsor = reader.string(); + break; + case 2: + message.program = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgSponsor { + const message = createBaseMsgSponsor(); + message.sponsor = object.sponsor ?? ""; + message.program = object.program ?? 0; + return message; + }, + fromAmino(object: MsgSponsorAmino): MsgSponsor { + const message = createBaseMsgSponsor(); + if (object.sponsor !== undefined && object.sponsor !== null) { + message.sponsor = object.sponsor; + } + if (object.program !== undefined && object.program !== null) { + message.program = object.program; + } + return message; + }, + toAmino(message: MsgSponsor): MsgSponsorAmino { + const obj: any = {}; + obj.sponsor = message.sponsor; + obj.program = message.program; + return obj; + }, + fromAminoMsg(object: MsgSponsorAminoMsg): MsgSponsor { + return MsgSponsor.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSponsorProtoMsg): MsgSponsor { + return MsgSponsor.decode(message.value); + }, + toProto(message: MsgSponsor): Uint8Array { + return MsgSponsor.encode(message).finish(); + }, + toProtoMsg(message: MsgSponsor): MsgSponsorProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgSponsor", + value: MsgSponsor.encode(message).finish() + }; + } +}; +function createBaseMsgSponsorResponse(): MsgSponsorResponse { + return {}; +} +export const MsgSponsorResponse = { + typeUrl: "/umee.incentive.v1.MsgSponsorResponse", + encode(_: MsgSponsorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSponsorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSponsorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgSponsorResponse { + const message = createBaseMsgSponsorResponse(); + return message; + }, + fromAmino(_: MsgSponsorResponseAmino): MsgSponsorResponse { + const message = createBaseMsgSponsorResponse(); + return message; + }, + toAmino(_: MsgSponsorResponse): MsgSponsorResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSponsorResponseAminoMsg): MsgSponsorResponse { + return MsgSponsorResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSponsorResponseProtoMsg): MsgSponsorResponse { + return MsgSponsorResponse.decode(message.value); + }, + toProto(message: MsgSponsorResponse): Uint8Array { + return MsgSponsorResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSponsorResponse): MsgSponsorResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgSponsorResponse", + value: MsgSponsorResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetParams(): MsgGovSetParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgGovSetParams = { + typeUrl: "/umee.incentive.v1.MsgGovSetParams", + encode(message: MsgGovSetParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovSetParams { + const message = createBaseMsgGovSetParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgGovSetParamsAmino): MsgGovSetParams { + const message = createBaseMsgGovSetParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgGovSetParams): MsgGovSetParamsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGovSetParamsAminoMsg): MsgGovSetParams { + return MsgGovSetParams.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetParamsProtoMsg): MsgGovSetParams { + return MsgGovSetParams.decode(message.value); + }, + toProto(message: MsgGovSetParams): Uint8Array { + return MsgGovSetParams.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetParams): MsgGovSetParamsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgGovSetParams", + value: MsgGovSetParams.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetParamsResponse(): MsgGovSetParamsResponse { + return {}; +} +export const MsgGovSetParamsResponse = { + typeUrl: "/umee.incentive.v1.MsgGovSetParamsResponse", + encode(_: MsgGovSetParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovSetParamsResponse { + const message = createBaseMsgGovSetParamsResponse(); + return message; + }, + fromAmino(_: MsgGovSetParamsResponseAmino): MsgGovSetParamsResponse { + const message = createBaseMsgGovSetParamsResponse(); + return message; + }, + toAmino(_: MsgGovSetParamsResponse): MsgGovSetParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovSetParamsResponseAminoMsg): MsgGovSetParamsResponse { + return MsgGovSetParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetParamsResponseProtoMsg): MsgGovSetParamsResponse { + return MsgGovSetParamsResponse.decode(message.value); + }, + toProto(message: MsgGovSetParamsResponse): Uint8Array { + return MsgGovSetParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetParamsResponse): MsgGovSetParamsResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgGovSetParamsResponse", + value: MsgGovSetParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovCreatePrograms(): MsgGovCreatePrograms { + return { + authority: "", + programs: [], + fromCommunityFund: false + }; +} +export const MsgGovCreatePrograms = { + typeUrl: "/umee.incentive.v1.MsgGovCreatePrograms", + encode(message: MsgGovCreatePrograms, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.programs) { + IncentiveProgram.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.fromCommunityFund === true) { + writer.uint32(24).bool(message.fromCommunityFund); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovCreatePrograms { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovCreatePrograms(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.programs.push(IncentiveProgram.decode(reader, reader.uint32())); + break; + case 3: + message.fromCommunityFund = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovCreatePrograms { + const message = createBaseMsgGovCreatePrograms(); + message.authority = object.authority ?? ""; + message.programs = object.programs?.map(e => IncentiveProgram.fromPartial(e)) || []; + message.fromCommunityFund = object.fromCommunityFund ?? false; + return message; + }, + fromAmino(object: MsgGovCreateProgramsAmino): MsgGovCreatePrograms { + const message = createBaseMsgGovCreatePrograms(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.programs = object.programs?.map(e => IncentiveProgram.fromAmino(e)) || []; + if (object.from_community_fund !== undefined && object.from_community_fund !== null) { + message.fromCommunityFund = object.from_community_fund; + } + return message; + }, + toAmino(message: MsgGovCreatePrograms): MsgGovCreateProgramsAmino { + const obj: any = {}; + obj.authority = message.authority; + if (message.programs) { + obj.programs = message.programs.map(e => e ? IncentiveProgram.toAmino(e) : undefined); + } else { + obj.programs = []; + } + obj.from_community_fund = message.fromCommunityFund; + return obj; + }, + fromAminoMsg(object: MsgGovCreateProgramsAminoMsg): MsgGovCreatePrograms { + return MsgGovCreatePrograms.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovCreateProgramsProtoMsg): MsgGovCreatePrograms { + return MsgGovCreatePrograms.decode(message.value); + }, + toProto(message: MsgGovCreatePrograms): Uint8Array { + return MsgGovCreatePrograms.encode(message).finish(); + }, + toProtoMsg(message: MsgGovCreatePrograms): MsgGovCreateProgramsProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgGovCreatePrograms", + value: MsgGovCreatePrograms.encode(message).finish() + }; + } +}; +function createBaseMsgGovCreateProgramsResponse(): MsgGovCreateProgramsResponse { + return {}; +} +export const MsgGovCreateProgramsResponse = { + typeUrl: "/umee.incentive.v1.MsgGovCreateProgramsResponse", + encode(_: MsgGovCreateProgramsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovCreateProgramsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovCreateProgramsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovCreateProgramsResponse { + const message = createBaseMsgGovCreateProgramsResponse(); + return message; + }, + fromAmino(_: MsgGovCreateProgramsResponseAmino): MsgGovCreateProgramsResponse { + const message = createBaseMsgGovCreateProgramsResponse(); + return message; + }, + toAmino(_: MsgGovCreateProgramsResponse): MsgGovCreateProgramsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovCreateProgramsResponseAminoMsg): MsgGovCreateProgramsResponse { + return MsgGovCreateProgramsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovCreateProgramsResponseProtoMsg): MsgGovCreateProgramsResponse { + return MsgGovCreateProgramsResponse.decode(message.value); + }, + toProto(message: MsgGovCreateProgramsResponse): Uint8Array { + return MsgGovCreateProgramsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovCreateProgramsResponse): MsgGovCreateProgramsResponseProtoMsg { + return { + typeUrl: "/umee.incentive.v1.MsgGovCreateProgramsResponse", + value: MsgGovCreateProgramsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/lcd.ts b/src/codegen/umee/lcd.ts index ead32e9..b7a01e7 100644 --- a/src/codegen/umee/lcd.ts +++ b/src/codegen/umee/lcd.ts @@ -1,4 +1,4 @@ -import { LCDClient } from "@osmonauts/lcd"; +import { LCDClient } from "@cosmology/lcd"; export const createLCDClient = async ({ restEndpoint }: { @@ -96,15 +96,35 @@ export const createLCDClient = async ({ } }, umee: { + incentive: { + v1: new (await import("./incentive/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, leverage: { v1: new (await import("./leverage/v1/query.lcd")).LCDQueryClient({ requestClient }) }, + metoken: { + v1: new (await import("./metoken/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, oracle: { v1: new (await import("./oracle/v1/query.lcd")).LCDQueryClient({ requestClient }) + }, + ugov: { + v1: new (await import("./ugov/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + uibc: { + v1: new (await import("./uibc/v1/query.lcd")).LCDQueryClient({ + requestClient + }) } } }; diff --git a/src/codegen/umee/leverage/v1/events.ts b/src/codegen/umee/leverage/v1/events.ts index 9252f0f..a20c039 100644 --- a/src/codegen/umee/leverage/v1/events.ts +++ b/src/codegen/umee/leverage/v1/events.ts @@ -1,167 +1,237 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** EventSupply is emitted on Msg/Supply */ - export interface EventSupply { /** Liquidity supplier bech32 address. */ supplier: string; /** Liquidity provided to the module. */ - - asset?: Coin; + asset: Coin; /** uToken received by the supplier in exchange for the provided liquidity. */ - - utoken?: Coin; + utoken: Coin; +} +export interface EventSupplyProtoMsg { + typeUrl: "/umee.leverage.v1.EventSupply"; + value: Uint8Array; } /** EventSupply is emitted on Msg/Supply */ - -export interface EventSupplySDKType { +export interface EventSupplyAmino { /** Liquidity supplier bech32 address. */ - supplier: string; + supplier?: string; /** Liquidity provided to the module. */ - - asset?: CoinSDKType; + asset?: CoinAmino; /** uToken received by the supplier in exchange for the provided liquidity. */ - - utoken?: CoinSDKType; + utoken?: CoinAmino; +} +export interface EventSupplyAminoMsg { + type: "/umee.leverage.v1.EventSupply"; + value: EventSupplyAmino; +} +/** EventSupply is emitted on Msg/Supply */ +export interface EventSupplySDKType { + supplier: string; + asset: CoinSDKType; + utoken: CoinSDKType; } /** EventWithdraw is emitted on Msg/Withdraw */ - export interface EventWithdraw { /** Liquidity supplier bech32 address. */ supplier: string; /** uToken sent to the module in exchange for the underlying asset. */ - - utoken?: Coin; + utoken: Coin; /** Liquidity received by the supplier. */ - - asset?: Coin; + asset: Coin; +} +export interface EventWithdrawProtoMsg { + typeUrl: "/umee.leverage.v1.EventWithdraw"; + value: Uint8Array; } /** EventWithdraw is emitted on Msg/Withdraw */ - -export interface EventWithdrawSDKType { +export interface EventWithdrawAmino { /** Liquidity supplier bech32 address. */ - supplier: string; + supplier?: string; /** uToken sent to the module in exchange for the underlying asset. */ - - utoken?: CoinSDKType; + utoken?: CoinAmino; /** Liquidity received by the supplier. */ - - asset?: CoinSDKType; + asset?: CoinAmino; +} +export interface EventWithdrawAminoMsg { + type: "/umee.leverage.v1.EventWithdraw"; + value: EventWithdrawAmino; +} +/** EventWithdraw is emitted on Msg/Withdraw */ +export interface EventWithdrawSDKType { + supplier: string; + utoken: CoinSDKType; + asset: CoinSDKType; } /** EventCollaterize is emitted on Msg/Collaterize */ - export interface EventCollaterize { /** Borrower bech32 address. */ borrower: string; /** uToken provided as a collateral. */ - - utoken?: Coin; + utoken: Coin; +} +export interface EventCollaterizeProtoMsg { + typeUrl: "/umee.leverage.v1.EventCollaterize"; + value: Uint8Array; } /** EventCollaterize is emitted on Msg/Collaterize */ - -export interface EventCollaterizeSDKType { +export interface EventCollaterizeAmino { /** Borrower bech32 address. */ - borrower: string; + borrower?: string; /** uToken provided as a collateral. */ - - utoken?: CoinSDKType; + utoken?: CoinAmino; +} +export interface EventCollaterizeAminoMsg { + type: "/umee.leverage.v1.EventCollaterize"; + value: EventCollaterizeAmino; +} +/** EventCollaterize is emitted on Msg/Collaterize */ +export interface EventCollaterizeSDKType { + borrower: string; + utoken: CoinSDKType; } /** EventDecollaterize is emitted on Msg/Decollateralize */ - export interface EventDecollaterize { /** Borrower bech32 address. */ borrower: string; /** utoken removed from collateral. */ - - utoken?: Coin; + utoken: Coin; +} +export interface EventDecollaterizeProtoMsg { + typeUrl: "/umee.leverage.v1.EventDecollaterize"; + value: Uint8Array; } /** EventDecollaterize is emitted on Msg/Decollateralize */ - -export interface EventDecollaterizeSDKType { +export interface EventDecollaterizeAmino { /** Borrower bech32 address. */ - borrower: string; + borrower?: string; /** utoken removed from collateral. */ - - utoken?: CoinSDKType; + utoken?: CoinAmino; +} +export interface EventDecollaterizeAminoMsg { + type: "/umee.leverage.v1.EventDecollaterize"; + value: EventDecollaterizeAmino; +} +/** EventDecollaterize is emitted on Msg/Decollateralize */ +export interface EventDecollaterizeSDKType { + borrower: string; + utoken: CoinSDKType; } /** EventBorrow is emitted on Msg/Borrow */ - export interface EventBorrow { /** Borrower bech32 address. */ borrower: string; /** Asset borrowed. */ - - asset?: Coin; + asset: Coin; +} +export interface EventBorrowProtoMsg { + typeUrl: "/umee.leverage.v1.EventBorrow"; + value: Uint8Array; } /** EventBorrow is emitted on Msg/Borrow */ - -export interface EventBorrowSDKType { +export interface EventBorrowAmino { /** Borrower bech32 address. */ - borrower: string; + borrower?: string; /** Asset borrowed. */ - - asset?: CoinSDKType; + asset?: CoinAmino; +} +export interface EventBorrowAminoMsg { + type: "/umee.leverage.v1.EventBorrow"; + value: EventBorrowAmino; +} +/** EventBorrow is emitted on Msg/Borrow */ +export interface EventBorrowSDKType { + borrower: string; + asset: CoinSDKType; } /** EventRepay is emitted on Msg/Repay */ - export interface EventRepay { /** Borrower bech32 address. */ borrower: string; /** Asset repaid */ - - repaid?: Coin; + repaid: Coin; +} +export interface EventRepayProtoMsg { + typeUrl: "/umee.leverage.v1.EventRepay"; + value: Uint8Array; } /** EventRepay is emitted on Msg/Repay */ - -export interface EventRepaySDKType { +export interface EventRepayAmino { /** Borrower bech32 address. */ - borrower: string; + borrower?: string; /** Asset repaid */ - - repaid?: CoinSDKType; + repaid?: CoinAmino; +} +export interface EventRepayAminoMsg { + type: "/umee.leverage.v1.EventRepay"; + value: EventRepayAmino; +} +/** EventRepay is emitted on Msg/Repay */ +export interface EventRepaySDKType { + borrower: string; + repaid: CoinSDKType; } /** EventLiquidate is emitted on Msg/Liquidate */ - export interface EventLiquidate { /** Liquidator bech32 address. */ liquidator: string; /** Borrower bech32 address. */ - borrower: string; /** Assets liquidated from the borrower */ - - liquidated?: Coin; + liquidated: Coin; +} +export interface EventLiquidateProtoMsg { + typeUrl: "/umee.leverage.v1.EventLiquidate"; + value: Uint8Array; } /** EventLiquidate is emitted on Msg/Liquidate */ - -export interface EventLiquidateSDKType { +export interface EventLiquidateAmino { /** Liquidator bech32 address. */ - liquidator: string; + liquidator?: string; /** Borrower bech32 address. */ - - borrower: string; + borrower?: string; /** Assets liquidated from the borrower */ - - liquidated?: CoinSDKType; + liquidated?: CoinAmino; +} +export interface EventLiquidateAminoMsg { + type: "/umee.leverage.v1.EventLiquidate"; + value: EventLiquidateAmino; +} +/** EventLiquidate is emitted on Msg/Liquidate */ +export interface EventLiquidateSDKType { + liquidator: string; + borrower: string; + liquidated: CoinSDKType; } /** EventInterestAccrual is emitted when interest accrues in EndBlock */ - export interface EventInterestAccrual { - blockHeight: Long; + blockHeight: bigint; /** Unix timestamp (in seconds) */ - - timestamp: Long; + timestamp: bigint; totalInterest: Coin[]; reserved: Coin[]; } +export interface EventInterestAccrualProtoMsg { + typeUrl: "/umee.leverage.v1.EventInterestAccrual"; + value: Uint8Array; +} /** EventInterestAccrual is emitted when interest accrues in EndBlock */ - -export interface EventInterestAccrualSDKType { - block_height: Long; +export interface EventInterestAccrualAmino { + block_height?: string; /** Unix timestamp (in seconds) */ - - timestamp: Long; + timestamp?: string; + total_interest?: CoinAmino[]; + reserved?: CoinAmino[]; +} +export interface EventInterestAccrualAminoMsg { + type: "/umee.leverage.v1.EventInterestAccrual"; + value: EventInterestAccrualAmino; +} +/** EventInterestAccrual is emitted when interest accrues in EndBlock */ +export interface EventInterestAccrualSDKType { + block_height: bigint; + timestamp: bigint; total_interest: CoinSDKType[]; reserved: CoinSDKType[]; } @@ -169,736 +239,1006 @@ export interface EventInterestAccrualSDKType { * EventRepayBadDebt is emitted when bad debt is detected and repayed * (potentially partially) */ - export interface EventRepayBadDebt { /** Borrower bech32 address. */ borrower: string; /** Asset repaid */ - - asset?: Coin; + asset: Coin; +} +export interface EventRepayBadDebtProtoMsg { + typeUrl: "/umee.leverage.v1.EventRepayBadDebt"; + value: Uint8Array; +} +/** + * EventRepayBadDebt is emitted when bad debt is detected and repayed + * (potentially partially) + */ +export interface EventRepayBadDebtAmino { + /** Borrower bech32 address. */ + borrower?: string; + /** Asset repaid */ + asset?: CoinAmino; +} +export interface EventRepayBadDebtAminoMsg { + type: "/umee.leverage.v1.EventRepayBadDebt"; + value: EventRepayBadDebtAmino; } /** * EventRepayBadDebt is emitted when bad debt is detected and repayed * (potentially partially) */ - export interface EventRepayBadDebtSDKType { - /** Borrower bech32 address. */ borrower: string; - /** Asset repaid */ - - asset?: CoinSDKType; + asset: CoinSDKType; } /** * EventReservesExhausted is emitted when the module reserves are exhausted * by paying off bad debts. */ - export interface EventReservesExhausted { /** Borrower bech32 address. */ borrower: string; /** Outstanding bad debt */ - - outstandingDebt?: Coin; + outstandingDebt: Coin; /** Module balance remaining */ - - moduleBalance?: Coin; + moduleBalance: Coin; /** Reserves remaining */ - - reserves?: Coin; + reserves: Coin; +} +export interface EventReservesExhaustedProtoMsg { + typeUrl: "/umee.leverage.v1.EventReservesExhausted"; + value: Uint8Array; } /** * EventReservesExhausted is emitted when the module reserves are exhausted * by paying off bad debts. */ - -export interface EventReservesExhaustedSDKType { +export interface EventReservesExhaustedAmino { /** Borrower bech32 address. */ - borrower: string; + borrower?: string; /** Outstanding bad debt */ - - outstanding_debt?: CoinSDKType; + outstanding_debt?: CoinAmino; /** Module balance remaining */ - - module_balance?: CoinSDKType; + module_balance?: CoinAmino; /** Reserves remaining */ - - reserves?: CoinSDKType; + reserves?: CoinAmino; +} +export interface EventReservesExhaustedAminoMsg { + type: "/umee.leverage.v1.EventReservesExhausted"; + value: EventReservesExhaustedAmino; +} +/** + * EventReservesExhausted is emitted when the module reserves are exhausted + * by paying off bad debts. + */ +export interface EventReservesExhaustedSDKType { + borrower: string; + outstanding_debt: CoinSDKType; + module_balance: CoinSDKType; + reserves: CoinSDKType; } /** EventFundOracle is emitted when sending rewards to oracle module */ - export interface EventFundOracle { /** Assets sent to oracle module */ assets: Coin[]; } +export interface EventFundOracleProtoMsg { + typeUrl: "/umee.leverage.v1.EventFundOracle"; + value: Uint8Array; +} /** EventFundOracle is emitted when sending rewards to oracle module */ - -export interface EventFundOracleSDKType { +export interface EventFundOracleAmino { /** Assets sent to oracle module */ + assets?: CoinAmino[]; +} +export interface EventFundOracleAminoMsg { + type: "/umee.leverage.v1.EventFundOracle"; + value: EventFundOracleAmino; +} +/** EventFundOracle is emitted when sending rewards to oracle module */ +export interface EventFundOracleSDKType { assets: CoinSDKType[]; } - function createBaseEventSupply(): EventSupply { return { supplier: "", - asset: undefined, - utoken: undefined + asset: Coin.fromPartial({}), + utoken: Coin.fromPartial({}) }; } - export const EventSupply = { - encode(message: EventSupply, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventSupply", + encode(message: EventSupply, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.supplier !== "") { writer.uint32(10).string(message.supplier); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - if (message.utoken !== undefined) { Coin.encode(message.utoken, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventSupply { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventSupply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventSupply(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.supplier = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - case 3: message.utoken = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventSupply { + fromPartial(object: Partial): EventSupply { const message = createBaseEventSupply(); message.supplier = object.supplier ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; message.utoken = object.utoken !== undefined && object.utoken !== null ? Coin.fromPartial(object.utoken) : undefined; return message; + }, + fromAmino(object: EventSupplyAmino): EventSupply { + const message = createBaseEventSupply(); + if (object.supplier !== undefined && object.supplier !== null) { + message.supplier = object.supplier; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + if (object.utoken !== undefined && object.utoken !== null) { + message.utoken = Coin.fromAmino(object.utoken); + } + return message; + }, + toAmino(message: EventSupply): EventSupplyAmino { + const obj: any = {}; + obj.supplier = message.supplier; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + obj.utoken = message.utoken ? Coin.toAmino(message.utoken) : undefined; + return obj; + }, + fromAminoMsg(object: EventSupplyAminoMsg): EventSupply { + return EventSupply.fromAmino(object.value); + }, + fromProtoMsg(message: EventSupplyProtoMsg): EventSupply { + return EventSupply.decode(message.value); + }, + toProto(message: EventSupply): Uint8Array { + return EventSupply.encode(message).finish(); + }, + toProtoMsg(message: EventSupply): EventSupplyProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventSupply", + value: EventSupply.encode(message).finish() + }; } - }; - function createBaseEventWithdraw(): EventWithdraw { return { supplier: "", - utoken: undefined, - asset: undefined + utoken: Coin.fromPartial({}), + asset: Coin.fromPartial({}) }; } - export const EventWithdraw = { - encode(message: EventWithdraw, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventWithdraw", + encode(message: EventWithdraw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.supplier !== "") { writer.uint32(10).string(message.supplier); } - if (message.utoken !== undefined) { Coin.encode(message.utoken, writer.uint32(18).fork()).ldelim(); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventWithdraw { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventWithdraw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventWithdraw(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.supplier = reader.string(); break; - case 2: message.utoken = Coin.decode(reader, reader.uint32()); break; - case 3: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventWithdraw { + fromPartial(object: Partial): EventWithdraw { const message = createBaseEventWithdraw(); message.supplier = object.supplier ?? ""; message.utoken = object.utoken !== undefined && object.utoken !== null ? Coin.fromPartial(object.utoken) : undefined; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: EventWithdrawAmino): EventWithdraw { + const message = createBaseEventWithdraw(); + if (object.supplier !== undefined && object.supplier !== null) { + message.supplier = object.supplier; + } + if (object.utoken !== undefined && object.utoken !== null) { + message.utoken = Coin.fromAmino(object.utoken); + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: EventWithdraw): EventWithdrawAmino { + const obj: any = {}; + obj.supplier = message.supplier; + obj.utoken = message.utoken ? Coin.toAmino(message.utoken) : undefined; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: EventWithdrawAminoMsg): EventWithdraw { + return EventWithdraw.fromAmino(object.value); + }, + fromProtoMsg(message: EventWithdrawProtoMsg): EventWithdraw { + return EventWithdraw.decode(message.value); + }, + toProto(message: EventWithdraw): Uint8Array { + return EventWithdraw.encode(message).finish(); + }, + toProtoMsg(message: EventWithdraw): EventWithdrawProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventWithdraw", + value: EventWithdraw.encode(message).finish() + }; } - }; - function createBaseEventCollaterize(): EventCollaterize { return { borrower: "", - utoken: undefined + utoken: Coin.fromPartial({}) }; } - export const EventCollaterize = { - encode(message: EventCollaterize, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventCollaterize", + encode(message: EventCollaterize, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.utoken !== undefined) { Coin.encode(message.utoken, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventCollaterize { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventCollaterize { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventCollaterize(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.utoken = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventCollaterize { + fromPartial(object: Partial): EventCollaterize { const message = createBaseEventCollaterize(); message.borrower = object.borrower ?? ""; message.utoken = object.utoken !== undefined && object.utoken !== null ? Coin.fromPartial(object.utoken) : undefined; return message; + }, + fromAmino(object: EventCollaterizeAmino): EventCollaterize { + const message = createBaseEventCollaterize(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.utoken !== undefined && object.utoken !== null) { + message.utoken = Coin.fromAmino(object.utoken); + } + return message; + }, + toAmino(message: EventCollaterize): EventCollaterizeAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.utoken = message.utoken ? Coin.toAmino(message.utoken) : undefined; + return obj; + }, + fromAminoMsg(object: EventCollaterizeAminoMsg): EventCollaterize { + return EventCollaterize.fromAmino(object.value); + }, + fromProtoMsg(message: EventCollaterizeProtoMsg): EventCollaterize { + return EventCollaterize.decode(message.value); + }, + toProto(message: EventCollaterize): Uint8Array { + return EventCollaterize.encode(message).finish(); + }, + toProtoMsg(message: EventCollaterize): EventCollaterizeProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventCollaterize", + value: EventCollaterize.encode(message).finish() + }; } - }; - function createBaseEventDecollaterize(): EventDecollaterize { return { borrower: "", - utoken: undefined + utoken: Coin.fromPartial({}) }; } - export const EventDecollaterize = { - encode(message: EventDecollaterize, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventDecollaterize", + encode(message: EventDecollaterize, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.utoken !== undefined) { Coin.encode(message.utoken, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventDecollaterize { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventDecollaterize { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventDecollaterize(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.utoken = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventDecollaterize { + fromPartial(object: Partial): EventDecollaterize { const message = createBaseEventDecollaterize(); message.borrower = object.borrower ?? ""; message.utoken = object.utoken !== undefined && object.utoken !== null ? Coin.fromPartial(object.utoken) : undefined; return message; + }, + fromAmino(object: EventDecollaterizeAmino): EventDecollaterize { + const message = createBaseEventDecollaterize(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.utoken !== undefined && object.utoken !== null) { + message.utoken = Coin.fromAmino(object.utoken); + } + return message; + }, + toAmino(message: EventDecollaterize): EventDecollaterizeAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.utoken = message.utoken ? Coin.toAmino(message.utoken) : undefined; + return obj; + }, + fromAminoMsg(object: EventDecollaterizeAminoMsg): EventDecollaterize { + return EventDecollaterize.fromAmino(object.value); + }, + fromProtoMsg(message: EventDecollaterizeProtoMsg): EventDecollaterize { + return EventDecollaterize.decode(message.value); + }, + toProto(message: EventDecollaterize): Uint8Array { + return EventDecollaterize.encode(message).finish(); + }, + toProtoMsg(message: EventDecollaterize): EventDecollaterizeProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventDecollaterize", + value: EventDecollaterize.encode(message).finish() + }; } - }; - function createBaseEventBorrow(): EventBorrow { return { borrower: "", - asset: undefined + asset: Coin.fromPartial({}) }; } - export const EventBorrow = { - encode(message: EventBorrow, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventBorrow", + encode(message: EventBorrow, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventBorrow { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventBorrow { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventBorrow(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventBorrow { + fromPartial(object: Partial): EventBorrow { const message = createBaseEventBorrow(); message.borrower = object.borrower ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: EventBorrowAmino): EventBorrow { + const message = createBaseEventBorrow(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: EventBorrow): EventBorrowAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: EventBorrowAminoMsg): EventBorrow { + return EventBorrow.fromAmino(object.value); + }, + fromProtoMsg(message: EventBorrowProtoMsg): EventBorrow { + return EventBorrow.decode(message.value); + }, + toProto(message: EventBorrow): Uint8Array { + return EventBorrow.encode(message).finish(); + }, + toProtoMsg(message: EventBorrow): EventBorrowProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventBorrow", + value: EventBorrow.encode(message).finish() + }; } - }; - function createBaseEventRepay(): EventRepay { return { borrower: "", - repaid: undefined + repaid: Coin.fromPartial({}) }; } - export const EventRepay = { - encode(message: EventRepay, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventRepay", + encode(message: EventRepay, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.repaid !== undefined) { Coin.encode(message.repaid, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventRepay { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventRepay { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventRepay(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.repaid = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventRepay { + fromPartial(object: Partial): EventRepay { const message = createBaseEventRepay(); message.borrower = object.borrower ?? ""; message.repaid = object.repaid !== undefined && object.repaid !== null ? Coin.fromPartial(object.repaid) : undefined; return message; + }, + fromAmino(object: EventRepayAmino): EventRepay { + const message = createBaseEventRepay(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.repaid !== undefined && object.repaid !== null) { + message.repaid = Coin.fromAmino(object.repaid); + } + return message; + }, + toAmino(message: EventRepay): EventRepayAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.repaid = message.repaid ? Coin.toAmino(message.repaid) : undefined; + return obj; + }, + fromAminoMsg(object: EventRepayAminoMsg): EventRepay { + return EventRepay.fromAmino(object.value); + }, + fromProtoMsg(message: EventRepayProtoMsg): EventRepay { + return EventRepay.decode(message.value); + }, + toProto(message: EventRepay): Uint8Array { + return EventRepay.encode(message).finish(); + }, + toProtoMsg(message: EventRepay): EventRepayProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventRepay", + value: EventRepay.encode(message).finish() + }; } - }; - function createBaseEventLiquidate(): EventLiquidate { return { liquidator: "", borrower: "", - liquidated: undefined + liquidated: Coin.fromPartial({}) }; } - export const EventLiquidate = { - encode(message: EventLiquidate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventLiquidate", + encode(message: EventLiquidate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.liquidator !== "") { writer.uint32(10).string(message.liquidator); } - if (message.borrower !== "") { writer.uint32(18).string(message.borrower); } - if (message.liquidated !== undefined) { Coin.encode(message.liquidated, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventLiquidate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventLiquidate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventLiquidate(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.liquidator = reader.string(); break; - case 2: message.borrower = reader.string(); break; - case 3: message.liquidated = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventLiquidate { + fromPartial(object: Partial): EventLiquidate { const message = createBaseEventLiquidate(); message.liquidator = object.liquidator ?? ""; message.borrower = object.borrower ?? ""; message.liquidated = object.liquidated !== undefined && object.liquidated !== null ? Coin.fromPartial(object.liquidated) : undefined; return message; + }, + fromAmino(object: EventLiquidateAmino): EventLiquidate { + const message = createBaseEventLiquidate(); + if (object.liquidator !== undefined && object.liquidator !== null) { + message.liquidator = object.liquidator; + } + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.liquidated !== undefined && object.liquidated !== null) { + message.liquidated = Coin.fromAmino(object.liquidated); + } + return message; + }, + toAmino(message: EventLiquidate): EventLiquidateAmino { + const obj: any = {}; + obj.liquidator = message.liquidator; + obj.borrower = message.borrower; + obj.liquidated = message.liquidated ? Coin.toAmino(message.liquidated) : undefined; + return obj; + }, + fromAminoMsg(object: EventLiquidateAminoMsg): EventLiquidate { + return EventLiquidate.fromAmino(object.value); + }, + fromProtoMsg(message: EventLiquidateProtoMsg): EventLiquidate { + return EventLiquidate.decode(message.value); + }, + toProto(message: EventLiquidate): Uint8Array { + return EventLiquidate.encode(message).finish(); + }, + toProtoMsg(message: EventLiquidate): EventLiquidateProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventLiquidate", + value: EventLiquidate.encode(message).finish() + }; } - }; - function createBaseEventInterestAccrual(): EventInterestAccrual { return { - blockHeight: Long.UZERO, - timestamp: Long.UZERO, + blockHeight: BigInt(0), + timestamp: BigInt(0), totalInterest: [], reserved: [] }; } - export const EventInterestAccrual = { - encode(message: EventInterestAccrual, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.blockHeight.isZero()) { + typeUrl: "/umee.leverage.v1.EventInterestAccrual", + encode(message: EventInterestAccrual, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockHeight !== BigInt(0)) { writer.uint32(8).uint64(message.blockHeight); } - - if (!message.timestamp.isZero()) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - for (const v of message.totalInterest) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.reserved) { Coin.encode(v!, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventInterestAccrual { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventInterestAccrual { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventInterestAccrual(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.blockHeight = (reader.uint64() as Long); + message.blockHeight = reader.uint64(); break; - case 2: - message.timestamp = (reader.uint64() as Long); + message.timestamp = reader.uint64(); break; - case 3: message.totalInterest.push(Coin.decode(reader, reader.uint32())); break; - case 4: message.reserved.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventInterestAccrual { + fromPartial(object: Partial): EventInterestAccrual { const message = createBaseEventInterestAccrual(); - message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? Long.fromValue(object.blockHeight) : Long.UZERO; - message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO; + message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? BigInt(object.blockHeight.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.totalInterest = object.totalInterest?.map(e => Coin.fromPartial(e)) || []; message.reserved = object.reserved?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: EventInterestAccrualAmino): EventInterestAccrual { + const message = createBaseEventInterestAccrual(); + if (object.block_height !== undefined && object.block_height !== null) { + message.blockHeight = BigInt(object.block_height); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + message.totalInterest = object.total_interest?.map(e => Coin.fromAmino(e)) || []; + message.reserved = object.reserved?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: EventInterestAccrual): EventInterestAccrualAmino { + const obj: any = {}; + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + if (message.totalInterest) { + obj.total_interest = message.totalInterest.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_interest = []; + } + if (message.reserved) { + obj.reserved = message.reserved.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.reserved = []; + } + return obj; + }, + fromAminoMsg(object: EventInterestAccrualAminoMsg): EventInterestAccrual { + return EventInterestAccrual.fromAmino(object.value); + }, + fromProtoMsg(message: EventInterestAccrualProtoMsg): EventInterestAccrual { + return EventInterestAccrual.decode(message.value); + }, + toProto(message: EventInterestAccrual): Uint8Array { + return EventInterestAccrual.encode(message).finish(); + }, + toProtoMsg(message: EventInterestAccrual): EventInterestAccrualProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventInterestAccrual", + value: EventInterestAccrual.encode(message).finish() + }; } - }; - function createBaseEventRepayBadDebt(): EventRepayBadDebt { return { borrower: "", - asset: undefined + asset: Coin.fromPartial({}) }; } - export const EventRepayBadDebt = { - encode(message: EventRepayBadDebt, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventRepayBadDebt", + encode(message: EventRepayBadDebt, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventRepayBadDebt { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventRepayBadDebt { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventRepayBadDebt(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventRepayBadDebt { + fromPartial(object: Partial): EventRepayBadDebt { const message = createBaseEventRepayBadDebt(); message.borrower = object.borrower ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: EventRepayBadDebtAmino): EventRepayBadDebt { + const message = createBaseEventRepayBadDebt(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: EventRepayBadDebt): EventRepayBadDebtAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: EventRepayBadDebtAminoMsg): EventRepayBadDebt { + return EventRepayBadDebt.fromAmino(object.value); + }, + fromProtoMsg(message: EventRepayBadDebtProtoMsg): EventRepayBadDebt { + return EventRepayBadDebt.decode(message.value); + }, + toProto(message: EventRepayBadDebt): Uint8Array { + return EventRepayBadDebt.encode(message).finish(); + }, + toProtoMsg(message: EventRepayBadDebt): EventRepayBadDebtProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventRepayBadDebt", + value: EventRepayBadDebt.encode(message).finish() + }; } - }; - function createBaseEventReservesExhausted(): EventReservesExhausted { return { borrower: "", - outstandingDebt: undefined, - moduleBalance: undefined, - reserves: undefined + outstandingDebt: Coin.fromPartial({}), + moduleBalance: Coin.fromPartial({}), + reserves: Coin.fromPartial({}) }; } - export const EventReservesExhausted = { - encode(message: EventReservesExhausted, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventReservesExhausted", + encode(message: EventReservesExhausted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.outstandingDebt !== undefined) { Coin.encode(message.outstandingDebt, writer.uint32(18).fork()).ldelim(); } - if (message.moduleBalance !== undefined) { Coin.encode(message.moduleBalance, writer.uint32(26).fork()).ldelim(); } - if (message.reserves !== undefined) { Coin.encode(message.reserves, writer.uint32(34).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventReservesExhausted { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventReservesExhausted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventReservesExhausted(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.outstandingDebt = Coin.decode(reader, reader.uint32()); break; - case 3: message.moduleBalance = Coin.decode(reader, reader.uint32()); break; - case 4: message.reserves = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventReservesExhausted { + fromPartial(object: Partial): EventReservesExhausted { const message = createBaseEventReservesExhausted(); message.borrower = object.borrower ?? ""; message.outstandingDebt = object.outstandingDebt !== undefined && object.outstandingDebt !== null ? Coin.fromPartial(object.outstandingDebt) : undefined; message.moduleBalance = object.moduleBalance !== undefined && object.moduleBalance !== null ? Coin.fromPartial(object.moduleBalance) : undefined; message.reserves = object.reserves !== undefined && object.reserves !== null ? Coin.fromPartial(object.reserves) : undefined; return message; + }, + fromAmino(object: EventReservesExhaustedAmino): EventReservesExhausted { + const message = createBaseEventReservesExhausted(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.outstanding_debt !== undefined && object.outstanding_debt !== null) { + message.outstandingDebt = Coin.fromAmino(object.outstanding_debt); + } + if (object.module_balance !== undefined && object.module_balance !== null) { + message.moduleBalance = Coin.fromAmino(object.module_balance); + } + if (object.reserves !== undefined && object.reserves !== null) { + message.reserves = Coin.fromAmino(object.reserves); + } + return message; + }, + toAmino(message: EventReservesExhausted): EventReservesExhaustedAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.outstanding_debt = message.outstandingDebt ? Coin.toAmino(message.outstandingDebt) : undefined; + obj.module_balance = message.moduleBalance ? Coin.toAmino(message.moduleBalance) : undefined; + obj.reserves = message.reserves ? Coin.toAmino(message.reserves) : undefined; + return obj; + }, + fromAminoMsg(object: EventReservesExhaustedAminoMsg): EventReservesExhausted { + return EventReservesExhausted.fromAmino(object.value); + }, + fromProtoMsg(message: EventReservesExhaustedProtoMsg): EventReservesExhausted { + return EventReservesExhausted.decode(message.value); + }, + toProto(message: EventReservesExhausted): Uint8Array { + return EventReservesExhausted.encode(message).finish(); + }, + toProtoMsg(message: EventReservesExhausted): EventReservesExhaustedProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventReservesExhausted", + value: EventReservesExhausted.encode(message).finish() + }; } - }; - function createBaseEventFundOracle(): EventFundOracle { return { assets: [] }; } - export const EventFundOracle = { - encode(message: EventFundOracle, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.EventFundOracle", + encode(message: EventFundOracle, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.assets) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventFundOracle { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventFundOracle { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventFundOracle(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.assets.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventFundOracle { + fromPartial(object: Partial): EventFundOracle { const message = createBaseEventFundOracle(); message.assets = object.assets?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: EventFundOracleAmino): EventFundOracle { + const message = createBaseEventFundOracle(); + message.assets = object.assets?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: EventFundOracle): EventFundOracleAmino { + const obj: any = {}; + if (message.assets) { + obj.assets = message.assets.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.assets = []; + } + return obj; + }, + fromAminoMsg(object: EventFundOracleAminoMsg): EventFundOracle { + return EventFundOracle.fromAmino(object.value); + }, + fromProtoMsg(message: EventFundOracleProtoMsg): EventFundOracle { + return EventFundOracle.decode(message.value); + }, + toProto(message: EventFundOracle): Uint8Array { + return EventFundOracle.encode(message).finish(); + }, + toProtoMsg(message: EventFundOracle): EventFundOracleProtoMsg { + return { + typeUrl: "/umee.leverage.v1.EventFundOracle", + value: EventFundOracle.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/genesis.ts b/src/codegen/umee/leverage/v1/genesis.ts index d4e3a9c..5fe9969 100644 --- a/src/codegen/umee/leverage/v1/genesis.ts +++ b/src/codegen/umee/leverage/v1/genesis.ts @@ -1,77 +1,137 @@ -import { Params, ParamsSDKType, Token, TokenSDKType } from "./leverage"; -import { Coin, CoinSDKType, DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { Params, ParamsAmino, ParamsSDKType, Token, TokenAmino, TokenSDKType, SpecialAssetPair, SpecialAssetPairAmino, SpecialAssetPairSDKType } from "./leverage"; +import { Coin, CoinAmino, CoinSDKType, DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; /** GenesisState defines the x/leverage module's genesis state. */ - export interface GenesisState { - params?: Params; + params: Params; registry: Token[]; adjustedBorrows: AdjustedBorrow[]; collateral: Collateral[]; reserves: Coin[]; - lastInterestTime: Long; + lastInterestTime: bigint; badDebts: BadDebt[]; interestScalars: InterestScalar[]; utokenSupply: Coin[]; + specialPairs: SpecialAssetPair[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/umee.leverage.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the x/leverage module's genesis state. */ +export interface GenesisStateAmino { + params?: ParamsAmino; + registry?: TokenAmino[]; + adjusted_borrows?: AdjustedBorrowAmino[]; + collateral?: CollateralAmino[]; + reserves?: CoinAmino[]; + last_interest_time?: string; + bad_debts?: BadDebtAmino[]; + interest_scalars?: InterestScalarAmino[]; + utoken_supply?: CoinAmino[]; + special_pairs?: SpecialAssetPairAmino[]; +} +export interface GenesisStateAminoMsg { + type: "/umee.leverage.v1.GenesisState"; + value: GenesisStateAmino; } /** GenesisState defines the x/leverage module's genesis state. */ - export interface GenesisStateSDKType { - params?: ParamsSDKType; + params: ParamsSDKType; registry: TokenSDKType[]; adjusted_borrows: AdjustedBorrowSDKType[]; collateral: CollateralSDKType[]; reserves: CoinSDKType[]; - last_interest_time: Long; + last_interest_time: bigint; bad_debts: BadDebtSDKType[]; interest_scalars: InterestScalarSDKType[]; utoken_supply: CoinSDKType[]; + special_pairs: SpecialAssetPairSDKType[]; } /** * AdjustedBorrow is a borrow struct used in the leverage module's genesis * state. */ - export interface AdjustedBorrow { address: string; - amount?: DecCoin; + amount: DecCoin; +} +export interface AdjustedBorrowProtoMsg { + typeUrl: "/umee.leverage.v1.AdjustedBorrow"; + value: Uint8Array; +} +/** + * AdjustedBorrow is a borrow struct used in the leverage module's genesis + * state. + */ +export interface AdjustedBorrowAmino { + address?: string; + amount?: DecCoinAmino; +} +export interface AdjustedBorrowAminoMsg { + type: "/umee.leverage.v1.AdjustedBorrow"; + value: AdjustedBorrowAmino; } /** * AdjustedBorrow is a borrow struct used in the leverage module's genesis * state. */ - export interface AdjustedBorrowSDKType { address: string; - amount?: DecCoinSDKType; + amount: DecCoinSDKType; } /** * Collateral is a collateral struct used in the leverage module's genesis * state. */ - export interface Collateral { address: string; - amount?: Coin; + amount: Coin; +} +export interface CollateralProtoMsg { + typeUrl: "/umee.leverage.v1.Collateral"; + value: Uint8Array; +} +/** + * Collateral is a collateral struct used in the leverage module's genesis + * state. + */ +export interface CollateralAmino { + address?: string; + amount?: CoinAmino; +} +export interface CollateralAminoMsg { + type: "/umee.leverage.v1.Collateral"; + value: CollateralAmino; } /** * Collateral is a collateral struct used in the leverage module's genesis * state. */ - export interface CollateralSDKType { address: string; - amount?: CoinSDKType; + amount: CoinSDKType; } /** BadDebt is a bad debt instance used in the leverage module's genesis state. */ - export interface BadDebt { address: string; denom: string; } +export interface BadDebtProtoMsg { + typeUrl: "/umee.leverage.v1.BadDebt"; + value: Uint8Array; +} +/** BadDebt is a bad debt instance used in the leverage module's genesis state. */ +export interface BadDebtAmino { + address?: string; + denom?: string; +} +export interface BadDebtAminoMsg { + type: "/umee.leverage.v1.BadDebt"; + value: BadDebtAmino; +} /** BadDebt is a bad debt instance used in the leverage module's genesis state. */ - export interface BadDebtSDKType { address: string; denom: string; @@ -80,362 +140,518 @@ export interface BadDebtSDKType { * InterestScalar is an interest scalar used in the leverage module's genesis * state. */ - export interface InterestScalar { denom: string; scalar: string; } +export interface InterestScalarProtoMsg { + typeUrl: "/umee.leverage.v1.InterestScalar"; + value: Uint8Array; +} +/** + * InterestScalar is an interest scalar used in the leverage module's genesis + * state. + */ +export interface InterestScalarAmino { + denom?: string; + scalar?: string; +} +export interface InterestScalarAminoMsg { + type: "/umee.leverage.v1.InterestScalar"; + value: InterestScalarAmino; +} /** * InterestScalar is an interest scalar used in the leverage module's genesis * state. */ - export interface InterestScalarSDKType { denom: string; scalar: string; } - function createBaseGenesisState(): GenesisState { return { - params: undefined, + params: Params.fromPartial({}), registry: [], adjustedBorrows: [], collateral: [], reserves: [], - lastInterestTime: Long.ZERO, + lastInterestTime: BigInt(0), badDebts: [], interestScalars: [], - utokenSupply: [] + utokenSupply: [], + specialPairs: [] }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - for (const v of message.registry) { Token.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.adjustedBorrows) { AdjustedBorrow.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.collateral) { Collateral.encode(v!, writer.uint32(34).fork()).ldelim(); } - for (const v of message.reserves) { Coin.encode(v!, writer.uint32(42).fork()).ldelim(); } - - if (!message.lastInterestTime.isZero()) { + if (message.lastInterestTime !== BigInt(0)) { writer.uint32(48).int64(message.lastInterestTime); } - for (const v of message.badDebts) { BadDebt.encode(v!, writer.uint32(58).fork()).ldelim(); } - for (const v of message.interestScalars) { InterestScalar.encode(v!, writer.uint32(66).fork()).ldelim(); } - for (const v of message.utokenSupply) { Coin.encode(v!, writer.uint32(74).fork()).ldelim(); } - + for (const v of message.specialPairs) { + SpecialAssetPair.encode(v!, writer.uint32(82).fork()).ldelim(); + } return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.params = Params.decode(reader, reader.uint32()); break; - case 2: message.registry.push(Token.decode(reader, reader.uint32())); break; - case 3: message.adjustedBorrows.push(AdjustedBorrow.decode(reader, reader.uint32())); break; - case 4: message.collateral.push(Collateral.decode(reader, reader.uint32())); break; - case 5: message.reserves.push(Coin.decode(reader, reader.uint32())); break; - case 6: - message.lastInterestTime = (reader.int64() as Long); + message.lastInterestTime = reader.int64(); break; - case 7: message.badDebts.push(BadDebt.decode(reader, reader.uint32())); break; - case 8: message.interestScalars.push(InterestScalar.decode(reader, reader.uint32())); break; - case 9: message.utokenSupply.push(Coin.decode(reader, reader.uint32())); break; - + case 10: + message.specialPairs.push(SpecialAssetPair.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.registry = object.registry?.map(e => Token.fromPartial(e)) || []; message.adjustedBorrows = object.adjustedBorrows?.map(e => AdjustedBorrow.fromPartial(e)) || []; message.collateral = object.collateral?.map(e => Collateral.fromPartial(e)) || []; message.reserves = object.reserves?.map(e => Coin.fromPartial(e)) || []; - message.lastInterestTime = object.lastInterestTime !== undefined && object.lastInterestTime !== null ? Long.fromValue(object.lastInterestTime) : Long.ZERO; + message.lastInterestTime = object.lastInterestTime !== undefined && object.lastInterestTime !== null ? BigInt(object.lastInterestTime.toString()) : BigInt(0); message.badDebts = object.badDebts?.map(e => BadDebt.fromPartial(e)) || []; message.interestScalars = object.interestScalars?.map(e => InterestScalar.fromPartial(e)) || []; message.utokenSupply = object.utokenSupply?.map(e => Coin.fromPartial(e)) || []; + message.specialPairs = object.specialPairs?.map(e => SpecialAssetPair.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.registry = object.registry?.map(e => Token.fromAmino(e)) || []; + message.adjustedBorrows = object.adjusted_borrows?.map(e => AdjustedBorrow.fromAmino(e)) || []; + message.collateral = object.collateral?.map(e => Collateral.fromAmino(e)) || []; + message.reserves = object.reserves?.map(e => Coin.fromAmino(e)) || []; + if (object.last_interest_time !== undefined && object.last_interest_time !== null) { + message.lastInterestTime = BigInt(object.last_interest_time); + } + message.badDebts = object.bad_debts?.map(e => BadDebt.fromAmino(e)) || []; + message.interestScalars = object.interest_scalars?.map(e => InterestScalar.fromAmino(e)) || []; + message.utokenSupply = object.utoken_supply?.map(e => Coin.fromAmino(e)) || []; + message.specialPairs = object.special_pairs?.map(e => SpecialAssetPair.fromAmino(e)) || []; return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.registry) { + obj.registry = message.registry.map(e => e ? Token.toAmino(e) : undefined); + } else { + obj.registry = []; + } + if (message.adjustedBorrows) { + obj.adjusted_borrows = message.adjustedBorrows.map(e => e ? AdjustedBorrow.toAmino(e) : undefined); + } else { + obj.adjusted_borrows = []; + } + if (message.collateral) { + obj.collateral = message.collateral.map(e => e ? Collateral.toAmino(e) : undefined); + } else { + obj.collateral = []; + } + if (message.reserves) { + obj.reserves = message.reserves.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.reserves = []; + } + obj.last_interest_time = message.lastInterestTime ? message.lastInterestTime.toString() : undefined; + if (message.badDebts) { + obj.bad_debts = message.badDebts.map(e => e ? BadDebt.toAmino(e) : undefined); + } else { + obj.bad_debts = []; + } + if (message.interestScalars) { + obj.interest_scalars = message.interestScalars.map(e => e ? InterestScalar.toAmino(e) : undefined); + } else { + obj.interest_scalars = []; + } + if (message.utokenSupply) { + obj.utoken_supply = message.utokenSupply.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.utoken_supply = []; + } + if (message.specialPairs) { + obj.special_pairs = message.specialPairs.map(e => e ? SpecialAssetPair.toAmino(e) : undefined); + } else { + obj.special_pairs = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/umee.leverage.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; - function createBaseAdjustedBorrow(): AdjustedBorrow { return { address: "", - amount: undefined + amount: DecCoin.fromPartial({}) }; } - export const AdjustedBorrow = { - encode(message: AdjustedBorrow, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.AdjustedBorrow", + encode(message: AdjustedBorrow, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.amount !== undefined) { DecCoin.encode(message.amount, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AdjustedBorrow { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AdjustedBorrow { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAdjustedBorrow(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.amount = DecCoin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AdjustedBorrow { + fromPartial(object: Partial): AdjustedBorrow { const message = createBaseAdjustedBorrow(); message.address = object.address ?? ""; message.amount = object.amount !== undefined && object.amount !== null ? DecCoin.fromPartial(object.amount) : undefined; return message; + }, + fromAmino(object: AdjustedBorrowAmino): AdjustedBorrow { + const message = createBaseAdjustedBorrow(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = DecCoin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: AdjustedBorrow): AdjustedBorrowAmino { + const obj: any = {}; + obj.address = message.address; + obj.amount = message.amount ? DecCoin.toAmino(message.amount) : undefined; + return obj; + }, + fromAminoMsg(object: AdjustedBorrowAminoMsg): AdjustedBorrow { + return AdjustedBorrow.fromAmino(object.value); + }, + fromProtoMsg(message: AdjustedBorrowProtoMsg): AdjustedBorrow { + return AdjustedBorrow.decode(message.value); + }, + toProto(message: AdjustedBorrow): Uint8Array { + return AdjustedBorrow.encode(message).finish(); + }, + toProtoMsg(message: AdjustedBorrow): AdjustedBorrowProtoMsg { + return { + typeUrl: "/umee.leverage.v1.AdjustedBorrow", + value: AdjustedBorrow.encode(message).finish() + }; } - }; - function createBaseCollateral(): Collateral { return { address: "", - amount: undefined + amount: Coin.fromPartial({}) }; } - export const Collateral = { - encode(message: Collateral, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.Collateral", + encode(message: Collateral, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Collateral { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Collateral { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCollateral(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.amount = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Collateral { + fromPartial(object: Partial): Collateral { const message = createBaseCollateral(); message.address = object.address ?? ""; message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; + }, + fromAmino(object: CollateralAmino): Collateral { + const message = createBaseCollateral(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: Collateral): CollateralAmino { + const obj: any = {}; + obj.address = message.address; + obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + return obj; + }, + fromAminoMsg(object: CollateralAminoMsg): Collateral { + return Collateral.fromAmino(object.value); + }, + fromProtoMsg(message: CollateralProtoMsg): Collateral { + return Collateral.decode(message.value); + }, + toProto(message: Collateral): Uint8Array { + return Collateral.encode(message).finish(); + }, + toProtoMsg(message: Collateral): CollateralProtoMsg { + return { + typeUrl: "/umee.leverage.v1.Collateral", + value: Collateral.encode(message).finish() + }; } - }; - function createBaseBadDebt(): BadDebt { return { address: "", denom: "" }; } - export const BadDebt = { - encode(message: BadDebt, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.BadDebt", + encode(message: BadDebt, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.denom !== "") { writer.uint32(18).string(message.denom); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): BadDebt { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): BadDebt { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBadDebt(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - case 2: message.denom = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): BadDebt { + fromPartial(object: Partial): BadDebt { const message = createBaseBadDebt(); message.address = object.address ?? ""; message.denom = object.denom ?? ""; return message; + }, + fromAmino(object: BadDebtAmino): BadDebt { + const message = createBaseBadDebt(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: BadDebt): BadDebtAmino { + const obj: any = {}; + obj.address = message.address; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: BadDebtAminoMsg): BadDebt { + return BadDebt.fromAmino(object.value); + }, + fromProtoMsg(message: BadDebtProtoMsg): BadDebt { + return BadDebt.decode(message.value); + }, + toProto(message: BadDebt): Uint8Array { + return BadDebt.encode(message).finish(); + }, + toProtoMsg(message: BadDebt): BadDebtProtoMsg { + return { + typeUrl: "/umee.leverage.v1.BadDebt", + value: BadDebt.encode(message).finish() + }; } - }; - function createBaseInterestScalar(): InterestScalar { return { denom: "", scalar: "" }; } - export const InterestScalar = { - encode(message: InterestScalar, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.InterestScalar", + encode(message: InterestScalar, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.scalar !== "") { - writer.uint32(18).string(message.scalar); + writer.uint32(18).string(Decimal.fromUserInput(message.scalar, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InterestScalar { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): InterestScalar { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInterestScalar(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: - message.scalar = reader.string(); + message.scalar = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): InterestScalar { + fromPartial(object: Partial): InterestScalar { const message = createBaseInterestScalar(); message.denom = object.denom ?? ""; message.scalar = object.scalar ?? ""; return message; + }, + fromAmino(object: InterestScalarAmino): InterestScalar { + const message = createBaseInterestScalar(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.scalar !== undefined && object.scalar !== null) { + message.scalar = object.scalar; + } + return message; + }, + toAmino(message: InterestScalar): InterestScalarAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.scalar = message.scalar; + return obj; + }, + fromAminoMsg(object: InterestScalarAminoMsg): InterestScalar { + return InterestScalar.fromAmino(object.value); + }, + fromProtoMsg(message: InterestScalarProtoMsg): InterestScalar { + return InterestScalar.decode(message.value); + }, + toProto(message: InterestScalar): Uint8Array { + return InterestScalar.encode(message).finish(); + }, + toProtoMsg(message: InterestScalar): InterestScalarProtoMsg { + return { + typeUrl: "/umee.leverage.v1.InterestScalar", + value: InterestScalar.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/leverage.ts b/src/codegen/umee/leverage/v1/leverage.ts index 38cf317..126c78f 100644 --- a/src/codegen/umee/leverage/v1/leverage.ts +++ b/src/codegen/umee/leverage/v1/leverage.ts @@ -1,11 +1,6 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; -/** - * Params defines the parameters for the leverage module. - * See https://github.com/umee-network/umee/blob/main/docs/design_docs/010-market-params.md - * for more details. - */ - +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +/** Params defines the parameters for the leverage module. */ export interface Params { /** * Complete Liquidation Threshold determines how far between @@ -36,21 +31,18 @@ export interface Params { * * Valid values: 0-1. */ - minimumCloseFactor: string; /** * Oracle Reward Factor determines the portion of interest accrued on * borrows that is sent to the oracle module to fund its reward pool. * Valid values: 0-1. */ - oracleRewardFactor: string; /** * Small Liquidation Size determines the USD value at which a borrow is * considered small enough to be liquidated in a single transaction, bypassing * dynamic close factor. */ - smallLiquidationSize: string; /** * Direct Liquidation Fee is a reduction factor in liquidation incentive @@ -58,16 +50,14 @@ export interface Params { * uTokens as liquidation rewards. * Valid values: 0-1. */ - directLiquidationFee: string; } -/** - * Params defines the parameters for the leverage module. - * See https://github.com/umee-network/umee/blob/main/docs/design_docs/010-market-params.md - * for more details. - */ - -export interface ParamsSDKType { +export interface ParamsProtoMsg { + typeUrl: "/umee.leverage.v1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the leverage module. */ +export interface ParamsAmino { /** * Complete Liquidation Threshold determines how far between * liquidation_threshold (LT) and collateral_value (CV) a borrower's @@ -76,7 +66,7 @@ export interface ParamsSDKType { * See also `minimum_close_factor` for more information. * Valid values: 0-1. */ - complete_liquidation_threshold: string; + complete_liquidation_threshold?: string; /** * Close Factor determines the portion of a borrower's position that can be * liquidated in a single event. Minimum Close Factor is Close Factor at @@ -97,29 +87,37 @@ export interface ParamsSDKType { * * Valid values: 0-1. */ - - minimum_close_factor: string; + minimum_close_factor?: string; /** * Oracle Reward Factor determines the portion of interest accrued on * borrows that is sent to the oracle module to fund its reward pool. * Valid values: 0-1. */ - - oracle_reward_factor: string; + oracle_reward_factor?: string; /** * Small Liquidation Size determines the USD value at which a borrow is * considered small enough to be liquidated in a single transaction, bypassing * dynamic close factor. */ - - small_liquidation_size: string; + small_liquidation_size?: string; /** * Direct Liquidation Fee is a reduction factor in liquidation incentive * experienced by liquidators who choose to receive base assets instead of * uTokens as liquidation rewards. * Valid values: 0-1. */ - + direct_liquidation_fee?: string; +} +export interface ParamsAminoMsg { + type: "/umee.leverage.v1.Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the leverage module. */ +export interface ParamsSDKType { + complete_liquidation_threshold: string; + minimum_close_factor: string; + oracle_reward_factor: string; + small_liquidation_size: string; direct_liquidation_fee: string; } /** @@ -128,78 +126,72 @@ export interface ParamsSDKType { * See https://github.com/umee-network/umee/blob/main/docs/design_docs/010-market-params.md * for more details. */ - export interface Token { - /** Base Denom is the denomination of the underlying base token. */ + /** + * Base Denom is the denomination of the underlying base token. Must be the base + * denom as registered in the Bank module (so IBC denom for IBC tokens). + */ baseDenom: string; /** * Reserve Factor defines what portion of accrued interest goes to reserves * when this token is borrowed. * Valid values: 0-1. */ - reserveFactor: string; /** * Collateral Weight defines what portion of the total value of the asset * can contribute to a users borrowing power. If the collateral weight is * zero, using this asset as collateral against borrowing will be disabled. + * Must be smaller than `liquidation_threshold`. * Valid values: 0-1. */ - collateralWeight: string; /** * Liquidation Threshold defines what amount of the total value of the * asset as a collateral can contribute to a user's liquidation threshold * (above which they become eligible for liquidation). - * See also: min_close_factor. + * Must be bigger than `collateral_weight`. * Valid values: 0-1. + * See also: min_close_factor. */ - liquidationThreshold: string; /** * Base Borrow Rate defines the minimum interest rate for borrowing this * asset. * Valid values: 0-∞ */ - baseBorrowRate: string; /** * Kink Borrow Rate defines the interest rate for borrowing this * asset when supply utilization is equal to 'kink_utilization'. * Valid values: 0-∞ */ - kinkBorrowRate: string; /** * Max Borrow Rate defines the interest rate for borrowing this * asset when supply utilization is at its maximum. * Valid values: 0-∞ */ - maxBorrowRate: string; /** * Kink Utilization defines the supply utilization value where * the kink in the borrow interest rate function occurs. * Valid values: 0-1. */ - kinkUtilization: string; /** * Liquidation Incentive determines the portion of bonus collateral of * a token type liquidators receive as a liquidation reward. * Valid values: 0-1. */ - liquidationIncentive: string; /** Symbol Denom is the human readable denomination of this token. */ - symbolDenom: string; /** * Exponent is the power of ten by which to multiply, in order to convert * an amount of the token denoted in its symbol denom to the actual amount * of its base denom. */ - exponent: number; /** * Enable Msg Supply allows supplying for lending or collateral using this @@ -207,7 +199,6 @@ export interface Token { * Note that withdrawing is always enabled. Disabling supply would * be one step in phasing out an asset type. */ - enableMsgSupply: boolean; /** * Enable Msg Borrow allows borrowing of this token. Note that repaying is @@ -215,7 +206,6 @@ export interface Token { * asset type, but could also be used from the start for asset types meant * to be collateral only, like meTokens. */ - enableMsgBorrow: boolean; /** * Blacklist should only be used to eliminate an asset completely. A blacklisted @@ -225,7 +215,6 @@ export interface Token { * and enable_msg_borrow set to false. Such tokens can be safely removed from the * oracle and price feeder as well. */ - blacklist: boolean; /** * Max Collateral Share specifies how much of the system's overall collateral @@ -233,7 +222,6 @@ export interface Token { * 0.1 means maximum 10% of system's total collateral value can be provided by this token. * Valid values: 0-1. */ - maxCollateralShare: string; /** * Max Supply Utilization specifies the maximum supply utilization a token is @@ -242,7 +230,6 @@ export interface Token { * supply_utilization(token) = total_borrowed(token) / total_supply(token) * Valid values: 0-1. */ - maxSupplyUtilization: string; /** * Min Collateral Liquidity specifies min limit for the following function: @@ -250,9 +237,11 @@ export interface Token { * Borrowing, collateralizing, or withdrawing assets is not allowed when the * result of such action invalidates min_collateral_liquidity. * Liquidity can only drop below this value due to interest or liquidations. - * Valid values: 0 - 1 + * The goal is to assure that there is enough available (not borrowed) token to be available + * for withdraw when there is a collateral liquidation and the liquidator needs to + * withdraw uToken. + * Valid values: 0 - inf */ - minCollateralLiquidity: string; /** * Max Supply is the maximum amount of tokens the protocol can hold. @@ -260,8 +249,22 @@ export interface Token { * Must be a non negative value. 0 means that there is no limit. * To mark a token as not valid for supply, `msg_supply` must be set to false. */ - maxSupply: string; + /** + * Historic Medians is the number of median historic prices to request from + * the oracle module when evaluating new borrow positions containing this token. + * All MsgBorrow, MsgWithdraw, and MsgDecollateralize must result in healthy + * borrow positions under both current and historic prices. The default value of + * zero for this field causes current price to be used in those calculations + * for the affected Token. + * The time span covered by the historic median will be: + * oracle.Params.median_stamp_period * oracle.Params.historic_stamp_period * historic_medians. + */ + historicMedians: number; +} +export interface TokenProtoMsg { + typeUrl: "/umee.leverage.v1.Token"; + value: Uint8Array; } /** * Token defines a token, along with its metadata and parameters, in the Umee @@ -269,95 +272,87 @@ export interface Token { * See https://github.com/umee-network/umee/blob/main/docs/design_docs/010-market-params.md * for more details. */ - -export interface TokenSDKType { - /** Base Denom is the denomination of the underlying base token. */ - base_denom: string; +export interface TokenAmino { + /** + * Base Denom is the denomination of the underlying base token. Must be the base + * denom as registered in the Bank module (so IBC denom for IBC tokens). + */ + base_denom?: string; /** * Reserve Factor defines what portion of accrued interest goes to reserves * when this token is borrowed. * Valid values: 0-1. */ - - reserve_factor: string; + reserve_factor?: string; /** * Collateral Weight defines what portion of the total value of the asset * can contribute to a users borrowing power. If the collateral weight is * zero, using this asset as collateral against borrowing will be disabled. + * Must be smaller than `liquidation_threshold`. * Valid values: 0-1. */ - - collateral_weight: string; + collateral_weight?: string; /** * Liquidation Threshold defines what amount of the total value of the * asset as a collateral can contribute to a user's liquidation threshold * (above which they become eligible for liquidation). - * See also: min_close_factor. + * Must be bigger than `collateral_weight`. * Valid values: 0-1. + * See also: min_close_factor. */ - - liquidation_threshold: string; + liquidation_threshold?: string; /** * Base Borrow Rate defines the minimum interest rate for borrowing this * asset. * Valid values: 0-∞ */ - - base_borrow_rate: string; + base_borrow_rate?: string; /** * Kink Borrow Rate defines the interest rate for borrowing this * asset when supply utilization is equal to 'kink_utilization'. * Valid values: 0-∞ */ - - kink_borrow_rate: string; + kink_borrow_rate?: string; /** * Max Borrow Rate defines the interest rate for borrowing this * asset when supply utilization is at its maximum. * Valid values: 0-∞ */ - - max_borrow_rate: string; + max_borrow_rate?: string; /** * Kink Utilization defines the supply utilization value where * the kink in the borrow interest rate function occurs. * Valid values: 0-1. */ - - kink_utilization: string; + kink_utilization?: string; /** * Liquidation Incentive determines the portion of bonus collateral of * a token type liquidators receive as a liquidation reward. * Valid values: 0-1. */ - - liquidation_incentive: string; + liquidation_incentive?: string; /** Symbol Denom is the human readable denomination of this token. */ - - symbol_denom: string; + symbol_denom?: string; /** * Exponent is the power of ten by which to multiply, in order to convert * an amount of the token denoted in its symbol denom to the actual amount * of its base denom. */ - - exponent: number; + exponent?: number; /** * Enable Msg Supply allows supplying for lending or collateral using this * token. `false` means that a token can no longer be supplied. * Note that withdrawing is always enabled. Disabling supply would * be one step in phasing out an asset type. */ - - enable_msg_supply: boolean; + enable_msg_supply?: boolean; /** * Enable Msg Borrow allows borrowing of this token. Note that repaying is * always enabled. Disabling borrowing would be one step in phasing out an * asset type, but could also be used from the start for asset types meant * to be collateral only, like meTokens. */ - - enable_msg_borrow: boolean; + enable_msg_borrow?: boolean; /** * Blacklist should only be used to eliminate an asset completely. A blacklisted * asset is treated as though its oracle price is zero, and thus ignored by @@ -366,16 +361,14 @@ export interface TokenSDKType { * and enable_msg_borrow set to false. Such tokens can be safely removed from the * oracle and price feeder as well. */ - - blacklist: boolean; + blacklist?: boolean; /** * Max Collateral Share specifies how much of the system's overall collateral * can be provided by a given token. 1.0 means that the token has no restriction. * 0.1 means maximum 10% of system's total collateral value can be provided by this token. * Valid values: 0-1. */ - - max_collateral_share: string; + max_collateral_share?: string; /** * Max Supply Utilization specifies the maximum supply utilization a token is * allowed to reach as a direct result of user borrowing. New borrows are not allowed when @@ -383,28 +376,193 @@ export interface TokenSDKType { * supply_utilization(token) = total_borrowed(token) / total_supply(token) * Valid values: 0-1. */ - - max_supply_utilization: string; + max_supply_utilization?: string; /** * Min Collateral Liquidity specifies min limit for the following function: * collateral_liquidity(token) = available(token) / total_collateral(token) * Borrowing, collateralizing, or withdrawing assets is not allowed when the * result of such action invalidates min_collateral_liquidity. * Liquidity can only drop below this value due to interest or liquidations. - * Valid values: 0 - 1 + * The goal is to assure that there is enough available (not borrowed) token to be available + * for withdraw when there is a collateral liquidation and the liquidator needs to + * withdraw uToken. + * Valid values: 0 - inf */ - - min_collateral_liquidity: string; + min_collateral_liquidity?: string; /** * Max Supply is the maximum amount of tokens the protocol can hold. * Adding more supply of the given token to the protocol will return an error. * Must be a non negative value. 0 means that there is no limit. * To mark a token as not valid for supply, `msg_supply` must be set to false. */ - + max_supply?: string; + /** + * Historic Medians is the number of median historic prices to request from + * the oracle module when evaluating new borrow positions containing this token. + * All MsgBorrow, MsgWithdraw, and MsgDecollateralize must result in healthy + * borrow positions under both current and historic prices. The default value of + * zero for this field causes current price to be used in those calculations + * for the affected Token. + * The time span covered by the historic median will be: + * oracle.Params.median_stamp_period * oracle.Params.historic_stamp_period * historic_medians. + */ + historic_medians?: number; +} +export interface TokenAminoMsg { + type: "/umee.leverage.v1.Token"; + value: TokenAmino; +} +/** + * Token defines a token, along with its metadata and parameters, in the Umee + * capital facility that can be supplied and borrowed. + * See https://github.com/umee-network/umee/blob/main/docs/design_docs/010-market-params.md + * for more details. + */ +export interface TokenSDKType { + base_denom: string; + reserve_factor: string; + collateral_weight: string; + liquidation_threshold: string; + base_borrow_rate: string; + kink_borrow_rate: string; + max_borrow_rate: string; + kink_utilization: string; + liquidation_incentive: string; + symbol_denom: string; + exponent: number; + enable_msg_supply: boolean; + enable_msg_borrow: boolean; + blacklist: boolean; + max_collateral_share: string; + max_supply_utilization: string; + min_collateral_liquidity: string; max_supply: string; + historic_medians: number; +} +/** + * SpecialAssetPair defines a special (increased) CollateralWeight used when a specified Collateral is used + * to collateralize a specified Borrow. This association is one-way (so it does not work in reverse). + */ +export interface SpecialAssetPair { + /** Collateral base token denom. */ + collateral: string; + /** Borrow base token denom. */ + borrow: string; + /** + * Collateral Weight defines what portion of the total value of the asset + * can contribute to a users borrowing power. For special asset pairs, this + * also overrides the borrowed asset's collateral weight when evaluating borrow + * factor. Valid values: 0-1. + */ + collateralWeight: string; + /** + * Liquidation threshold defines what portion of the total value of the assets + * can contribute to a users liquidation threshold, when borrowing within the pair. + * Valid values in range [collateral_weight,1] + */ + liquidationThreshold: string; +} +export interface SpecialAssetPairProtoMsg { + typeUrl: "/umee.leverage.v1.SpecialAssetPair"; + value: Uint8Array; +} +/** + * SpecialAssetPair defines a special (increased) CollateralWeight used when a specified Collateral is used + * to collateralize a specified Borrow. This association is one-way (so it does not work in reverse). + */ +export interface SpecialAssetPairAmino { + /** Collateral base token denom. */ + collateral?: string; + /** Borrow base token denom. */ + borrow?: string; + /** + * Collateral Weight defines what portion of the total value of the asset + * can contribute to a users borrowing power. For special asset pairs, this + * also overrides the borrowed asset's collateral weight when evaluating borrow + * factor. Valid values: 0-1. + */ + collateral_weight?: string; + /** + * Liquidation threshold defines what portion of the total value of the assets + * can contribute to a users liquidation threshold, when borrowing within the pair. + * Valid values in range [collateral_weight,1] + */ + liquidation_threshold?: string; +} +export interface SpecialAssetPairAminoMsg { + type: "/umee.leverage.v1.SpecialAssetPair"; + value: SpecialAssetPairAmino; +} +/** + * SpecialAssetPair defines a special (increased) CollateralWeight used when a specified Collateral is used + * to collateralize a specified Borrow. This association is one-way (so it does not work in reverse). + */ +export interface SpecialAssetPairSDKType { + collateral: string; + borrow: string; + collateral_weight: string; + liquidation_threshold: string; +} +/** + * SpecialAssetSet defines a special (increased) CollateralWeight used when any of a set + * of assets are used to borrow each other (except for looping). It is used in gov proposals + * to create all the pairs that make up a set at once. + */ +export interface SpecialAssetSet { + /** Collateral or borrowed base token denoms. */ + assets: string[]; + /** + * Collateral Weight defines what portion of the total value of the assets + * can contribute to a users borrowing power, when borrowing within the set. + * Valid values: 0-1. + */ + collateralWeight: string; + /** + * Liquidation threshold defines what portion of the total value of the assets + * can contribute to a users liquidation threshold, when borrowing within the set. + * Valid values in range [collateral_weight,1] + */ + liquidationThreshold: string; +} +export interface SpecialAssetSetProtoMsg { + typeUrl: "/umee.leverage.v1.SpecialAssetSet"; + value: Uint8Array; +} +/** + * SpecialAssetSet defines a special (increased) CollateralWeight used when any of a set + * of assets are used to borrow each other (except for looping). It is used in gov proposals + * to create all the pairs that make up a set at once. + */ +export interface SpecialAssetSetAmino { + /** Collateral or borrowed base token denoms. */ + assets?: string[]; + /** + * Collateral Weight defines what portion of the total value of the assets + * can contribute to a users borrowing power, when borrowing within the set. + * Valid values: 0-1. + */ + collateral_weight?: string; + /** + * Liquidation threshold defines what portion of the total value of the assets + * can contribute to a users liquidation threshold, when borrowing within the set. + * Valid values in range [collateral_weight,1] + */ + liquidation_threshold?: string; +} +export interface SpecialAssetSetAminoMsg { + type: "/umee.leverage.v1.SpecialAssetSet"; + value: SpecialAssetSetAmino; +} +/** + * SpecialAssetSet defines a special (increased) CollateralWeight used when any of a set + * of assets are used to borrow each other (except for looping). It is used in gov proposals + * to create all the pairs that make up a set at once. + */ +export interface SpecialAssetSetSDKType { + assets: string[]; + collateral_weight: string; + liquidation_threshold: string; } - function createBaseParams(): Params { return { completeLiquidationThreshold: "", @@ -414,71 +572,56 @@ function createBaseParams(): Params { directLiquidationFee: "" }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.completeLiquidationThreshold !== "") { - writer.uint32(18).string(message.completeLiquidationThreshold); + writer.uint32(18).string(Decimal.fromUserInput(message.completeLiquidationThreshold, 18).atomics); } - if (message.minimumCloseFactor !== "") { - writer.uint32(26).string(message.minimumCloseFactor); + writer.uint32(26).string(Decimal.fromUserInput(message.minimumCloseFactor, 18).atomics); } - if (message.oracleRewardFactor !== "") { - writer.uint32(34).string(message.oracleRewardFactor); + writer.uint32(34).string(Decimal.fromUserInput(message.oracleRewardFactor, 18).atomics); } - if (message.smallLiquidationSize !== "") { - writer.uint32(42).string(message.smallLiquidationSize); + writer.uint32(42).string(Decimal.fromUserInput(message.smallLiquidationSize, 18).atomics); } - if (message.directLiquidationFee !== "") { - writer.uint32(50).string(message.directLiquidationFee); + writer.uint32(50).string(Decimal.fromUserInput(message.directLiquidationFee, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 2: - message.completeLiquidationThreshold = reader.string(); + message.completeLiquidationThreshold = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 3: - message.minimumCloseFactor = reader.string(); + message.minimumCloseFactor = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 4: - message.oracleRewardFactor = reader.string(); + message.oracleRewardFactor = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 5: - message.smallLiquidationSize = reader.string(); + message.smallLiquidationSize = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 6: - message.directLiquidationFee = reader.string(); + message.directLiquidationFee = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); message.completeLiquidationThreshold = object.completeLiquidationThreshold ?? ""; message.minimumCloseFactor = object.minimumCloseFactor ?? ""; @@ -486,10 +629,51 @@ export const Params = { message.smallLiquidationSize = object.smallLiquidationSize ?? ""; message.directLiquidationFee = object.directLiquidationFee ?? ""; return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.complete_liquidation_threshold !== undefined && object.complete_liquidation_threshold !== null) { + message.completeLiquidationThreshold = object.complete_liquidation_threshold; + } + if (object.minimum_close_factor !== undefined && object.minimum_close_factor !== null) { + message.minimumCloseFactor = object.minimum_close_factor; + } + if (object.oracle_reward_factor !== undefined && object.oracle_reward_factor !== null) { + message.oracleRewardFactor = object.oracle_reward_factor; + } + if (object.small_liquidation_size !== undefined && object.small_liquidation_size !== null) { + message.smallLiquidationSize = object.small_liquidation_size; + } + if (object.direct_liquidation_fee !== undefined && object.direct_liquidation_fee !== null) { + message.directLiquidationFee = object.direct_liquidation_fee; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.complete_liquidation_threshold = message.completeLiquidationThreshold; + obj.minimum_close_factor = message.minimumCloseFactor; + obj.oracle_reward_factor = message.oracleRewardFactor; + obj.small_liquidation_size = message.smallLiquidationSize; + obj.direct_liquidation_fee = message.directLiquidationFee; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/umee.leverage.v1.Params", + value: Params.encode(message).finish() + }; } - }; - function createBaseToken(): Token { return { baseDenom: "", @@ -509,178 +693,144 @@ function createBaseToken(): Token { maxCollateralShare: "", maxSupplyUtilization: "", minCollateralLiquidity: "", - maxSupply: "" + maxSupply: "", + historicMedians: 0 }; } - export const Token = { - encode(message: Token, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.Token", + encode(message: Token, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseDenom !== "") { writer.uint32(10).string(message.baseDenom); } - if (message.reserveFactor !== "") { - writer.uint32(18).string(message.reserveFactor); + writer.uint32(18).string(Decimal.fromUserInput(message.reserveFactor, 18).atomics); } - if (message.collateralWeight !== "") { - writer.uint32(26).string(message.collateralWeight); + writer.uint32(26).string(Decimal.fromUserInput(message.collateralWeight, 18).atomics); } - if (message.liquidationThreshold !== "") { - writer.uint32(34).string(message.liquidationThreshold); + writer.uint32(34).string(Decimal.fromUserInput(message.liquidationThreshold, 18).atomics); } - if (message.baseBorrowRate !== "") { - writer.uint32(42).string(message.baseBorrowRate); + writer.uint32(42).string(Decimal.fromUserInput(message.baseBorrowRate, 18).atomics); } - if (message.kinkBorrowRate !== "") { - writer.uint32(50).string(message.kinkBorrowRate); + writer.uint32(50).string(Decimal.fromUserInput(message.kinkBorrowRate, 18).atomics); } - if (message.maxBorrowRate !== "") { - writer.uint32(58).string(message.maxBorrowRate); + writer.uint32(58).string(Decimal.fromUserInput(message.maxBorrowRate, 18).atomics); } - if (message.kinkUtilization !== "") { - writer.uint32(66).string(message.kinkUtilization); + writer.uint32(66).string(Decimal.fromUserInput(message.kinkUtilization, 18).atomics); } - if (message.liquidationIncentive !== "") { - writer.uint32(74).string(message.liquidationIncentive); + writer.uint32(74).string(Decimal.fromUserInput(message.liquidationIncentive, 18).atomics); } - if (message.symbolDenom !== "") { writer.uint32(82).string(message.symbolDenom); } - if (message.exponent !== 0) { writer.uint32(88).uint32(message.exponent); } - if (message.enableMsgSupply === true) { writer.uint32(96).bool(message.enableMsgSupply); } - if (message.enableMsgBorrow === true) { writer.uint32(104).bool(message.enableMsgBorrow); } - if (message.blacklist === true) { writer.uint32(112).bool(message.blacklist); } - if (message.maxCollateralShare !== "") { - writer.uint32(122).string(message.maxCollateralShare); + writer.uint32(122).string(Decimal.fromUserInput(message.maxCollateralShare, 18).atomics); } - if (message.maxSupplyUtilization !== "") { - writer.uint32(130).string(message.maxSupplyUtilization); + writer.uint32(130).string(Decimal.fromUserInput(message.maxSupplyUtilization, 18).atomics); } - if (message.minCollateralLiquidity !== "") { - writer.uint32(138).string(message.minCollateralLiquidity); + writer.uint32(138).string(Decimal.fromUserInput(message.minCollateralLiquidity, 18).atomics); } - if (message.maxSupply !== "") { writer.uint32(146).string(message.maxSupply); } - + if (message.historicMedians !== 0) { + writer.uint32(152).uint32(message.historicMedians); + } return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Token { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Token { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseToken(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.baseDenom = reader.string(); break; - case 2: - message.reserveFactor = reader.string(); + message.reserveFactor = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 3: - message.collateralWeight = reader.string(); + message.collateralWeight = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 4: - message.liquidationThreshold = reader.string(); + message.liquidationThreshold = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 5: - message.baseBorrowRate = reader.string(); + message.baseBorrowRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 6: - message.kinkBorrowRate = reader.string(); + message.kinkBorrowRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 7: - message.maxBorrowRate = reader.string(); + message.maxBorrowRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 8: - message.kinkUtilization = reader.string(); + message.kinkUtilization = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 9: - message.liquidationIncentive = reader.string(); + message.liquidationIncentive = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 10: message.symbolDenom = reader.string(); break; - case 11: message.exponent = reader.uint32(); break; - case 12: message.enableMsgSupply = reader.bool(); break; - case 13: message.enableMsgBorrow = reader.bool(); break; - case 14: message.blacklist = reader.bool(); break; - case 15: - message.maxCollateralShare = reader.string(); + message.maxCollateralShare = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 16: - message.maxSupplyUtilization = reader.string(); + message.maxSupplyUtilization = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 17: - message.minCollateralLiquidity = reader.string(); + message.minCollateralLiquidity = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 18: message.maxSupply = reader.string(); break; - + case 19: + message.historicMedians = reader.uint32(); + break; default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Token { + fromPartial(object: Partial): Token { const message = createBaseToken(); message.baseDenom = object.baseDenom ?? ""; message.reserveFactor = object.reserveFactor ?? ""; @@ -700,7 +850,294 @@ export const Token = { message.maxSupplyUtilization = object.maxSupplyUtilization ?? ""; message.minCollateralLiquidity = object.minCollateralLiquidity ?? ""; message.maxSupply = object.maxSupply ?? ""; + message.historicMedians = object.historicMedians ?? 0; + return message; + }, + fromAmino(object: TokenAmino): Token { + const message = createBaseToken(); + if (object.base_denom !== undefined && object.base_denom !== null) { + message.baseDenom = object.base_denom; + } + if (object.reserve_factor !== undefined && object.reserve_factor !== null) { + message.reserveFactor = object.reserve_factor; + } + if (object.collateral_weight !== undefined && object.collateral_weight !== null) { + message.collateralWeight = object.collateral_weight; + } + if (object.liquidation_threshold !== undefined && object.liquidation_threshold !== null) { + message.liquidationThreshold = object.liquidation_threshold; + } + if (object.base_borrow_rate !== undefined && object.base_borrow_rate !== null) { + message.baseBorrowRate = object.base_borrow_rate; + } + if (object.kink_borrow_rate !== undefined && object.kink_borrow_rate !== null) { + message.kinkBorrowRate = object.kink_borrow_rate; + } + if (object.max_borrow_rate !== undefined && object.max_borrow_rate !== null) { + message.maxBorrowRate = object.max_borrow_rate; + } + if (object.kink_utilization !== undefined && object.kink_utilization !== null) { + message.kinkUtilization = object.kink_utilization; + } + if (object.liquidation_incentive !== undefined && object.liquidation_incentive !== null) { + message.liquidationIncentive = object.liquidation_incentive; + } + if (object.symbol_denom !== undefined && object.symbol_denom !== null) { + message.symbolDenom = object.symbol_denom; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + if (object.enable_msg_supply !== undefined && object.enable_msg_supply !== null) { + message.enableMsgSupply = object.enable_msg_supply; + } + if (object.enable_msg_borrow !== undefined && object.enable_msg_borrow !== null) { + message.enableMsgBorrow = object.enable_msg_borrow; + } + if (object.blacklist !== undefined && object.blacklist !== null) { + message.blacklist = object.blacklist; + } + if (object.max_collateral_share !== undefined && object.max_collateral_share !== null) { + message.maxCollateralShare = object.max_collateral_share; + } + if (object.max_supply_utilization !== undefined && object.max_supply_utilization !== null) { + message.maxSupplyUtilization = object.max_supply_utilization; + } + if (object.min_collateral_liquidity !== undefined && object.min_collateral_liquidity !== null) { + message.minCollateralLiquidity = object.min_collateral_liquidity; + } + if (object.max_supply !== undefined && object.max_supply !== null) { + message.maxSupply = object.max_supply; + } + if (object.historic_medians !== undefined && object.historic_medians !== null) { + message.historicMedians = object.historic_medians; + } + return message; + }, + toAmino(message: Token): TokenAmino { + const obj: any = {}; + obj.base_denom = message.baseDenom; + obj.reserve_factor = message.reserveFactor; + obj.collateral_weight = message.collateralWeight; + obj.liquidation_threshold = message.liquidationThreshold; + obj.base_borrow_rate = message.baseBorrowRate; + obj.kink_borrow_rate = message.kinkBorrowRate; + obj.max_borrow_rate = message.maxBorrowRate; + obj.kink_utilization = message.kinkUtilization; + obj.liquidation_incentive = message.liquidationIncentive; + obj.symbol_denom = message.symbolDenom; + obj.exponent = message.exponent; + obj.enable_msg_supply = message.enableMsgSupply; + obj.enable_msg_borrow = message.enableMsgBorrow; + obj.blacklist = message.blacklist; + obj.max_collateral_share = message.maxCollateralShare; + obj.max_supply_utilization = message.maxSupplyUtilization; + obj.min_collateral_liquidity = message.minCollateralLiquidity; + obj.max_supply = message.maxSupply; + obj.historic_medians = message.historicMedians; + return obj; + }, + fromAminoMsg(object: TokenAminoMsg): Token { + return Token.fromAmino(object.value); + }, + fromProtoMsg(message: TokenProtoMsg): Token { + return Token.decode(message.value); + }, + toProto(message: Token): Uint8Array { + return Token.encode(message).finish(); + }, + toProtoMsg(message: Token): TokenProtoMsg { + return { + typeUrl: "/umee.leverage.v1.Token", + value: Token.encode(message).finish() + }; + } +}; +function createBaseSpecialAssetPair(): SpecialAssetPair { + return { + collateral: "", + borrow: "", + collateralWeight: "", + liquidationThreshold: "" + }; +} +export const SpecialAssetPair = { + typeUrl: "/umee.leverage.v1.SpecialAssetPair", + encode(message: SpecialAssetPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.collateral !== "") { + writer.uint32(10).string(message.collateral); + } + if (message.borrow !== "") { + writer.uint32(18).string(message.borrow); + } + if (message.collateralWeight !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.collateralWeight, 18).atomics); + } + if (message.liquidationThreshold !== "") { + writer.uint32(34).string(Decimal.fromUserInput(message.liquidationThreshold, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SpecialAssetPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSpecialAssetPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.collateral = reader.string(); + break; + case 2: + message.borrow = reader.string(); + break; + case 3: + message.collateralWeight = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 4: + message.liquidationThreshold = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): SpecialAssetPair { + const message = createBaseSpecialAssetPair(); + message.collateral = object.collateral ?? ""; + message.borrow = object.borrow ?? ""; + message.collateralWeight = object.collateralWeight ?? ""; + message.liquidationThreshold = object.liquidationThreshold ?? ""; + return message; + }, + fromAmino(object: SpecialAssetPairAmino): SpecialAssetPair { + const message = createBaseSpecialAssetPair(); + if (object.collateral !== undefined && object.collateral !== null) { + message.collateral = object.collateral; + } + if (object.borrow !== undefined && object.borrow !== null) { + message.borrow = object.borrow; + } + if (object.collateral_weight !== undefined && object.collateral_weight !== null) { + message.collateralWeight = object.collateral_weight; + } + if (object.liquidation_threshold !== undefined && object.liquidation_threshold !== null) { + message.liquidationThreshold = object.liquidation_threshold; + } return message; + }, + toAmino(message: SpecialAssetPair): SpecialAssetPairAmino { + const obj: any = {}; + obj.collateral = message.collateral; + obj.borrow = message.borrow; + obj.collateral_weight = message.collateralWeight; + obj.liquidation_threshold = message.liquidationThreshold; + return obj; + }, + fromAminoMsg(object: SpecialAssetPairAminoMsg): SpecialAssetPair { + return SpecialAssetPair.fromAmino(object.value); + }, + fromProtoMsg(message: SpecialAssetPairProtoMsg): SpecialAssetPair { + return SpecialAssetPair.decode(message.value); + }, + toProto(message: SpecialAssetPair): Uint8Array { + return SpecialAssetPair.encode(message).finish(); + }, + toProtoMsg(message: SpecialAssetPair): SpecialAssetPairProtoMsg { + return { + typeUrl: "/umee.leverage.v1.SpecialAssetPair", + value: SpecialAssetPair.encode(message).finish() + }; + } +}; +function createBaseSpecialAssetSet(): SpecialAssetSet { + return { + assets: [], + collateralWeight: "", + liquidationThreshold: "" + }; +} +export const SpecialAssetSet = { + typeUrl: "/umee.leverage.v1.SpecialAssetSet", + encode(message: SpecialAssetSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.assets) { + writer.uint32(10).string(v!); + } + if (message.collateralWeight !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.collateralWeight, 18).atomics); + } + if (message.liquidationThreshold !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.liquidationThreshold, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SpecialAssetSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSpecialAssetSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.assets.push(reader.string()); + break; + case 2: + message.collateralWeight = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.liquidationThreshold = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): SpecialAssetSet { + const message = createBaseSpecialAssetSet(); + message.assets = object.assets?.map(e => e) || []; + message.collateralWeight = object.collateralWeight ?? ""; + message.liquidationThreshold = object.liquidationThreshold ?? ""; + return message; + }, + fromAmino(object: SpecialAssetSetAmino): SpecialAssetSet { + const message = createBaseSpecialAssetSet(); + message.assets = object.assets?.map(e => e) || []; + if (object.collateral_weight !== undefined && object.collateral_weight !== null) { + message.collateralWeight = object.collateral_weight; + } + if (object.liquidation_threshold !== undefined && object.liquidation_threshold !== null) { + message.liquidationThreshold = object.liquidation_threshold; + } + return message; + }, + toAmino(message: SpecialAssetSet): SpecialAssetSetAmino { + const obj: any = {}; + if (message.assets) { + obj.assets = message.assets.map(e => e); + } else { + obj.assets = []; + } + obj.collateral_weight = message.collateralWeight; + obj.liquidation_threshold = message.liquidationThreshold; + return obj; + }, + fromAminoMsg(object: SpecialAssetSetAminoMsg): SpecialAssetSet { + return SpecialAssetSet.fromAmino(object.value); + }, + fromProtoMsg(message: SpecialAssetSetProtoMsg): SpecialAssetSet { + return SpecialAssetSet.decode(message.value); + }, + toProto(message: SpecialAssetSet): Uint8Array { + return SpecialAssetSet.encode(message).finish(); + }, + toProtoMsg(message: SpecialAssetSet): SpecialAssetSetProtoMsg { + return { + typeUrl: "/umee.leverage.v1.SpecialAssetSet", + value: SpecialAssetSet.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/query.lcd.ts b/src/codegen/umee/leverage/v1/query.lcd.ts index 5106ea0..219e67a 100644 --- a/src/codegen/umee/leverage/v1/query.lcd.ts +++ b/src/codegen/umee/leverage/v1/query.lcd.ts @@ -1,8 +1,7 @@ -import { LCDClient } from "@osmonauts/lcd"; -import { QueryParams, QueryParamsResponseSDKType, QueryRegisteredTokens, QueryRegisteredTokensResponseSDKType, QueryMarketSummary, QueryMarketSummaryResponseSDKType, QueryAccountBalances, QueryAccountBalancesResponseSDKType, QueryAccountSummary, QueryAccountSummaryResponseSDKType, QueryLiquidationTargets, QueryLiquidationTargetsResponseSDKType, QueryBadDebts, QueryBadDebtsResponseSDKType } from "./query"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryParams, QueryParamsResponseSDKType, QueryRegisteredTokens, QueryRegisteredTokensResponseSDKType, QuerySpecialAssets, QuerySpecialAssetsResponseSDKType, QueryMarketSummary, QueryMarketSummaryResponseSDKType, QueryAccountBalances, QueryAccountBalancesResponseSDKType, QueryAccountSummary, QueryAccountSummaryResponseSDKType, QueryLiquidationTargets, QueryLiquidationTargetsResponseSDKType, QueryBadDebts, QueryBadDebtsResponseSDKType, QueryMaxWithdraw, QueryMaxWithdrawResponseSDKType, QueryMaxBorrow, QueryMaxBorrowResponseSDKType, QueryInspect, QueryInspectResponseSDKType, QueryInspectAccount, QueryInspectAccountResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -11,84 +10,152 @@ export class LCDQueryClient { this.req = requestClient; this.params = this.params.bind(this); this.registeredTokens = this.registeredTokens.bind(this); + this.specialAssets = this.specialAssets.bind(this); this.marketSummary = this.marketSummary.bind(this); this.accountBalances = this.accountBalances.bind(this); this.accountSummary = this.accountSummary.bind(this); this.liquidationTargets = this.liquidationTargets.bind(this); this.badDebts = this.badDebts.bind(this); + this.maxWithdraw = this.maxWithdraw.bind(this); + this.maxBorrow = this.maxBorrow.bind(this); + this.inspect = this.inspect.bind(this); + this.inspectAccount = this.inspectAccount.bind(this); } /* Params queries the parameters of the x/leverage module. */ - - async params(_params: QueryParams = {}): Promise { const endpoint = `umee/leverage/v1/params`; return await this.req.get(endpoint); } /* RegisteredTokens queries for all the registered tokens. */ - - - async registeredTokens(_params: QueryRegisteredTokens = {}): Promise { + async registeredTokens(params: QueryRegisteredTokens): Promise { + const options: any = { + params: {} + }; + if (typeof params?.baseDenom !== "undefined") { + options.params.base_denom = params.baseDenom; + } const endpoint = `umee/leverage/v1/registered_tokens`; - return await this.req.get(endpoint); + return await this.req.get(endpoint, options); + } + /* SpecialAssets queries for all special asset pairs. */ + async specialAssets(params: QuerySpecialAssets): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/leverage/v1/special_assets`; + return await this.req.get(endpoint, options); } /* MarketSummary queries a base asset's current borrowing and supplying conditions. */ - - async marketSummary(params: QueryMarketSummary): Promise { const options: any = { params: {} }; - if (typeof params?.denom !== "undefined") { options.params.denom = params.denom; } - const endpoint = `umee/leverage/v1/market_summary`; return await this.req.get(endpoint, options); } /* AccountBalances queries an account's current supply, collateral, and borrow positions. */ - - async accountBalances(params: QueryAccountBalances): Promise { const options: any = { params: {} }; - if (typeof params?.address !== "undefined") { options.params.address = params.address; } - const endpoint = `umee/leverage/v1/account_balances`; return await this.req.get(endpoint, options); } /* AccountSummary queries USD values representing an account's total positions and borrowing limits. It requires oracle prices to return successfully. */ - - async accountSummary(params: QueryAccountSummary): Promise { const options: any = { params: {} }; - if (typeof params?.address !== "undefined") { options.params.address = params.address; } - const endpoint = `umee/leverage/v1/account_summary`; return await this.req.get(endpoint, options); } /* LiquidationTargets queries a list of all borrower account addresses eligible for liquidation. */ - - async liquidationTargets(_params: QueryLiquidationTargets = {}): Promise { const endpoint = `umee/leverage/v1/liquidation_targets`; return await this.req.get(endpoint); } /* BadDebts queries a list of borrow positions that have been marked for bad debt repayment. */ - - async badDebts(_params: QueryBadDebts = {}): Promise { const endpoint = `umee/leverage/v1/bad_debts`; return await this.req.get(endpoint); } - + /* MaxWithdraw queries the maximum amount of a given token an address can withdraw. */ + async maxWithdraw(params: QueryMaxWithdraw): Promise { + const options: any = { + params: {} + }; + if (typeof params?.address !== "undefined") { + options.params.address = params.address; + } + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/leverage/v1/max_withdraw`; + return await this.req.get(endpoint, options); + } + /* MaxBorrow queries the maximum amount of a given token an address can borrow. */ + async maxBorrow(params: QueryMaxBorrow): Promise { + const options: any = { + params: {} + }; + if (typeof params?.address !== "undefined") { + options.params.address = params.address; + } + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/leverage/v1/max_borrow`; + return await this.req.get(endpoint, options); + } + /* Inspect is the customizable inspector query. It returns a list of all borrowers, + starting from the highest borrowed value, filtered by any combination of: minimum + borrowed value (optionally of a specified token), minimum collateral value, minimum + progress toward liquidation threshold, and minimum LTV. Each account is displayed + with its address and borrowed/liquidation/collateral USD values, as well as its + actual token positions in human-readable symbol denoms instead of uTokens or ibc denoms. */ + async inspect(params: QueryInspect): Promise { + const options: any = { + params: {} + }; + if (typeof params?.symbol !== "undefined") { + options.params.symbol = params.symbol; + } + if (typeof params?.borrowed !== "undefined") { + options.params.borrowed = params.borrowed; + } + if (typeof params?.collateral !== "undefined") { + options.params.collateral = params.collateral; + } + if (typeof params?.danger !== "undefined") { + options.params.danger = params.danger; + } + if (typeof params?.ltv !== "undefined") { + options.params.ltv = params.ltv; + } + const endpoint = `umee/leverage/v1/inspect`; + return await this.req.get(endpoint, options); + } + /* InspectAccount runs the inspect query on a single address */ + async inspectAccount(params: QueryInspectAccount): Promise { + const options: any = { + params: {} + }; + if (typeof params?.address !== "undefined") { + options.params.address = params.address; + } + const endpoint = `umee/leverage/v1/inspect-account`; + return await this.req.get(endpoint, options); + } } \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/query.rpc.Query.ts b/src/codegen/umee/leverage/v1/query.rpc.Query.ts index 5404749..20922b8 100644 --- a/src/codegen/umee/leverage/v1/query.rpc.Query.ts +++ b/src/codegen/umee/leverage/v1/query.rpc.Query.ts @@ -1,87 +1,118 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParams, QueryParamsResponse, QueryRegisteredTokens, QueryRegisteredTokensResponse, QueryMarketSummary, QueryMarketSummaryResponse, QueryAccountBalances, QueryAccountBalancesResponse, QueryAccountSummary, QueryAccountSummaryResponse, QueryLiquidationTargets, QueryLiquidationTargetsResponse, QueryBadDebts, QueryBadDebtsResponse } from "./query"; +import { QueryParams, QueryParamsResponse, QueryRegisteredTokens, QueryRegisteredTokensResponse, QuerySpecialAssets, QuerySpecialAssetsResponse, QueryMarketSummary, QueryMarketSummaryResponse, QueryAccountBalances, QueryAccountBalancesResponse, QueryAccountSummary, QueryAccountSummaryResponse, QueryLiquidationTargets, QueryLiquidationTargetsResponse, QueryBadDebts, QueryBadDebtsResponse, QueryMaxWithdraw, QueryMaxWithdrawResponse, QueryMaxBorrow, QueryMaxBorrowResponse, QueryInspect, QueryInspectResponse, QueryInspectAccount, QueryInspectAccountResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** Params queries the parameters of the x/leverage module. */ params(request?: QueryParams): Promise; /** RegisteredTokens queries for all the registered tokens. */ - - registeredTokens(request?: QueryRegisteredTokens): Promise; + registeredTokens(request: QueryRegisteredTokens): Promise; + /** SpecialAssets queries for all special asset pairs. */ + specialAssets(request: QuerySpecialAssets): Promise; /** MarketSummary queries a base asset's current borrowing and supplying conditions. */ - marketSummary(request: QueryMarketSummary): Promise; /** AccountBalances queries an account's current supply, collateral, and borrow positions. */ - accountBalances(request: QueryAccountBalances): Promise; /** AccountSummary queries USD values representing an account's total positions and borrowing limits. It requires oracle prices to return successfully. */ - accountSummary(request: QueryAccountSummary): Promise; /** LiquidationTargets queries a list of all borrower account addresses eligible for liquidation. */ - liquidationTargets(request?: QueryLiquidationTargets): Promise; /** BadDebts queries a list of borrow positions that have been marked for bad debt repayment. */ - badDebts(request?: QueryBadDebts): Promise; + /** MaxWithdraw queries the maximum amount of a given token an address can withdraw. */ + maxWithdraw(request: QueryMaxWithdraw): Promise; + /** MaxBorrow queries the maximum amount of a given token an address can borrow. */ + maxBorrow(request: QueryMaxBorrow): Promise; + /** + * Inspect is the customizable inspector query. It returns a list of all borrowers, + * starting from the highest borrowed value, filtered by any combination of: minimum + * borrowed value (optionally of a specified token), minimum collateral value, minimum + * progress toward liquidation threshold, and minimum LTV. Each account is displayed + * with its address and borrowed/liquidation/collateral USD values, as well as its + * actual token positions in human-readable symbol denoms instead of uTokens or ibc denoms. + */ + inspect(request: QueryInspect): Promise; + /** InspectAccount runs the inspect query on a single address */ + inspectAccount(request: QueryInspectAccount): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.params = this.params.bind(this); this.registeredTokens = this.registeredTokens.bind(this); + this.specialAssets = this.specialAssets.bind(this); this.marketSummary = this.marketSummary.bind(this); this.accountBalances = this.accountBalances.bind(this); this.accountSummary = this.accountSummary.bind(this); this.liquidationTargets = this.liquidationTargets.bind(this); this.badDebts = this.badDebts.bind(this); + this.maxWithdraw = this.maxWithdraw.bind(this); + this.maxBorrow = this.maxBorrow.bind(this); + this.inspect = this.inspect.bind(this); + this.inspectAccount = this.inspectAccount.bind(this); } - params(request: QueryParams = {}): Promise { const data = QueryParams.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } - - registeredTokens(request: QueryRegisteredTokens = {}): Promise { + registeredTokens(request: QueryRegisteredTokens): Promise { const data = QueryRegisteredTokens.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Query", "RegisteredTokens", data); - return promise.then(data => QueryRegisteredTokensResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryRegisteredTokensResponse.decode(new BinaryReader(data))); + } + specialAssets(request: QuerySpecialAssets): Promise { + const data = QuerySpecialAssets.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Query", "SpecialAssets", data); + return promise.then(data => QuerySpecialAssetsResponse.decode(new BinaryReader(data))); } - marketSummary(request: QueryMarketSummary): Promise { const data = QueryMarketSummary.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Query", "MarketSummary", data); - return promise.then(data => QueryMarketSummaryResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryMarketSummaryResponse.decode(new BinaryReader(data))); } - accountBalances(request: QueryAccountBalances): Promise { const data = QueryAccountBalances.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Query", "AccountBalances", data); - return promise.then(data => QueryAccountBalancesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAccountBalancesResponse.decode(new BinaryReader(data))); } - accountSummary(request: QueryAccountSummary): Promise { const data = QueryAccountSummary.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Query", "AccountSummary", data); - return promise.then(data => QueryAccountSummaryResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAccountSummaryResponse.decode(new BinaryReader(data))); } - liquidationTargets(request: QueryLiquidationTargets = {}): Promise { const data = QueryLiquidationTargets.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Query", "LiquidationTargets", data); - return promise.then(data => QueryLiquidationTargetsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryLiquidationTargetsResponse.decode(new BinaryReader(data))); } - badDebts(request: QueryBadDebts = {}): Promise { const data = QueryBadDebts.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Query", "BadDebts", data); - return promise.then(data => QueryBadDebtsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryBadDebtsResponse.decode(new BinaryReader(data))); + } + maxWithdraw(request: QueryMaxWithdraw): Promise { + const data = QueryMaxWithdraw.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Query", "MaxWithdraw", data); + return promise.then(data => QueryMaxWithdrawResponse.decode(new BinaryReader(data))); + } + maxBorrow(request: QueryMaxBorrow): Promise { + const data = QueryMaxBorrow.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Query", "MaxBorrow", data); + return promise.then(data => QueryMaxBorrowResponse.decode(new BinaryReader(data))); + } + inspect(request: QueryInspect): Promise { + const data = QueryInspect.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Query", "Inspect", data); + return promise.then(data => QueryInspectResponse.decode(new BinaryReader(data))); + } + inspectAccount(request: QueryInspectAccount): Promise { + const data = QueryInspectAccount.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Query", "InspectAccount", data); + return promise.then(data => QueryInspectAccountResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -90,30 +121,38 @@ export const createRpcQueryExtension = (base: QueryClient) => { params(request?: QueryParams): Promise { return queryService.params(request); }, - - registeredTokens(request?: QueryRegisteredTokens): Promise { + registeredTokens(request: QueryRegisteredTokens): Promise { return queryService.registeredTokens(request); }, - + specialAssets(request: QuerySpecialAssets): Promise { + return queryService.specialAssets(request); + }, marketSummary(request: QueryMarketSummary): Promise { return queryService.marketSummary(request); }, - accountBalances(request: QueryAccountBalances): Promise { return queryService.accountBalances(request); }, - accountSummary(request: QueryAccountSummary): Promise { return queryService.accountSummary(request); }, - liquidationTargets(request?: QueryLiquidationTargets): Promise { return queryService.liquidationTargets(request); }, - badDebts(request?: QueryBadDebts): Promise { return queryService.badDebts(request); + }, + maxWithdraw(request: QueryMaxWithdraw): Promise { + return queryService.maxWithdraw(request); + }, + maxBorrow(request: QueryMaxBorrow): Promise { + return queryService.maxBorrow(request); + }, + inspect(request: QueryInspect): Promise { + return queryService.inspect(request); + }, + inspectAccount(request: QueryInspectAccount): Promise { + return queryService.inspectAccount(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/query.ts b/src/codegen/umee/leverage/v1/query.ts index ef232e4..b12c788 100644 --- a/src/codegen/umee/leverage/v1/query.ts +++ b/src/codegen/umee/leverage/v1/query.ts @@ -1,522 +1,1341 @@ -import { Params, ParamsSDKType, Token, TokenSDKType } from "./leverage"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { BadDebt, BadDebtSDKType } from "./genesis"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Params, ParamsAmino, ParamsSDKType, Token, TokenAmino, TokenSDKType, SpecialAssetPair, SpecialAssetPairAmino, SpecialAssetPairSDKType } from "./leverage"; +import { Coin, CoinAmino, CoinSDKType, DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BadDebt, BadDebtAmino, BadDebtSDKType } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; /** * QueryParams defines the request structure for the Params gRPC service * handler. */ - export interface QueryParams {} +export interface QueryParamsProtoMsg { + typeUrl: "/umee.leverage.v1.QueryParams"; + value: Uint8Array; +} +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParamsAmino {} +export interface QueryParamsAminoMsg { + type: "/umee.leverage.v1.QueryParams"; + value: QueryParamsAmino; +} /** * QueryParams defines the request structure for the Params gRPC service * handler. */ - export interface QueryParamsSDKType {} /** * QueryParamsResponse defines the response structure for the Params gRPC * service handler. */ - export interface QueryParamsResponse { - params?: Params; + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "/umee.leverage.v1.QueryParamsResponse"; + value: QueryParamsResponseAmino; } /** * QueryParamsResponse defines the response structure for the Params gRPC * service handler. */ - export interface QueryParamsResponseSDKType { - params?: ParamsSDKType; + params: ParamsSDKType; +} +/** + * QueryRegisteredTokens defines the request structure for the RegisteredTokens + * gRPC service handler. + */ +export interface QueryRegisteredTokens { + baseDenom: string; +} +export interface QueryRegisteredTokensProtoMsg { + typeUrl: "/umee.leverage.v1.QueryRegisteredTokens"; + value: Uint8Array; } /** * QueryRegisteredTokens defines the request structure for the RegisteredTokens * gRPC service handler. */ - -export interface QueryRegisteredTokens {} +export interface QueryRegisteredTokensAmino { + base_denom?: string; +} +export interface QueryRegisteredTokensAminoMsg { + type: "/umee.leverage.v1.QueryRegisteredTokens"; + value: QueryRegisteredTokensAmino; +} /** * QueryRegisteredTokens defines the request structure for the RegisteredTokens * gRPC service handler. */ - -export interface QueryRegisteredTokensSDKType {} +export interface QueryRegisteredTokensSDKType { + base_denom: string; +} /** * QueryRegisteredTokensResponse defines the response structure for the * RegisteredTokens gRPC service handler. */ - export interface QueryRegisteredTokensResponse { registry: Token[]; } +export interface QueryRegisteredTokensResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryRegisteredTokensResponse"; + value: Uint8Array; +} +/** + * QueryRegisteredTokensResponse defines the response structure for the + * RegisteredTokens gRPC service handler. + */ +export interface QueryRegisteredTokensResponseAmino { + registry?: TokenAmino[]; +} +export interface QueryRegisteredTokensResponseAminoMsg { + type: "/umee.leverage.v1.QueryRegisteredTokensResponse"; + value: QueryRegisteredTokensResponseAmino; +} /** * QueryRegisteredTokensResponse defines the response structure for the * RegisteredTokens gRPC service handler. */ - export interface QueryRegisteredTokensResponseSDKType { registry: TokenSDKType[]; } +/** + * QuerySpecialAssets defines the request structure for the SpecialAssets + * gRPC service handler. + */ +export interface QuerySpecialAssets { + /** denom can be used to query only pairs affecting a specific asset */ + denom: string; +} +export interface QuerySpecialAssetsProtoMsg { + typeUrl: "/umee.leverage.v1.QuerySpecialAssets"; + value: Uint8Array; +} +/** + * QuerySpecialAssets defines the request structure for the SpecialAssets + * gRPC service handler. + */ +export interface QuerySpecialAssetsAmino { + /** denom can be used to query only pairs affecting a specific asset */ + denom?: string; +} +export interface QuerySpecialAssetsAminoMsg { + type: "/umee.leverage.v1.QuerySpecialAssets"; + value: QuerySpecialAssetsAmino; +} +/** + * QuerySpecialAssets defines the request structure for the SpecialAssets + * gRPC service handler. + */ +export interface QuerySpecialAssetsSDKType { + denom: string; +} +/** + * QuerySpecialAssetsResponse defines the response structure for the + * SpecialAssets gRPC service handler. + */ +export interface QuerySpecialAssetsResponse { + pairs: SpecialAssetPair[]; +} +export interface QuerySpecialAssetsResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QuerySpecialAssetsResponse"; + value: Uint8Array; +} +/** + * QuerySpecialAssetsResponse defines the response structure for the + * SpecialAssets gRPC service handler. + */ +export interface QuerySpecialAssetsResponseAmino { + pairs?: SpecialAssetPairAmino[]; +} +export interface QuerySpecialAssetsResponseAminoMsg { + type: "/umee.leverage.v1.QuerySpecialAssetsResponse"; + value: QuerySpecialAssetsResponseAmino; +} +/** + * QuerySpecialAssetsResponse defines the response structure for the + * SpecialAssets gRPC service handler. + */ +export interface QuerySpecialAssetsResponseSDKType { + pairs: SpecialAssetPairSDKType[]; +} /** QueryMarketSummary defines the request structure for the MarketSummary gRPC service handler. */ - export interface QueryMarketSummary { denom: string; } +export interface QueryMarketSummaryProtoMsg { + typeUrl: "/umee.leverage.v1.QueryMarketSummary"; + value: Uint8Array; +} +/** QueryMarketSummary defines the request structure for the MarketSummary gRPC service handler. */ +export interface QueryMarketSummaryAmino { + denom?: string; +} +export interface QueryMarketSummaryAminoMsg { + type: "/umee.leverage.v1.QueryMarketSummary"; + value: QueryMarketSummaryAmino; +} /** QueryMarketSummary defines the request structure for the MarketSummary gRPC service handler. */ - export interface QueryMarketSummarySDKType { denom: string; } /** QueryMarketSummaryResponse defines the response structure for the MarketSummary gRPC service handler. */ - export interface QueryMarketSummaryResponse { /** Symbol Denom is the human-readable representation of a token denom, for example "UMEE" or "ATOM". */ symbolDenom: string; /** Exponent is the power of ten required to get from base denom to symbol denom. For example, an exponent of 6 means 10^6 uumee = 1 UMEE. */ - exponent: number; - /** Oracle Price is the current USD value of a base token. Exponent must be applied to reach the price from symbol_denom. For example, a price of $0.000001 for 1 uumee is equivalent to $1.00 for 1 UMEE. Oracle price is nil when the oracle is down. */ - - oraclePrice: string; + /** Oracle Price is the current USD value of a token. Oracle price is nil when the oracle is down. */ + oraclePrice?: string; /** uToken Exchange Rate is the amount of base tokens received when withdrawing 1 uToken. For example, a uToken exchange rate of 1.5 means a supplier receives 3 uumee for every 2 u/uumee they wish to withdraw. The same applies in reverse: supplying 3 uumee would award 2 u/uumee at that time. */ - uTokenExchangeRate: string; /** Supply APY is the current interest rate suppliers are receiving for their deposits. For example, 0.11 would mean 11% APY. Supply APY is always less than borrow APY. */ - - supply_APY: string; + supplyAPY: string; /** Borrow APY is the current interest rate borrowers are being charged on their loans. For example, 0.2 would mean 20% APY. */ - - borrow_APY: string; + borrowAPY: string; /** Supplied is the total amount of tokens supplied to the the system by all suppliers, including any interest earned. This includes that tokens which have been borrowed out or enabled as collateral, but excludes reserves. Supplied is denominated in base tokens, so exponent must be applied to convert to symbol denom. */ - supplied: string; /** Reserved is the total amount of tokens held in reserve by the module for emergencies. Reserves are always excluded from total supply, borrow, collateral, and liqduidity queries. Reserves are denominated in base tokens, so exponent must be applied to convert to symbol denom. */ - reserved: string; - /** Collateral is the total amount of uTokens collateralized by all borrowers. Collateral is denominated in uTokenso, so both uToken exchange rate and exponent must also be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee and uToken exhange rate is 1.2, then 5 UMEE have been collateralized. */ - + /** Collateral is the total amount of uTokens collateralized by all borrowers. Collateral is denominated in uTokenso, so both uToken exchange rate and exponent must also be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee and uToken exchange rate is 1.2, then 5 UMEE have been collateralized. */ collateral: string; /** Borrowed is the total amount of debt in this token held across all borrowers. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. */ - borrowed: string; /** Liquidity is the amount of a token that has been supplied but not yet borrowed or reserved. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. */ - liquidity: string; /** Maximum Borrow is the amount of a token that is available for borrowing, including that which has already been borrowed out. This amount is less than total supply due to safety limits. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if borrowed is 3000000 uumee and maximum borrow is 4000000 uumee, then 1 UMEE is currently available for borrowing. */ - maximumBorrow: string; - /** Maximum Collateral is the amount of a token that can be collateralized, including that which is already collateral. This amount is less than total supply due to safety limits. It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee, uToken exhange rate is 1.2, and maximum borrow is 7000000 uumee, then a maximum of 2 additional UMEE is permitted to be collateralized. */ - + /** Maximum Collateral is the amount of a token that can be collateralized, including that which is already collateral. This amount is less than total supply due to safety limits. It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee, uToken exchange rate is 1.2, and maximum borrow is 7000000 uumee, then a maximum of 2 additional UMEE is permitted to be collateralized. */ maximumCollateral: string; - /** Mimimum Liquidity is the minimum amount of liquidity in the module required by safety limits, based on the current collateral. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if liquidity is 9000000 uumee and minimum liquidity is 8000000 uumee, then a maximum of 1 additional UMEE is currently available for borrowing or withdrawal. */ - + /** Minimum Liquidity is the minimum amount of liquidity in the module required by safety limits, based on the current collateral. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if liquidity is 9000000 uumee and minimum liquidity is 8000000 uumee, then a maximum of 1 additional UMEE is currently available for borrowing or withdrawal. */ minimumLiquidity: string; /** uToken Supply is the total amount of a base token's associated uToken in circulation. */ - uTokenSupply: string; /** Available Borrow is the maximum additional amount of base tokens than can be borrowed based on current liquidity and system safety limits. It can also be calculated by MIN(maximum_borrow - borrowed, liquidity - minimum_liquidity). It is denominated in base tokens, so exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and borrowing is temporarily unavailable. */ - availableBorrow: string; /** Available Withdraw is the maximum amount of uTokens than can currently be withdrawn based on liquidity and system safety limits. It can also be calculated by (liquidity - minimum_liquidity). It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and withdrawal is temporarily unavailable. */ - availableWithdraw: string; /** Available Collateralize is the maximum additional amount of uTokens than can be collateralized based on current liquidity and system safety limits. It can also be calculated by (maximum_collateral, - collateral). It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and additional collateral cannot be created until more liquidity is present. */ - availableCollateralize: string; + /** Oracle Historic Price is the historic USD value of a token. Historic price is defined as the median of the last N historic median prices from the oracle module, with N being this token's HistoricMedians in the leverage registry. Current price is used if required medians is zero. Price is nil when the oracle is down or insufficient historic medians are available. */ + oracleHistoricPrice?: string; + errors: string; +} +export interface QueryMarketSummaryResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryMarketSummaryResponse"; + value: Uint8Array; } /** QueryMarketSummaryResponse defines the response structure for the MarketSummary gRPC service handler. */ - -export interface QueryMarketSummaryResponseSDKType { +export interface QueryMarketSummaryResponseAmino { /** Symbol Denom is the human-readable representation of a token denom, for example "UMEE" or "ATOM". */ - symbol_denom: string; + symbol_denom?: string; /** Exponent is the power of ten required to get from base denom to symbol denom. For example, an exponent of 6 means 10^6 uumee = 1 UMEE. */ - - exponent: number; - /** Oracle Price is the current USD value of a base token. Exponent must be applied to reach the price from symbol_denom. For example, a price of $0.000001 for 1 uumee is equivalent to $1.00 for 1 UMEE. Oracle price is nil when the oracle is down. */ - - oracle_price: string; + exponent?: number; + /** Oracle Price is the current USD value of a token. Oracle price is nil when the oracle is down. */ + oracle_price?: string; /** uToken Exchange Rate is the amount of base tokens received when withdrawing 1 uToken. For example, a uToken exchange rate of 1.5 means a supplier receives 3 uumee for every 2 u/uumee they wish to withdraw. The same applies in reverse: supplying 3 uumee would award 2 u/uumee at that time. */ - - uToken_exchange_rate: string; + uToken_exchange_rate?: string; /** Supply APY is the current interest rate suppliers are receiving for their deposits. For example, 0.11 would mean 11% APY. Supply APY is always less than borrow APY. */ - - supply_APY: string; + supply_APY?: string; /** Borrow APY is the current interest rate borrowers are being charged on their loans. For example, 0.2 would mean 20% APY. */ - - borrow_APY: string; + borrow_APY?: string; /** Supplied is the total amount of tokens supplied to the the system by all suppliers, including any interest earned. This includes that tokens which have been borrowed out or enabled as collateral, but excludes reserves. Supplied is denominated in base tokens, so exponent must be applied to convert to symbol denom. */ - - supplied: string; + supplied?: string; /** Reserved is the total amount of tokens held in reserve by the module for emergencies. Reserves are always excluded from total supply, borrow, collateral, and liqduidity queries. Reserves are denominated in base tokens, so exponent must be applied to convert to symbol denom. */ - + reserved?: string; + /** Collateral is the total amount of uTokens collateralized by all borrowers. Collateral is denominated in uTokenso, so both uToken exchange rate and exponent must also be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee and uToken exchange rate is 1.2, then 5 UMEE have been collateralized. */ + collateral?: string; + /** Borrowed is the total amount of debt in this token held across all borrowers. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. */ + borrowed?: string; + /** Liquidity is the amount of a token that has been supplied but not yet borrowed or reserved. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. */ + liquidity?: string; + /** Maximum Borrow is the amount of a token that is available for borrowing, including that which has already been borrowed out. This amount is less than total supply due to safety limits. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if borrowed is 3000000 uumee and maximum borrow is 4000000 uumee, then 1 UMEE is currently available for borrowing. */ + maximum_borrow?: string; + /** Maximum Collateral is the amount of a token that can be collateralized, including that which is already collateral. This amount is less than total supply due to safety limits. It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee, uToken exchange rate is 1.2, and maximum borrow is 7000000 uumee, then a maximum of 2 additional UMEE is permitted to be collateralized. */ + maximum_collateral?: string; + /** Minimum Liquidity is the minimum amount of liquidity in the module required by safety limits, based on the current collateral. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if liquidity is 9000000 uumee and minimum liquidity is 8000000 uumee, then a maximum of 1 additional UMEE is currently available for borrowing or withdrawal. */ + minimum_liquidity?: string; + /** uToken Supply is the total amount of a base token's associated uToken in circulation. */ + uToken_supply?: string; + /** Available Borrow is the maximum additional amount of base tokens than can be borrowed based on current liquidity and system safety limits. It can also be calculated by MIN(maximum_borrow - borrowed, liquidity - minimum_liquidity). It is denominated in base tokens, so exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and borrowing is temporarily unavailable. */ + available_borrow?: string; + /** Available Withdraw is the maximum amount of uTokens than can currently be withdrawn based on liquidity and system safety limits. It can also be calculated by (liquidity - minimum_liquidity). It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and withdrawal is temporarily unavailable. */ + available_withdraw?: string; + /** Available Collateralize is the maximum additional amount of uTokens than can be collateralized based on current liquidity and system safety limits. It can also be calculated by (maximum_collateral, - collateral). It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and additional collateral cannot be created until more liquidity is present. */ + available_collateralize?: string; + /** Oracle Historic Price is the historic USD value of a token. Historic price is defined as the median of the last N historic median prices from the oracle module, with N being this token's HistoricMedians in the leverage registry. Current price is used if required medians is zero. Price is nil when the oracle is down or insufficient historic medians are available. */ + oracle_historic_price?: string; + errors?: string; +} +export interface QueryMarketSummaryResponseAminoMsg { + type: "/umee.leverage.v1.QueryMarketSummaryResponse"; + value: QueryMarketSummaryResponseAmino; +} +/** QueryMarketSummaryResponse defines the response structure for the MarketSummary gRPC service handler. */ +export interface QueryMarketSummaryResponseSDKType { + symbol_denom: string; + exponent: number; + oracle_price?: string; + uToken_exchange_rate: string; + supply_APY: string; + borrow_APY: string; + supplied: string; reserved: string; - /** Collateral is the total amount of uTokens collateralized by all borrowers. Collateral is denominated in uTokenso, so both uToken exchange rate and exponent must also be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee and uToken exhange rate is 1.2, then 5 UMEE have been collateralized. */ - collateral: string; - /** Borrowed is the total amount of debt in this token held across all borrowers. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. */ - borrowed: string; - /** Liquidity is the amount of a token that has been supplied but not yet borrowed or reserved. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. */ - liquidity: string; - /** Maximum Borrow is the amount of a token that is available for borrowing, including that which has already been borrowed out. This amount is less than total supply due to safety limits. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if borrowed is 3000000 uumee and maximum borrow is 4000000 uumee, then 1 UMEE is currently available for borrowing. */ - maximum_borrow: string; - /** Maximum Collateral is the amount of a token that can be collateralized, including that which is already collateral. This amount is less than total supply due to safety limits. It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. For example, if collateral is 4000000 u/uumee, uToken exhange rate is 1.2, and maximum borrow is 7000000 uumee, then a maximum of 2 additional UMEE is permitted to be collateralized. */ - maximum_collateral: string; - /** Mimimum Liquidity is the minimum amount of liquidity in the module required by safety limits, based on the current collateral. It is denominated in base tokens, so exponent must be applied to convert to symbol denom. For example, if liquidity is 9000000 uumee and minimum liquidity is 8000000 uumee, then a maximum of 1 additional UMEE is currently available for borrowing or withdrawal. */ - minimum_liquidity: string; - /** uToken Supply is the total amount of a base token's associated uToken in circulation. */ - uToken_supply: string; - /** Available Borrow is the maximum additional amount of base tokens than can be borrowed based on current liquidity and system safety limits. It can also be calculated by MIN(maximum_borrow - borrowed, liquidity - minimum_liquidity). It is denominated in base tokens, so exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and borrowing is temporarily unavailable. */ - available_borrow: string; - /** Available Withdraw is the maximum amount of uTokens than can currently be withdrawn based on liquidity and system safety limits. It can also be calculated by (liquidity - minimum_liquidity). It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and withdrawal is temporarily unavailable. */ - available_withdraw: string; - /** Available Collateralize is the maximum additional amount of uTokens than can be collateralized based on current liquidity and system safety limits. It can also be calculated by (maximum_collateral, - collateral). It is denominated in uTokens, so both uToken exchange rate and exponent must be applied to convert to symbol denom. A negative availability means safety limits have been exceeded and additional collateral cannot be created until more liquidity is present. */ - available_collateralize: string; + oracle_historic_price?: string; + errors: string; } /** QueryAccountBalances defines the request structure for the AccountBalances gRPC service handler. */ - export interface QueryAccountBalances { address: string; } +export interface QueryAccountBalancesProtoMsg { + typeUrl: "/umee.leverage.v1.QueryAccountBalances"; + value: Uint8Array; +} +/** QueryAccountBalances defines the request structure for the AccountBalances gRPC service handler. */ +export interface QueryAccountBalancesAmino { + address?: string; +} +export interface QueryAccountBalancesAminoMsg { + type: "/umee.leverage.v1.QueryAccountBalances"; + value: QueryAccountBalancesAmino; +} /** QueryAccountBalances defines the request structure for the AccountBalances gRPC service handler. */ - export interface QueryAccountBalancesSDKType { address: string; } /** QueryAccountBalancesResponse defines the response structure for the AccountBalances gRPC service handler. */ - export interface QueryAccountBalancesResponse { /** Supplied contains all tokens the account has supplied, including interest earned. It is denominated in base tokens, so exponent from each coin's registered_tokens entry must be applied to convert to symbol denom. */ supplied: Coin[]; /** Collateral contains all uTokens the account has collateralized. It is denominated in uTokens, so both exponent and uToken exchange rate from each coin's market_summary must be applied to convert to base token symbol denom. */ - collateral: Coin[]; /** Borrowed contains all tokens the account has borrowed, including interest owed. It is denominated in base tokens, so exponent from each coin's registered_tokens entry must be applied to convert to symbol denom. */ - borrowed: Coin[]; } +export interface QueryAccountBalancesResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryAccountBalancesResponse"; + value: Uint8Array; +} /** QueryAccountBalancesResponse defines the response structure for the AccountBalances gRPC service handler. */ - -export interface QueryAccountBalancesResponseSDKType { +export interface QueryAccountBalancesResponseAmino { /** Supplied contains all tokens the account has supplied, including interest earned. It is denominated in base tokens, so exponent from each coin's registered_tokens entry must be applied to convert to symbol denom. */ - supplied: CoinSDKType[]; + supplied?: CoinAmino[]; /** Collateral contains all uTokens the account has collateralized. It is denominated in uTokens, so both exponent and uToken exchange rate from each coin's market_summary must be applied to convert to base token symbol denom. */ - - collateral: CoinSDKType[]; + collateral?: CoinAmino[]; /** Borrowed contains all tokens the account has borrowed, including interest owed. It is denominated in base tokens, so exponent from each coin's registered_tokens entry must be applied to convert to symbol denom. */ - + borrowed?: CoinAmino[]; +} +export interface QueryAccountBalancesResponseAminoMsg { + type: "/umee.leverage.v1.QueryAccountBalancesResponse"; + value: QueryAccountBalancesResponseAmino; +} +/** QueryAccountBalancesResponse defines the response structure for the AccountBalances gRPC service handler. */ +export interface QueryAccountBalancesResponseSDKType { + supplied: CoinSDKType[]; + collateral: CoinSDKType[]; borrowed: CoinSDKType[]; } /** QueryAccountSummary defines the request structure for the AccountSummary gRPC service handler. */ - export interface QueryAccountSummary { address: string; } +export interface QueryAccountSummaryProtoMsg { + typeUrl: "/umee.leverage.v1.QueryAccountSummary"; + value: Uint8Array; +} +/** QueryAccountSummary defines the request structure for the AccountSummary gRPC service handler. */ +export interface QueryAccountSummaryAmino { + address?: string; +} +export interface QueryAccountSummaryAminoMsg { + type: "/umee.leverage.v1.QueryAccountSummary"; + value: QueryAccountSummaryAmino; +} /** QueryAccountSummary defines the request structure for the AccountSummary gRPC service handler. */ - export interface QueryAccountSummarySDKType { address: string; } /** QueryAccountSummaryResponse defines the response structure for the AccountSummary gRPC service handler. */ - export interface QueryAccountSummaryResponse { - /** Supplied Value is the sum of the USD value of all tokens the account has supplied, includng interest earned. */ + /** + * Supplied Value is the sum of the USD value of all tokens the account has supplied, including interest earned. + * It uses the lower of spot or historic price for each token. + * Computation skips assets which are missing oracle prices, potentially resulting in a lower supplied + * value than if prices were all available. + */ suppliedValue: string; - /** Collateral Value is the sum of the USD value of all uTokens the account has collateralized. */ - + /** + * Collateral Value is the sum of the USD value of all uTokens the account has collateralized. + * It uses the lower of spot or historic price for each token. + * Computation skips collateral which is missing an oracle price, potentially resulting in a lower collateral + * value than if prices were all available. + */ collateralValue: string; - /** Borrowed Value is the sum of the USD value of all tokens the account has borrowed, including interest owed. */ - + /** + * Borrowed Value is the sum of the USD value of all tokens the account has borrowed, including interest owed. + * It uses the higher of spot or historic price for each token. + * Computation skips borrows which are missing oracle prices, potentially resulting in a lower borrowed + * value than if prices were all available. + */ borrowedValue: string; - /** Borrow Limit is the maximum Borrowed Value the account is allowed to reach through direct borrowing. */ - - borrowLimit: string; - /** Liquidation Threshold is the Borrowed Value at which the account becomes eligible for liquidation. */ - - liquidationThreshold: string; + /** + * Borrow Limit is the maximum Borrowed Value the account is allowed to reach through direct borrowing. + * The lower of spot or historic price for each collateral token is used when calculating borrow limits. + * Computation skips collateral which is missing an oracle price, potentially resulting in a lower borrow + * limit than if prices were all available. Will be null if an oracle price required for computation is + * missing. + */ + borrowLimit?: string; + /** + * Liquidation Threshold is the Borrowed Value at which the account becomes eligible for liquidation. + * Computation skips borrows which are missing an oracle price, potentially resulting in a lower borrow + * limit than if prices were all available. Will be null if an oracle price required for computation is + * missing. + */ + liquidationThreshold?: string; + /** Spot Supplied Value is supplied value but always uses the most recent available spot prices. */ + spotSuppliedValue: string; + /** Spot Collateral Value is collateral value but always uses the most recent available spot prices. */ + spotCollateralValue: string; + /** Spot Borrowed Value is borrowed value but always uses the most recent available spot prices. */ + spotBorrowedValue: string; +} +export interface QueryAccountSummaryResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryAccountSummaryResponse"; + value: Uint8Array; +} +/** QueryAccountSummaryResponse defines the response structure for the AccountSummary gRPC service handler. */ +export interface QueryAccountSummaryResponseAmino { + /** + * Supplied Value is the sum of the USD value of all tokens the account has supplied, including interest earned. + * It uses the lower of spot or historic price for each token. + * Computation skips assets which are missing oracle prices, potentially resulting in a lower supplied + * value than if prices were all available. + */ + supplied_value?: string; + /** + * Collateral Value is the sum of the USD value of all uTokens the account has collateralized. + * It uses the lower of spot or historic price for each token. + * Computation skips collateral which is missing an oracle price, potentially resulting in a lower collateral + * value than if prices were all available. + */ + collateral_value?: string; + /** + * Borrowed Value is the sum of the USD value of all tokens the account has borrowed, including interest owed. + * It uses the higher of spot or historic price for each token. + * Computation skips borrows which are missing oracle prices, potentially resulting in a lower borrowed + * value than if prices were all available. + */ + borrowed_value?: string; + /** + * Borrow Limit is the maximum Borrowed Value the account is allowed to reach through direct borrowing. + * The lower of spot or historic price for each collateral token is used when calculating borrow limits. + * Computation skips collateral which is missing an oracle price, potentially resulting in a lower borrow + * limit than if prices were all available. Will be null if an oracle price required for computation is + * missing. + */ + borrow_limit?: string; + /** + * Liquidation Threshold is the Borrowed Value at which the account becomes eligible for liquidation. + * Computation skips borrows which are missing an oracle price, potentially resulting in a lower borrow + * limit than if prices were all available. Will be null if an oracle price required for computation is + * missing. + */ + liquidation_threshold?: string; + /** Spot Supplied Value is supplied value but always uses the most recent available spot prices. */ + spot_supplied_value?: string; + /** Spot Collateral Value is collateral value but always uses the most recent available spot prices. */ + spot_collateral_value?: string; + /** Spot Borrowed Value is borrowed value but always uses the most recent available spot prices. */ + spot_borrowed_value?: string; +} +export interface QueryAccountSummaryResponseAminoMsg { + type: "/umee.leverage.v1.QueryAccountSummaryResponse"; + value: QueryAccountSummaryResponseAmino; } /** QueryAccountSummaryResponse defines the response structure for the AccountSummary gRPC service handler. */ - export interface QueryAccountSummaryResponseSDKType { - /** Supplied Value is the sum of the USD value of all tokens the account has supplied, includng interest earned. */ supplied_value: string; - /** Collateral Value is the sum of the USD value of all uTokens the account has collateralized. */ - collateral_value: string; - /** Borrowed Value is the sum of the USD value of all tokens the account has borrowed, including interest owed. */ - borrowed_value: string; - /** Borrow Limit is the maximum Borrowed Value the account is allowed to reach through direct borrowing. */ - - borrow_limit: string; - /** Liquidation Threshold is the Borrowed Value at which the account becomes eligible for liquidation. */ - - liquidation_threshold: string; + borrow_limit?: string; + liquidation_threshold?: string; + spot_supplied_value: string; + spot_collateral_value: string; + spot_borrowed_value: string; } /** QueryLiquidationTargets defines the request structure for the LiquidationTargets gRPC service handler. */ - export interface QueryLiquidationTargets {} +export interface QueryLiquidationTargetsProtoMsg { + typeUrl: "/umee.leverage.v1.QueryLiquidationTargets"; + value: Uint8Array; +} +/** QueryLiquidationTargets defines the request structure for the LiquidationTargets gRPC service handler. */ +export interface QueryLiquidationTargetsAmino {} +export interface QueryLiquidationTargetsAminoMsg { + type: "/umee.leverage.v1.QueryLiquidationTargets"; + value: QueryLiquidationTargetsAmino; +} /** QueryLiquidationTargets defines the request structure for the LiquidationTargets gRPC service handler. */ - export interface QueryLiquidationTargetsSDKType {} /** QueryLiquidationTargetsResponse defines the response structure for the LiquidationTargets gRPC service handler. */ - export interface QueryLiquidationTargetsResponse { /** Targets are the addresses of borrowers eligible for liquidation. */ targets: string[]; } +export interface QueryLiquidationTargetsResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryLiquidationTargetsResponse"; + value: Uint8Array; +} /** QueryLiquidationTargetsResponse defines the response structure for the LiquidationTargets gRPC service handler. */ - -export interface QueryLiquidationTargetsResponseSDKType { +export interface QueryLiquidationTargetsResponseAmino { /** Targets are the addresses of borrowers eligible for liquidation. */ + targets?: string[]; +} +export interface QueryLiquidationTargetsResponseAminoMsg { + type: "/umee.leverage.v1.QueryLiquidationTargetsResponse"; + value: QueryLiquidationTargetsResponseAmino; +} +/** QueryLiquidationTargetsResponse defines the response structure for the LiquidationTargets gRPC service handler. */ +export interface QueryLiquidationTargetsResponseSDKType { targets: string[]; } /** * QueryBadDebts defines the request structure for the * BedDebts gRPC service handler. */ - export interface QueryBadDebts {} +export interface QueryBadDebtsProtoMsg { + typeUrl: "/umee.leverage.v1.QueryBadDebts"; + value: Uint8Array; +} +/** + * QueryBadDebts defines the request structure for the + * BedDebts gRPC service handler. + */ +export interface QueryBadDebtsAmino {} +export interface QueryBadDebtsAminoMsg { + type: "/umee.leverage.v1.QueryBadDebts"; + value: QueryBadDebtsAmino; +} /** * QueryBadDebts defines the request structure for the * BedDebts gRPC service handler. */ - export interface QueryBadDebtsSDKType {} /** QueryBadDebtsResponse defines the response structure for the BedDebts gRPC service handler. */ - export interface QueryBadDebtsResponse { /** Targets are borrow positions currently marked for bad debt repayment. Each contains an Address and a Denom. */ targets: BadDebt[]; } +export interface QueryBadDebtsResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryBadDebtsResponse"; + value: Uint8Array; +} /** QueryBadDebtsResponse defines the response structure for the BedDebts gRPC service handler. */ - -export interface QueryBadDebtsResponseSDKType { +export interface QueryBadDebtsResponseAmino { /** Targets are borrow positions currently marked for bad debt repayment. Each contains an Address and a Denom. */ + targets?: BadDebtAmino[]; +} +export interface QueryBadDebtsResponseAminoMsg { + type: "/umee.leverage.v1.QueryBadDebtsResponse"; + value: QueryBadDebtsResponseAmino; +} +/** QueryBadDebtsResponse defines the response structure for the BedDebts gRPC service handler. */ +export interface QueryBadDebtsResponseSDKType { targets: BadDebtSDKType[]; } - +/** QueryMaxWithdraw defines the request structure for the MaxWithdraw gRPC service handler. */ +export interface QueryMaxWithdraw { + address: string; + /** + * denom is the base token denom associated with the uToken to withdraw. + * empty denom will query all registered tokens. + */ + denom: string; +} +export interface QueryMaxWithdrawProtoMsg { + typeUrl: "/umee.leverage.v1.QueryMaxWithdraw"; + value: Uint8Array; +} +/** QueryMaxWithdraw defines the request structure for the MaxWithdraw gRPC service handler. */ +export interface QueryMaxWithdrawAmino { + address?: string; + /** + * denom is the base token denom associated with the uToken to withdraw. + * empty denom will query all registered tokens. + */ + denom?: string; +} +export interface QueryMaxWithdrawAminoMsg { + type: "/umee.leverage.v1.QueryMaxWithdraw"; + value: QueryMaxWithdrawAmino; +} +/** QueryMaxWithdraw defines the request structure for the MaxWithdraw gRPC service handler. */ +export interface QueryMaxWithdrawSDKType { + address: string; + denom: string; +} +/** QueryMaxWithdrawResponse defines the response structure for the MaxWithdraw gRPC service handler. */ +export interface QueryMaxWithdrawResponse { + /** uTokens is the maximum amount of uTokens that can be withdrawn */ + uTokens: Coin[]; + /** Tokens is the equivalent of max uTokens converted to base tokens */ + tokens: Coin[]; +} +export interface QueryMaxWithdrawResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryMaxWithdrawResponse"; + value: Uint8Array; +} +/** QueryMaxWithdrawResponse defines the response structure for the MaxWithdraw gRPC service handler. */ +export interface QueryMaxWithdrawResponseAmino { + /** uTokens is the maximum amount of uTokens that can be withdrawn */ + uTokens?: CoinAmino[]; + /** Tokens is the equivalent of max uTokens converted to base tokens */ + tokens?: CoinAmino[]; +} +export interface QueryMaxWithdrawResponseAminoMsg { + type: "/umee.leverage.v1.QueryMaxWithdrawResponse"; + value: QueryMaxWithdrawResponseAmino; +} +/** QueryMaxWithdrawResponse defines the response structure for the MaxWithdraw gRPC service handler. */ +export interface QueryMaxWithdrawResponseSDKType { + uTokens: CoinSDKType[]; + tokens: CoinSDKType[]; +} +/** QueryMaxBorrow defines the request structure for the MaxBorrow gRPC service handler. */ +export interface QueryMaxBorrow { + address: string; + /** + * denom is the base token denom to borrow. + * empty denom will query all registered tokens. + */ + denom: string; +} +export interface QueryMaxBorrowProtoMsg { + typeUrl: "/umee.leverage.v1.QueryMaxBorrow"; + value: Uint8Array; +} +/** QueryMaxBorrow defines the request structure for the MaxBorrow gRPC service handler. */ +export interface QueryMaxBorrowAmino { + address?: string; + /** + * denom is the base token denom to borrow. + * empty denom will query all registered tokens. + */ + denom?: string; +} +export interface QueryMaxBorrowAminoMsg { + type: "/umee.leverage.v1.QueryMaxBorrow"; + value: QueryMaxBorrowAmino; +} +/** QueryMaxBorrow defines the request structure for the MaxBorrow gRPC service handler. */ +export interface QueryMaxBorrowSDKType { + address: string; + denom: string; +} +/** QueryMaxBorrowResponse defines the response structure for the MaxBorrow gRPC service handler. */ +export interface QueryMaxBorrowResponse { + /** Tokens is the maximum amount of tokens that can be borrowed */ + tokens: Coin[]; +} +export interface QueryMaxBorrowResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryMaxBorrowResponse"; + value: Uint8Array; +} +/** QueryMaxBorrowResponse defines the response structure for the MaxBorrow gRPC service handler. */ +export interface QueryMaxBorrowResponseAmino { + /** Tokens is the maximum amount of tokens that can be borrowed */ + tokens?: CoinAmino[]; +} +export interface QueryMaxBorrowResponseAminoMsg { + type: "/umee.leverage.v1.QueryMaxBorrowResponse"; + value: QueryMaxBorrowResponseAmino; +} +/** QueryMaxBorrowResponse defines the response structure for the MaxBorrow gRPC service handler. */ +export interface QueryMaxBorrowResponseSDKType { + tokens: CoinSDKType[]; +} +/** QueryInspect defines the request structure for the Inspect gRPC service handler. */ +export interface QueryInspect { + /** Symbol selects a symbol denom to sort accounts by borrowed value. Use "all" or empty string to show all. */ + symbol: string; + /** Borrowed is the minimum USD value an account must have borrowed to show. Use 0 to show all. */ + borrowed: number; + /** Collateral is the minimum USD value of collateral an account must have to show. Use 0 to show all. */ + collateral: number; + /** + * Danger is the minimum progress toward liquidation an account must have to show. Use 0 to show all. + * Measured as the ratio (borrowed value / liquidation threshold), where > 1 is liquidation-eligible. + */ + danger: number; + /** LTV is the minimum ratio (borrowed value / collateral value) an account must have to show. Use 0 to show all. */ + ltv: number; +} +export interface QueryInspectProtoMsg { + typeUrl: "/umee.leverage.v1.QueryInspect"; + value: Uint8Array; +} +/** QueryInspect defines the request structure for the Inspect gRPC service handler. */ +export interface QueryInspectAmino { + /** Symbol selects a symbol denom to sort accounts by borrowed value. Use "all" or empty string to show all. */ + symbol?: string; + /** Borrowed is the minimum USD value an account must have borrowed to show. Use 0 to show all. */ + borrowed?: number; + /** Collateral is the minimum USD value of collateral an account must have to show. Use 0 to show all. */ + collateral?: number; + /** + * Danger is the minimum progress toward liquidation an account must have to show. Use 0 to show all. + * Measured as the ratio (borrowed value / liquidation threshold), where > 1 is liquidation-eligible. + */ + danger?: number; + /** LTV is the minimum ratio (borrowed value / collateral value) an account must have to show. Use 0 to show all. */ + ltv?: number; +} +export interface QueryInspectAminoMsg { + type: "/umee.leverage.v1.QueryInspect"; + value: QueryInspectAmino; +} +/** QueryInspect defines the request structure for the Inspect gRPC service handler. */ +export interface QueryInspectSDKType { + symbol: string; + borrowed: number; + collateral: number; + danger: number; + ltv: number; +} +/** QueryInspectAccount defines the request structure for the InspectAccount gRPC service handler. */ +export interface QueryInspectAccount { + address: string; +} +export interface QueryInspectAccountProtoMsg { + typeUrl: "/umee.leverage.v1.QueryInspectAccount"; + value: Uint8Array; +} +/** QueryInspectAccount defines the request structure for the InspectAccount gRPC service handler. */ +export interface QueryInspectAccountAmino { + address?: string; +} +export interface QueryInspectAccountAminoMsg { + type: "/umee.leverage.v1.QueryInspectAccount"; + value: QueryInspectAccountAmino; +} +/** QueryInspectAccount defines the request structure for the InspectAccount gRPC service handler. */ +export interface QueryInspectAccountSDKType { + address: string; +} +/** QueryInspectResponse defines the response structure for the Inspect gRPC service handler. */ +export interface QueryInspectResponse { + borrowers: InspectAccount[]; + /** Failures is a list of addresses for which the position calculation failed. */ + failures: string[]; +} +export interface QueryInspectResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryInspectResponse"; + value: Uint8Array; +} +/** QueryInspectResponse defines the response structure for the Inspect gRPC service handler. */ +export interface QueryInspectResponseAmino { + borrowers?: InspectAccountAmino[]; + /** Failures is a list of addresses for which the position calculation failed. */ + failures?: string[]; +} +export interface QueryInspectResponseAminoMsg { + type: "/umee.leverage.v1.QueryInspectResponse"; + value: QueryInspectResponseAmino; +} +/** QueryInspectResponse defines the response structure for the Inspect gRPC service handler. */ +export interface QueryInspectResponseSDKType { + borrowers: InspectAccountSDKType[]; + failures: string[]; +} +/** QueryInspectAccountResponse defines the response structure for the InspectAccount gRPC service handler. */ +export interface QueryInspectAccountResponse { + borrower: InspectAccount; +} +export interface QueryInspectAccountResponseProtoMsg { + typeUrl: "/umee.leverage.v1.QueryInspectAccountResponse"; + value: Uint8Array; +} +/** QueryInspectAccountResponse defines the response structure for the InspectAccount gRPC service handler. */ +export interface QueryInspectAccountResponseAmino { + borrower?: InspectAccountAmino; +} +export interface QueryInspectAccountResponseAminoMsg { + type: "/umee.leverage.v1.QueryInspectAccountResponse"; + value: QueryInspectAccountResponseAmino; +} +/** QueryInspectAccountResponse defines the response structure for the InspectAccount gRPC service handler. */ +export interface QueryInspectAccountResponseSDKType { + borrower: InspectAccountSDKType; +} +/** InspectAccount contains risk and balance info for a single account for the inspector query. */ +export interface InspectAccount { + /** Address of a borrower */ + address: string; + /** USD totals of borrower's collateral, debt, and liquidation threshold. */ + analysis?: RiskInfo; + /** Collateral and borrowed tokens, denoted in human-readable symbol denom instead of ibc denom. */ + position?: DecBalances; + /** + * Info is a string which can be used to report additional information of any type. + * UNSTABLE: We do not guarantee consistency of any data structures contained within the string. + */ + info: string; +} +export interface InspectAccountProtoMsg { + typeUrl: "/umee.leverage.v1.InspectAccount"; + value: Uint8Array; +} +/** InspectAccount contains risk and balance info for a single account for the inspector query. */ +export interface InspectAccountAmino { + /** Address of a borrower */ + address?: string; + /** USD totals of borrower's collateral, debt, and liquidation threshold. */ + analysis?: RiskInfoAmino; + /** Collateral and borrowed tokens, denoted in human-readable symbol denom instead of ibc denom. */ + position?: DecBalancesAmino; + /** + * Info is a string which can be used to report additional information of any type. + * UNSTABLE: We do not guarantee consistency of any data structures contained within the string. + */ + info?: string; +} +export interface InspectAccountAminoMsg { + type: "/umee.leverage.v1.InspectAccount"; + value: InspectAccountAmino; +} +/** InspectAccount contains risk and balance info for a single account for the inspector query. */ +export interface InspectAccountSDKType { + address: string; + analysis?: RiskInfoSDKType; + position?: DecBalancesSDKType; + info: string; +} +/** RiskInfo defines a borrower's account health without requiring sdk.Dec formatting. */ +export interface RiskInfo { + /** Borrowed is account's borrowed value in USD. */ + Borrowed: number; + /** Liquidation is account's liquidation threshold in USD. */ + Liquidation: number; + /** Value is account's collateral value in USD. */ + Value: number; +} +export interface RiskInfoProtoMsg { + typeUrl: "/umee.leverage.v1.RiskInfo"; + value: Uint8Array; +} +/** RiskInfo defines a borrower's account health without requiring sdk.Dec formatting. */ +export interface RiskInfoAmino { + /** Borrowed is account's borrowed value in USD. */ + Borrowed?: number; + /** Liquidation is account's liquidation threshold in USD. */ + Liquidation?: number; + /** Value is account's collateral value in USD. */ + Value?: number; +} +export interface RiskInfoAminoMsg { + type: "/umee.leverage.v1.RiskInfo"; + value: RiskInfoAmino; +} +/** RiskInfo defines a borrower's account health without requiring sdk.Dec formatting. */ +export interface RiskInfoSDKType { + Borrowed: number; + Liquidation: number; + Value: number; +} +/** DecBalances contains an account's position denoted in symbol denom tokens. */ +export interface DecBalances { + /** Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens. */ + collateral: DecCoin[]; + /** Borrowed contains all tokens the account has borrowed, including interest owed. */ + borrowed: DecCoin[]; +} +export interface DecBalancesProtoMsg { + typeUrl: "/umee.leverage.v1.DecBalances"; + value: Uint8Array; +} +/** DecBalances contains an account's position denoted in symbol denom tokens. */ +export interface DecBalancesAmino { + /** Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens. */ + collateral?: DecCoinAmino[]; + /** Borrowed contains all tokens the account has borrowed, including interest owed. */ + borrowed?: DecCoinAmino[]; +} +export interface DecBalancesAminoMsg { + type: "/umee.leverage.v1.DecBalances"; + value: DecBalancesAmino; +} +/** DecBalances contains an account's position denoted in symbol denom tokens. */ +export interface DecBalancesSDKType { + collateral: DecCoinSDKType[]; + borrowed: DecCoinSDKType[]; +} function createBaseQueryParams(): QueryParams { return {}; } - export const QueryParams = { - encode(_: QueryParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryParams", + encode(_: QueryParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParams { + fromPartial(_: Partial): QueryParams { const message = createBaseQueryParams(); return message; + }, + fromAmino(_: QueryParamsAmino): QueryParams { + const message = createBaseQueryParams(); + return message; + }, + toAmino(_: QueryParams): QueryParamsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsAminoMsg): QueryParams { + return QueryParams.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsProtoMsg): QueryParams { + return QueryParams.decode(message.value); + }, + toProto(message: QueryParams): Uint8Array { + return QueryParams.encode(message).finish(); + }, + toProtoMsg(message: QueryParams): QueryParamsProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryParams", + value: QueryParams.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + params: Params.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryRegisteredTokens(): QueryRegisteredTokens { - return {}; + return { + baseDenom: "" + }; } - export const QueryRegisteredTokens = { - encode(_: QueryRegisteredTokens, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryRegisteredTokens", + encode(message: QueryRegisteredTokens, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseDenom !== "") { + writer.uint32(10).string(message.baseDenom); + } return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryRegisteredTokens { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryRegisteredTokens { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryRegisteredTokens(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { + case 1: + message.baseDenom = reader.string(); + break; default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryRegisteredTokens { + fromPartial(object: Partial): QueryRegisteredTokens { + const message = createBaseQueryRegisteredTokens(); + message.baseDenom = object.baseDenom ?? ""; + return message; + }, + fromAmino(object: QueryRegisteredTokensAmino): QueryRegisteredTokens { const message = createBaseQueryRegisteredTokens(); + if (object.base_denom !== undefined && object.base_denom !== null) { + message.baseDenom = object.base_denom; + } return message; + }, + toAmino(message: QueryRegisteredTokens): QueryRegisteredTokensAmino { + const obj: any = {}; + obj.base_denom = message.baseDenom; + return obj; + }, + fromAminoMsg(object: QueryRegisteredTokensAminoMsg): QueryRegisteredTokens { + return QueryRegisteredTokens.fromAmino(object.value); + }, + fromProtoMsg(message: QueryRegisteredTokensProtoMsg): QueryRegisteredTokens { + return QueryRegisteredTokens.decode(message.value); + }, + toProto(message: QueryRegisteredTokens): Uint8Array { + return QueryRegisteredTokens.encode(message).finish(); + }, + toProtoMsg(message: QueryRegisteredTokens): QueryRegisteredTokensProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryRegisteredTokens", + value: QueryRegisteredTokens.encode(message).finish() + }; } - }; - function createBaseQueryRegisteredTokensResponse(): QueryRegisteredTokensResponse { return { registry: [] }; } - export const QueryRegisteredTokensResponse = { - encode(message: QueryRegisteredTokensResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryRegisteredTokensResponse", + encode(message: QueryRegisteredTokensResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.registry) { Token.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryRegisteredTokensResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryRegisteredTokensResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryRegisteredTokensResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.registry.push(Token.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryRegisteredTokensResponse { + fromPartial(object: Partial): QueryRegisteredTokensResponse { const message = createBaseQueryRegisteredTokensResponse(); message.registry = object.registry?.map(e => Token.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryRegisteredTokensResponseAmino): QueryRegisteredTokensResponse { + const message = createBaseQueryRegisteredTokensResponse(); + message.registry = object.registry?.map(e => Token.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryRegisteredTokensResponse): QueryRegisteredTokensResponseAmino { + const obj: any = {}; + if (message.registry) { + obj.registry = message.registry.map(e => e ? Token.toAmino(e) : undefined); + } else { + obj.registry = []; + } + return obj; + }, + fromAminoMsg(object: QueryRegisteredTokensResponseAminoMsg): QueryRegisteredTokensResponse { + return QueryRegisteredTokensResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryRegisteredTokensResponseProtoMsg): QueryRegisteredTokensResponse { + return QueryRegisteredTokensResponse.decode(message.value); + }, + toProto(message: QueryRegisteredTokensResponse): Uint8Array { + return QueryRegisteredTokensResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryRegisteredTokensResponse): QueryRegisteredTokensResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryRegisteredTokensResponse", + value: QueryRegisteredTokensResponse.encode(message).finish() + }; } - }; - -function createBaseQueryMarketSummary(): QueryMarketSummary { +function createBaseQuerySpecialAssets(): QuerySpecialAssets { return { denom: "" }; } - -export const QueryMarketSummary = { - encode(message: QueryMarketSummary, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QuerySpecialAssets = { + typeUrl: "/umee.leverage.v1.QuerySpecialAssets", + encode(message: QuerySpecialAssets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryMarketSummary { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpecialAssets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryMarketSummary(); - + const message = createBaseQuerySpecialAssets(); while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryMarketSummary { - const message = createBaseQueryMarketSummary(); + fromPartial(object: Partial): QuerySpecialAssets { + const message = createBaseQuerySpecialAssets(); message.denom = object.denom ?? ""; return message; - } - -}; - -function createBaseQueryMarketSummaryResponse(): QueryMarketSummaryResponse { - return { - symbolDenom: "", - exponent: 0, - oraclePrice: undefined, + }, + fromAmino(object: QuerySpecialAssetsAmino): QuerySpecialAssets { + const message = createBaseQuerySpecialAssets(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QuerySpecialAssets): QuerySpecialAssetsAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QuerySpecialAssetsAminoMsg): QuerySpecialAssets { + return QuerySpecialAssets.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySpecialAssetsProtoMsg): QuerySpecialAssets { + return QuerySpecialAssets.decode(message.value); + }, + toProto(message: QuerySpecialAssets): Uint8Array { + return QuerySpecialAssets.encode(message).finish(); + }, + toProtoMsg(message: QuerySpecialAssets): QuerySpecialAssetsProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QuerySpecialAssets", + value: QuerySpecialAssets.encode(message).finish() + }; + } +}; +function createBaseQuerySpecialAssetsResponse(): QuerySpecialAssetsResponse { + return { + pairs: [] + }; +} +export const QuerySpecialAssetsResponse = { + typeUrl: "/umee.leverage.v1.QuerySpecialAssetsResponse", + encode(message: QuerySpecialAssetsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.pairs) { + SpecialAssetPair.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpecialAssetsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpecialAssetsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pairs.push(SpecialAssetPair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QuerySpecialAssetsResponse { + const message = createBaseQuerySpecialAssetsResponse(); + message.pairs = object.pairs?.map(e => SpecialAssetPair.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QuerySpecialAssetsResponseAmino): QuerySpecialAssetsResponse { + const message = createBaseQuerySpecialAssetsResponse(); + message.pairs = object.pairs?.map(e => SpecialAssetPair.fromAmino(e)) || []; + return message; + }, + toAmino(message: QuerySpecialAssetsResponse): QuerySpecialAssetsResponseAmino { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map(e => e ? SpecialAssetPair.toAmino(e) : undefined); + } else { + obj.pairs = []; + } + return obj; + }, + fromAminoMsg(object: QuerySpecialAssetsResponseAminoMsg): QuerySpecialAssetsResponse { + return QuerySpecialAssetsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySpecialAssetsResponseProtoMsg): QuerySpecialAssetsResponse { + return QuerySpecialAssetsResponse.decode(message.value); + }, + toProto(message: QuerySpecialAssetsResponse): Uint8Array { + return QuerySpecialAssetsResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySpecialAssetsResponse): QuerySpecialAssetsResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QuerySpecialAssetsResponse", + value: QuerySpecialAssetsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryMarketSummary(): QueryMarketSummary { + return { + denom: "" + }; +} +export const QueryMarketSummary = { + typeUrl: "/umee.leverage.v1.QueryMarketSummary", + encode(message: QueryMarketSummary, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMarketSummary { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMarketSummary(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMarketSummary { + const message = createBaseQueryMarketSummary(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryMarketSummaryAmino): QueryMarketSummary { + const message = createBaseQueryMarketSummary(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryMarketSummary): QueryMarketSummaryAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryMarketSummaryAminoMsg): QueryMarketSummary { + return QueryMarketSummary.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMarketSummaryProtoMsg): QueryMarketSummary { + return QueryMarketSummary.decode(message.value); + }, + toProto(message: QueryMarketSummary): Uint8Array { + return QueryMarketSummary.encode(message).finish(); + }, + toProtoMsg(message: QueryMarketSummary): QueryMarketSummaryProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryMarketSummary", + value: QueryMarketSummary.encode(message).finish() + }; + } +}; +function createBaseQueryMarketSummaryResponse(): QueryMarketSummaryResponse { + return { + symbolDenom: "", + exponent: 0, + oraclePrice: undefined, uTokenExchangeRate: "", - supply_APY: "", - borrow_APY: "", + supplyAPY: "", + borrowAPY: "", supplied: "", reserved: "", collateral: "", @@ -528,185 +1347,158 @@ function createBaseQueryMarketSummaryResponse(): QueryMarketSummaryResponse { uTokenSupply: "", availableBorrow: "", availableWithdraw: "", - availableCollateralize: "" + availableCollateralize: "", + oracleHistoricPrice: undefined, + errors: "" }; } - export const QueryMarketSummaryResponse = { - encode(message: QueryMarketSummaryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryMarketSummaryResponse", + encode(message: QueryMarketSummaryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.symbolDenom !== "") { writer.uint32(10).string(message.symbolDenom); } - if (message.exponent !== 0) { writer.uint32(16).uint32(message.exponent); } - if (message.oraclePrice !== undefined) { - writer.uint32(26).string(message.oraclePrice); + writer.uint32(26).string(Decimal.fromUserInput(message.oraclePrice, 18).atomics); } - if (message.uTokenExchangeRate !== "") { - writer.uint32(34).string(message.uTokenExchangeRate); + writer.uint32(34).string(Decimal.fromUserInput(message.uTokenExchangeRate, 18).atomics); } - - if (message.supply_APY !== "") { - writer.uint32(42).string(message.supply_APY); + if (message.supplyAPY !== "") { + writer.uint32(42).string(Decimal.fromUserInput(message.supplyAPY, 18).atomics); } - - if (message.borrow_APY !== "") { - writer.uint32(50).string(message.borrow_APY); + if (message.borrowAPY !== "") { + writer.uint32(50).string(Decimal.fromUserInput(message.borrowAPY, 18).atomics); } - if (message.supplied !== "") { writer.uint32(58).string(message.supplied); } - if (message.reserved !== "") { writer.uint32(66).string(message.reserved); } - if (message.collateral !== "") { writer.uint32(74).string(message.collateral); } - if (message.borrowed !== "") { writer.uint32(82).string(message.borrowed); } - if (message.liquidity !== "") { writer.uint32(90).string(message.liquidity); } - if (message.maximumBorrow !== "") { writer.uint32(98).string(message.maximumBorrow); } - if (message.maximumCollateral !== "") { writer.uint32(106).string(message.maximumCollateral); } - if (message.minimumLiquidity !== "") { writer.uint32(114).string(message.minimumLiquidity); } - if (message.uTokenSupply !== "") { writer.uint32(122).string(message.uTokenSupply); } - if (message.availableBorrow !== "") { writer.uint32(130).string(message.availableBorrow); } - if (message.availableWithdraw !== "") { writer.uint32(138).string(message.availableWithdraw); } - if (message.availableCollateralize !== "") { writer.uint32(146).string(message.availableCollateralize); } - + if (message.oracleHistoricPrice !== undefined) { + writer.uint32(154).string(Decimal.fromUserInput(message.oracleHistoricPrice, 18).atomics); + } + if (message.errors !== "") { + writer.uint32(162).string(message.errors); + } return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryMarketSummaryResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryMarketSummaryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMarketSummaryResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.symbolDenom = reader.string(); break; - case 2: message.exponent = reader.uint32(); break; - case 3: - message.oraclePrice = reader.string(); + message.oraclePrice = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 4: - message.uTokenExchangeRate = reader.string(); + message.uTokenExchangeRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 5: - message.supply_APY = reader.string(); + message.supplyAPY = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 6: - message.borrow_APY = reader.string(); + message.borrowAPY = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 7: message.supplied = reader.string(); break; - case 8: message.reserved = reader.string(); break; - case 9: message.collateral = reader.string(); break; - case 10: message.borrowed = reader.string(); break; - case 11: message.liquidity = reader.string(); break; - case 12: message.maximumBorrow = reader.string(); break; - case 13: message.maximumCollateral = reader.string(); break; - case 14: message.minimumLiquidity = reader.string(); break; - case 15: message.uTokenSupply = reader.string(); break; - case 16: message.availableBorrow = reader.string(); break; - case 17: message.availableWithdraw = reader.string(); break; - case 18: message.availableCollateralize = reader.string(); break; - + case 19: + message.oracleHistoricPrice = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 20: + message.errors = reader.string(); + break; default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryMarketSummaryResponse { + fromPartial(object: Partial): QueryMarketSummaryResponse { const message = createBaseQueryMarketSummaryResponse(); message.symbolDenom = object.symbolDenom ?? ""; message.exponent = object.exponent ?? 0; message.oraclePrice = object.oraclePrice ?? undefined; message.uTokenExchangeRate = object.uTokenExchangeRate ?? ""; - message.supply_APY = object.supply_APY ?? ""; - message.borrow_APY = object.borrow_APY ?? ""; + message.supplyAPY = object.supplyAPY ?? ""; + message.borrowAPY = object.borrowAPY ?? ""; message.supplied = object.supplied ?? ""; message.reserved = object.reserved ?? ""; message.collateral = object.collateral ?? ""; @@ -719,56 +1511,177 @@ export const QueryMarketSummaryResponse = { message.availableBorrow = object.availableBorrow ?? ""; message.availableWithdraw = object.availableWithdraw ?? ""; message.availableCollateralize = object.availableCollateralize ?? ""; + message.oracleHistoricPrice = object.oracleHistoricPrice ?? undefined; + message.errors = object.errors ?? ""; + return message; + }, + fromAmino(object: QueryMarketSummaryResponseAmino): QueryMarketSummaryResponse { + const message = createBaseQueryMarketSummaryResponse(); + if (object.symbol_denom !== undefined && object.symbol_denom !== null) { + message.symbolDenom = object.symbol_denom; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + if (object.oracle_price !== undefined && object.oracle_price !== null) { + message.oraclePrice = object.oracle_price; + } + if (object.uToken_exchange_rate !== undefined && object.uToken_exchange_rate !== null) { + message.uTokenExchangeRate = object.uToken_exchange_rate; + } + if (object.supply_APY !== undefined && object.supply_APY !== null) { + message.supplyAPY = object.supply_APY; + } + if (object.borrow_APY !== undefined && object.borrow_APY !== null) { + message.borrowAPY = object.borrow_APY; + } + if (object.supplied !== undefined && object.supplied !== null) { + message.supplied = object.supplied; + } + if (object.reserved !== undefined && object.reserved !== null) { + message.reserved = object.reserved; + } + if (object.collateral !== undefined && object.collateral !== null) { + message.collateral = object.collateral; + } + if (object.borrowed !== undefined && object.borrowed !== null) { + message.borrowed = object.borrowed; + } + if (object.liquidity !== undefined && object.liquidity !== null) { + message.liquidity = object.liquidity; + } + if (object.maximum_borrow !== undefined && object.maximum_borrow !== null) { + message.maximumBorrow = object.maximum_borrow; + } + if (object.maximum_collateral !== undefined && object.maximum_collateral !== null) { + message.maximumCollateral = object.maximum_collateral; + } + if (object.minimum_liquidity !== undefined && object.minimum_liquidity !== null) { + message.minimumLiquidity = object.minimum_liquidity; + } + if (object.uToken_supply !== undefined && object.uToken_supply !== null) { + message.uTokenSupply = object.uToken_supply; + } + if (object.available_borrow !== undefined && object.available_borrow !== null) { + message.availableBorrow = object.available_borrow; + } + if (object.available_withdraw !== undefined && object.available_withdraw !== null) { + message.availableWithdraw = object.available_withdraw; + } + if (object.available_collateralize !== undefined && object.available_collateralize !== null) { + message.availableCollateralize = object.available_collateralize; + } + if (object.oracle_historic_price !== undefined && object.oracle_historic_price !== null) { + message.oracleHistoricPrice = object.oracle_historic_price; + } + if (object.errors !== undefined && object.errors !== null) { + message.errors = object.errors; + } return message; + }, + toAmino(message: QueryMarketSummaryResponse): QueryMarketSummaryResponseAmino { + const obj: any = {}; + obj.symbol_denom = message.symbolDenom; + obj.exponent = message.exponent; + obj.oracle_price = message.oraclePrice; + obj.uToken_exchange_rate = message.uTokenExchangeRate; + obj.supply_APY = message.supplyAPY; + obj.borrow_APY = message.borrowAPY; + obj.supplied = message.supplied; + obj.reserved = message.reserved; + obj.collateral = message.collateral; + obj.borrowed = message.borrowed; + obj.liquidity = message.liquidity; + obj.maximum_borrow = message.maximumBorrow; + obj.maximum_collateral = message.maximumCollateral; + obj.minimum_liquidity = message.minimumLiquidity; + obj.uToken_supply = message.uTokenSupply; + obj.available_borrow = message.availableBorrow; + obj.available_withdraw = message.availableWithdraw; + obj.available_collateralize = message.availableCollateralize; + obj.oracle_historic_price = message.oracleHistoricPrice; + obj.errors = message.errors; + return obj; + }, + fromAminoMsg(object: QueryMarketSummaryResponseAminoMsg): QueryMarketSummaryResponse { + return QueryMarketSummaryResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMarketSummaryResponseProtoMsg): QueryMarketSummaryResponse { + return QueryMarketSummaryResponse.decode(message.value); + }, + toProto(message: QueryMarketSummaryResponse): Uint8Array { + return QueryMarketSummaryResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryMarketSummaryResponse): QueryMarketSummaryResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryMarketSummaryResponse", + value: QueryMarketSummaryResponse.encode(message).finish() + }; } - }; - function createBaseQueryAccountBalances(): QueryAccountBalances { return { address: "" }; } - export const QueryAccountBalances = { - encode(message: QueryAccountBalances, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryAccountBalances", + encode(message: QueryAccountBalances, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountBalances { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountBalances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAccountBalances(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAccountBalances { + fromPartial(object: Partial): QueryAccountBalances { const message = createBaseQueryAccountBalances(); message.address = object.address ?? ""; return message; + }, + fromAmino(object: QueryAccountBalancesAmino): QueryAccountBalances { + const message = createBaseQueryAccountBalances(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountBalances): QueryAccountBalancesAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountBalancesAminoMsg): QueryAccountBalances { + return QueryAccountBalances.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAccountBalancesProtoMsg): QueryAccountBalances { + return QueryAccountBalances.decode(message.value); + }, + toProto(message: QueryAccountBalances): Uint8Array { + return QueryAccountBalances.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountBalances): QueryAccountBalancesProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryAccountBalances", + value: QueryAccountBalances.encode(message).finish() + }; } - }; - function createBaseQueryAccountBalancesResponse(): QueryAccountBalancesResponse { return { supplied: [], @@ -776,348 +1689,1404 @@ function createBaseQueryAccountBalancesResponse(): QueryAccountBalancesResponse borrowed: [] }; } - export const QueryAccountBalancesResponse = { - encode(message: QueryAccountBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryAccountBalancesResponse", + encode(message: QueryAccountBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.supplied) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - for (const v of message.collateral) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.borrowed) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountBalancesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAccountBalancesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.supplied.push(Coin.decode(reader, reader.uint32())); break; - case 2: message.collateral.push(Coin.decode(reader, reader.uint32())); break; - case 3: message.borrowed.push(Coin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAccountBalancesResponse { + fromPartial(object: Partial): QueryAccountBalancesResponse { const message = createBaseQueryAccountBalancesResponse(); message.supplied = object.supplied?.map(e => Coin.fromPartial(e)) || []; message.collateral = object.collateral?.map(e => Coin.fromPartial(e)) || []; message.borrowed = object.borrowed?.map(e => Coin.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryAccountBalancesResponseAmino): QueryAccountBalancesResponse { + const message = createBaseQueryAccountBalancesResponse(); + message.supplied = object.supplied?.map(e => Coin.fromAmino(e)) || []; + message.collateral = object.collateral?.map(e => Coin.fromAmino(e)) || []; + message.borrowed = object.borrowed?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryAccountBalancesResponse): QueryAccountBalancesResponseAmino { + const obj: any = {}; + if (message.supplied) { + obj.supplied = message.supplied.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.supplied = []; + } + if (message.collateral) { + obj.collateral = message.collateral.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.collateral = []; + } + if (message.borrowed) { + obj.borrowed = message.borrowed.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.borrowed = []; + } + return obj; + }, + fromAminoMsg(object: QueryAccountBalancesResponseAminoMsg): QueryAccountBalancesResponse { + return QueryAccountBalancesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAccountBalancesResponseProtoMsg): QueryAccountBalancesResponse { + return QueryAccountBalancesResponse.decode(message.value); + }, + toProto(message: QueryAccountBalancesResponse): Uint8Array { + return QueryAccountBalancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountBalancesResponse): QueryAccountBalancesResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryAccountBalancesResponse", + value: QueryAccountBalancesResponse.encode(message).finish() + }; } - }; - function createBaseQueryAccountSummary(): QueryAccountSummary { return { address: "" }; } - export const QueryAccountSummary = { - encode(message: QueryAccountSummary, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryAccountSummary", + encode(message: QueryAccountSummary, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountSummary { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountSummary { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAccountSummary(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.address = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAccountSummary { + fromPartial(object: Partial): QueryAccountSummary { const message = createBaseQueryAccountSummary(); message.address = object.address ?? ""; return message; + }, + fromAmino(object: QueryAccountSummaryAmino): QueryAccountSummary { + const message = createBaseQueryAccountSummary(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountSummary): QueryAccountSummaryAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountSummaryAminoMsg): QueryAccountSummary { + return QueryAccountSummary.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAccountSummaryProtoMsg): QueryAccountSummary { + return QueryAccountSummary.decode(message.value); + }, + toProto(message: QueryAccountSummary): Uint8Array { + return QueryAccountSummary.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountSummary): QueryAccountSummaryProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryAccountSummary", + value: QueryAccountSummary.encode(message).finish() + }; } - }; - function createBaseQueryAccountSummaryResponse(): QueryAccountSummaryResponse { return { suppliedValue: "", collateralValue: "", borrowedValue: "", - borrowLimit: "", - liquidationThreshold: "" + borrowLimit: undefined, + liquidationThreshold: undefined, + spotSuppliedValue: "", + spotCollateralValue: "", + spotBorrowedValue: "" }; } - export const QueryAccountSummaryResponse = { - encode(message: QueryAccountSummaryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryAccountSummaryResponse", + encode(message: QueryAccountSummaryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.suppliedValue !== "") { - writer.uint32(10).string(message.suppliedValue); + writer.uint32(10).string(Decimal.fromUserInput(message.suppliedValue, 18).atomics); } - if (message.collateralValue !== "") { - writer.uint32(18).string(message.collateralValue); + writer.uint32(18).string(Decimal.fromUserInput(message.collateralValue, 18).atomics); } - if (message.borrowedValue !== "") { - writer.uint32(26).string(message.borrowedValue); + writer.uint32(26).string(Decimal.fromUserInput(message.borrowedValue, 18).atomics); + } + if (message.borrowLimit !== undefined) { + writer.uint32(34).string(Decimal.fromUserInput(message.borrowLimit, 18).atomics); + } + if (message.liquidationThreshold !== undefined) { + writer.uint32(42).string(Decimal.fromUserInput(message.liquidationThreshold, 18).atomics); } - - if (message.borrowLimit !== "") { - writer.uint32(34).string(message.borrowLimit); + if (message.spotSuppliedValue !== "") { + writer.uint32(50).string(Decimal.fromUserInput(message.spotSuppliedValue, 18).atomics); } - - if (message.liquidationThreshold !== "") { - writer.uint32(42).string(message.liquidationThreshold); + if (message.spotCollateralValue !== "") { + writer.uint32(58).string(Decimal.fromUserInput(message.spotCollateralValue, 18).atomics); + } + if (message.spotBorrowedValue !== "") { + writer.uint32(66).string(Decimal.fromUserInput(message.spotBorrowedValue, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountSummaryResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountSummaryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAccountSummaryResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.suppliedValue = reader.string(); + message.suppliedValue = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 2: - message.collateralValue = reader.string(); + message.collateralValue = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 3: - message.borrowedValue = reader.string(); + message.borrowedValue = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 4: - message.borrowLimit = reader.string(); + message.borrowLimit = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 5: - message.liquidationThreshold = reader.string(); + message.liquidationThreshold = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 6: + message.spotSuppliedValue = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 7: + message.spotCollateralValue = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 8: + message.spotBorrowedValue = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAccountSummaryResponse { + fromPartial(object: Partial): QueryAccountSummaryResponse { const message = createBaseQueryAccountSummaryResponse(); message.suppliedValue = object.suppliedValue ?? ""; message.collateralValue = object.collateralValue ?? ""; message.borrowedValue = object.borrowedValue ?? ""; - message.borrowLimit = object.borrowLimit ?? ""; - message.liquidationThreshold = object.liquidationThreshold ?? ""; + message.borrowLimit = object.borrowLimit ?? undefined; + message.liquidationThreshold = object.liquidationThreshold ?? undefined; + message.spotSuppliedValue = object.spotSuppliedValue ?? ""; + message.spotCollateralValue = object.spotCollateralValue ?? ""; + message.spotBorrowedValue = object.spotBorrowedValue ?? ""; + return message; + }, + fromAmino(object: QueryAccountSummaryResponseAmino): QueryAccountSummaryResponse { + const message = createBaseQueryAccountSummaryResponse(); + if (object.supplied_value !== undefined && object.supplied_value !== null) { + message.suppliedValue = object.supplied_value; + } + if (object.collateral_value !== undefined && object.collateral_value !== null) { + message.collateralValue = object.collateral_value; + } + if (object.borrowed_value !== undefined && object.borrowed_value !== null) { + message.borrowedValue = object.borrowed_value; + } + if (object.borrow_limit !== undefined && object.borrow_limit !== null) { + message.borrowLimit = object.borrow_limit; + } + if (object.liquidation_threshold !== undefined && object.liquidation_threshold !== null) { + message.liquidationThreshold = object.liquidation_threshold; + } + if (object.spot_supplied_value !== undefined && object.spot_supplied_value !== null) { + message.spotSuppliedValue = object.spot_supplied_value; + } + if (object.spot_collateral_value !== undefined && object.spot_collateral_value !== null) { + message.spotCollateralValue = object.spot_collateral_value; + } + if (object.spot_borrowed_value !== undefined && object.spot_borrowed_value !== null) { + message.spotBorrowedValue = object.spot_borrowed_value; + } return message; + }, + toAmino(message: QueryAccountSummaryResponse): QueryAccountSummaryResponseAmino { + const obj: any = {}; + obj.supplied_value = message.suppliedValue; + obj.collateral_value = message.collateralValue; + obj.borrowed_value = message.borrowedValue; + obj.borrow_limit = message.borrowLimit; + obj.liquidation_threshold = message.liquidationThreshold; + obj.spot_supplied_value = message.spotSuppliedValue; + obj.spot_collateral_value = message.spotCollateralValue; + obj.spot_borrowed_value = message.spotBorrowedValue; + return obj; + }, + fromAminoMsg(object: QueryAccountSummaryResponseAminoMsg): QueryAccountSummaryResponse { + return QueryAccountSummaryResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAccountSummaryResponseProtoMsg): QueryAccountSummaryResponse { + return QueryAccountSummaryResponse.decode(message.value); + }, + toProto(message: QueryAccountSummaryResponse): Uint8Array { + return QueryAccountSummaryResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountSummaryResponse): QueryAccountSummaryResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryAccountSummaryResponse", + value: QueryAccountSummaryResponse.encode(message).finish() + }; } - }; - function createBaseQueryLiquidationTargets(): QueryLiquidationTargets { return {}; } - export const QueryLiquidationTargets = { - encode(_: QueryLiquidationTargets, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryLiquidationTargets", + encode(_: QueryLiquidationTargets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryLiquidationTargets { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryLiquidationTargets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryLiquidationTargets(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryLiquidationTargets { + fromPartial(_: Partial): QueryLiquidationTargets { + const message = createBaseQueryLiquidationTargets(); + return message; + }, + fromAmino(_: QueryLiquidationTargetsAmino): QueryLiquidationTargets { const message = createBaseQueryLiquidationTargets(); return message; + }, + toAmino(_: QueryLiquidationTargets): QueryLiquidationTargetsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryLiquidationTargetsAminoMsg): QueryLiquidationTargets { + return QueryLiquidationTargets.fromAmino(object.value); + }, + fromProtoMsg(message: QueryLiquidationTargetsProtoMsg): QueryLiquidationTargets { + return QueryLiquidationTargets.decode(message.value); + }, + toProto(message: QueryLiquidationTargets): Uint8Array { + return QueryLiquidationTargets.encode(message).finish(); + }, + toProtoMsg(message: QueryLiquidationTargets): QueryLiquidationTargetsProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryLiquidationTargets", + value: QueryLiquidationTargets.encode(message).finish() + }; } - }; - function createBaseQueryLiquidationTargetsResponse(): QueryLiquidationTargetsResponse { return { targets: [] }; } - export const QueryLiquidationTargetsResponse = { - encode(message: QueryLiquidationTargetsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryLiquidationTargetsResponse", + encode(message: QueryLiquidationTargetsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.targets) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryLiquidationTargetsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryLiquidationTargetsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryLiquidationTargetsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.targets.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryLiquidationTargetsResponse { + fromPartial(object: Partial): QueryLiquidationTargetsResponse { + const message = createBaseQueryLiquidationTargetsResponse(); + message.targets = object.targets?.map(e => e) || []; + return message; + }, + fromAmino(object: QueryLiquidationTargetsResponseAmino): QueryLiquidationTargetsResponse { const message = createBaseQueryLiquidationTargetsResponse(); message.targets = object.targets?.map(e => e) || []; return message; + }, + toAmino(message: QueryLiquidationTargetsResponse): QueryLiquidationTargetsResponseAmino { + const obj: any = {}; + if (message.targets) { + obj.targets = message.targets.map(e => e); + } else { + obj.targets = []; + } + return obj; + }, + fromAminoMsg(object: QueryLiquidationTargetsResponseAminoMsg): QueryLiquidationTargetsResponse { + return QueryLiquidationTargetsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryLiquidationTargetsResponseProtoMsg): QueryLiquidationTargetsResponse { + return QueryLiquidationTargetsResponse.decode(message.value); + }, + toProto(message: QueryLiquidationTargetsResponse): Uint8Array { + return QueryLiquidationTargetsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryLiquidationTargetsResponse): QueryLiquidationTargetsResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryLiquidationTargetsResponse", + value: QueryLiquidationTargetsResponse.encode(message).finish() + }; } - }; - function createBaseQueryBadDebts(): QueryBadDebts { return {}; } - export const QueryBadDebts = { - encode(_: QueryBadDebts, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryBadDebts", + encode(_: QueryBadDebts, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryBadDebts { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryBadDebts { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryBadDebts(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryBadDebts { + fromPartial(_: Partial): QueryBadDebts { + const message = createBaseQueryBadDebts(); + return message; + }, + fromAmino(_: QueryBadDebtsAmino): QueryBadDebts { const message = createBaseQueryBadDebts(); return message; + }, + toAmino(_: QueryBadDebts): QueryBadDebtsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryBadDebtsAminoMsg): QueryBadDebts { + return QueryBadDebts.fromAmino(object.value); + }, + fromProtoMsg(message: QueryBadDebtsProtoMsg): QueryBadDebts { + return QueryBadDebts.decode(message.value); + }, + toProto(message: QueryBadDebts): Uint8Array { + return QueryBadDebts.encode(message).finish(); + }, + toProtoMsg(message: QueryBadDebts): QueryBadDebtsProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryBadDebts", + value: QueryBadDebts.encode(message).finish() + }; } - }; - function createBaseQueryBadDebtsResponse(): QueryBadDebtsResponse { return { targets: [] }; } - export const QueryBadDebtsResponse = { - encode(message: QueryBadDebtsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.QueryBadDebtsResponse", + encode(message: QueryBadDebtsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.targets) { BadDebt.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryBadDebtsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryBadDebtsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryBadDebtsResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.targets.push(BadDebt.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryBadDebtsResponse { + fromPartial(object: Partial): QueryBadDebtsResponse { const message = createBaseQueryBadDebtsResponse(); message.targets = object.targets?.map(e => BadDebt.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryBadDebtsResponseAmino): QueryBadDebtsResponse { + const message = createBaseQueryBadDebtsResponse(); + message.targets = object.targets?.map(e => BadDebt.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryBadDebtsResponse): QueryBadDebtsResponseAmino { + const obj: any = {}; + if (message.targets) { + obj.targets = message.targets.map(e => e ? BadDebt.toAmino(e) : undefined); + } else { + obj.targets = []; + } + return obj; + }, + fromAminoMsg(object: QueryBadDebtsResponseAminoMsg): QueryBadDebtsResponse { + return QueryBadDebtsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryBadDebtsResponseProtoMsg): QueryBadDebtsResponse { + return QueryBadDebtsResponse.decode(message.value); + }, + toProto(message: QueryBadDebtsResponse): Uint8Array { + return QueryBadDebtsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryBadDebtsResponse): QueryBadDebtsResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryBadDebtsResponse", + value: QueryBadDebtsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryMaxWithdraw(): QueryMaxWithdraw { + return { + address: "", + denom: "" + }; +} +export const QueryMaxWithdraw = { + typeUrl: "/umee.leverage.v1.QueryMaxWithdraw", + encode(message: QueryMaxWithdraw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMaxWithdraw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMaxWithdraw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMaxWithdraw { + const message = createBaseQueryMaxWithdraw(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryMaxWithdrawAmino): QueryMaxWithdraw { + const message = createBaseQueryMaxWithdraw(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryMaxWithdraw): QueryMaxWithdrawAmino { + const obj: any = {}; + obj.address = message.address; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryMaxWithdrawAminoMsg): QueryMaxWithdraw { + return QueryMaxWithdraw.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMaxWithdrawProtoMsg): QueryMaxWithdraw { + return QueryMaxWithdraw.decode(message.value); + }, + toProto(message: QueryMaxWithdraw): Uint8Array { + return QueryMaxWithdraw.encode(message).finish(); + }, + toProtoMsg(message: QueryMaxWithdraw): QueryMaxWithdrawProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryMaxWithdraw", + value: QueryMaxWithdraw.encode(message).finish() + }; + } +}; +function createBaseQueryMaxWithdrawResponse(): QueryMaxWithdrawResponse { + return { + uTokens: [], + tokens: [] + }; +} +export const QueryMaxWithdrawResponse = { + typeUrl: "/umee.leverage.v1.QueryMaxWithdrawResponse", + encode(message: QueryMaxWithdrawResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.uTokens) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.tokens) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMaxWithdrawResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMaxWithdrawResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uTokens.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.tokens.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMaxWithdrawResponse { + const message = createBaseQueryMaxWithdrawResponse(); + message.uTokens = object.uTokens?.map(e => Coin.fromPartial(e)) || []; + message.tokens = object.tokens?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryMaxWithdrawResponseAmino): QueryMaxWithdrawResponse { + const message = createBaseQueryMaxWithdrawResponse(); + message.uTokens = object.uTokens?.map(e => Coin.fromAmino(e)) || []; + message.tokens = object.tokens?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryMaxWithdrawResponse): QueryMaxWithdrawResponseAmino { + const obj: any = {}; + if (message.uTokens) { + obj.uTokens = message.uTokens.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.uTokens = []; + } + if (message.tokens) { + obj.tokens = message.tokens.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.tokens = []; + } + return obj; + }, + fromAminoMsg(object: QueryMaxWithdrawResponseAminoMsg): QueryMaxWithdrawResponse { + return QueryMaxWithdrawResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMaxWithdrawResponseProtoMsg): QueryMaxWithdrawResponse { + return QueryMaxWithdrawResponse.decode(message.value); + }, + toProto(message: QueryMaxWithdrawResponse): Uint8Array { + return QueryMaxWithdrawResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryMaxWithdrawResponse): QueryMaxWithdrawResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryMaxWithdrawResponse", + value: QueryMaxWithdrawResponse.encode(message).finish() + }; + } +}; +function createBaseQueryMaxBorrow(): QueryMaxBorrow { + return { + address: "", + denom: "" + }; +} +export const QueryMaxBorrow = { + typeUrl: "/umee.leverage.v1.QueryMaxBorrow", + encode(message: QueryMaxBorrow, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMaxBorrow { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMaxBorrow(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMaxBorrow { + const message = createBaseQueryMaxBorrow(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryMaxBorrowAmino): QueryMaxBorrow { + const message = createBaseQueryMaxBorrow(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryMaxBorrow): QueryMaxBorrowAmino { + const obj: any = {}; + obj.address = message.address; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryMaxBorrowAminoMsg): QueryMaxBorrow { + return QueryMaxBorrow.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMaxBorrowProtoMsg): QueryMaxBorrow { + return QueryMaxBorrow.decode(message.value); + }, + toProto(message: QueryMaxBorrow): Uint8Array { + return QueryMaxBorrow.encode(message).finish(); + }, + toProtoMsg(message: QueryMaxBorrow): QueryMaxBorrowProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryMaxBorrow", + value: QueryMaxBorrow.encode(message).finish() + }; + } +}; +function createBaseQueryMaxBorrowResponse(): QueryMaxBorrowResponse { + return { + tokens: [] + }; +} +export const QueryMaxBorrowResponse = { + typeUrl: "/umee.leverage.v1.QueryMaxBorrowResponse", + encode(message: QueryMaxBorrowResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.tokens) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMaxBorrowResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMaxBorrowResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tokens.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMaxBorrowResponse { + const message = createBaseQueryMaxBorrowResponse(); + message.tokens = object.tokens?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryMaxBorrowResponseAmino): QueryMaxBorrowResponse { + const message = createBaseQueryMaxBorrowResponse(); + message.tokens = object.tokens?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryMaxBorrowResponse): QueryMaxBorrowResponseAmino { + const obj: any = {}; + if (message.tokens) { + obj.tokens = message.tokens.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.tokens = []; + } + return obj; + }, + fromAminoMsg(object: QueryMaxBorrowResponseAminoMsg): QueryMaxBorrowResponse { + return QueryMaxBorrowResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMaxBorrowResponseProtoMsg): QueryMaxBorrowResponse { + return QueryMaxBorrowResponse.decode(message.value); + }, + toProto(message: QueryMaxBorrowResponse): Uint8Array { + return QueryMaxBorrowResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryMaxBorrowResponse): QueryMaxBorrowResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryMaxBorrowResponse", + value: QueryMaxBorrowResponse.encode(message).finish() + }; + } +}; +function createBaseQueryInspect(): QueryInspect { + return { + symbol: "", + borrowed: 0, + collateral: 0, + danger: 0, + ltv: 0 + }; +} +export const QueryInspect = { + typeUrl: "/umee.leverage.v1.QueryInspect", + encode(message: QueryInspect, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.symbol !== "") { + writer.uint32(10).string(message.symbol); + } + if (message.borrowed !== 0) { + writer.uint32(17).double(message.borrowed); + } + if (message.collateral !== 0) { + writer.uint32(25).double(message.collateral); + } + if (message.danger !== 0) { + writer.uint32(33).double(message.danger); + } + if (message.ltv !== 0) { + writer.uint32(41).double(message.ltv); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInspect { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInspect(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.symbol = reader.string(); + break; + case 2: + message.borrowed = reader.double(); + break; + case 3: + message.collateral = reader.double(); + break; + case 4: + message.danger = reader.double(); + break; + case 5: + message.ltv = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryInspect { + const message = createBaseQueryInspect(); + message.symbol = object.symbol ?? ""; + message.borrowed = object.borrowed ?? 0; + message.collateral = object.collateral ?? 0; + message.danger = object.danger ?? 0; + message.ltv = object.ltv ?? 0; + return message; + }, + fromAmino(object: QueryInspectAmino): QueryInspect { + const message = createBaseQueryInspect(); + if (object.symbol !== undefined && object.symbol !== null) { + message.symbol = object.symbol; + } + if (object.borrowed !== undefined && object.borrowed !== null) { + message.borrowed = object.borrowed; + } + if (object.collateral !== undefined && object.collateral !== null) { + message.collateral = object.collateral; + } + if (object.danger !== undefined && object.danger !== null) { + message.danger = object.danger; + } + if (object.ltv !== undefined && object.ltv !== null) { + message.ltv = object.ltv; + } + return message; + }, + toAmino(message: QueryInspect): QueryInspectAmino { + const obj: any = {}; + obj.symbol = message.symbol; + obj.borrowed = message.borrowed; + obj.collateral = message.collateral; + obj.danger = message.danger; + obj.ltv = message.ltv; + return obj; + }, + fromAminoMsg(object: QueryInspectAminoMsg): QueryInspect { + return QueryInspect.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInspectProtoMsg): QueryInspect { + return QueryInspect.decode(message.value); + }, + toProto(message: QueryInspect): Uint8Array { + return QueryInspect.encode(message).finish(); + }, + toProtoMsg(message: QueryInspect): QueryInspectProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryInspect", + value: QueryInspect.encode(message).finish() + }; + } +}; +function createBaseQueryInspectAccount(): QueryInspectAccount { + return { + address: "" + }; +} +export const QueryInspectAccount = { + typeUrl: "/umee.leverage.v1.QueryInspectAccount", + encode(message: QueryInspectAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInspectAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInspectAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryInspectAccount { + const message = createBaseQueryInspectAccount(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryInspectAccountAmino): QueryInspectAccount { + const message = createBaseQueryInspectAccount(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryInspectAccount): QueryInspectAccountAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryInspectAccountAminoMsg): QueryInspectAccount { + return QueryInspectAccount.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInspectAccountProtoMsg): QueryInspectAccount { + return QueryInspectAccount.decode(message.value); + }, + toProto(message: QueryInspectAccount): Uint8Array { + return QueryInspectAccount.encode(message).finish(); + }, + toProtoMsg(message: QueryInspectAccount): QueryInspectAccountProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryInspectAccount", + value: QueryInspectAccount.encode(message).finish() + }; + } +}; +function createBaseQueryInspectResponse(): QueryInspectResponse { + return { + borrowers: [], + failures: [] + }; +} +export const QueryInspectResponse = { + typeUrl: "/umee.leverage.v1.QueryInspectResponse", + encode(message: QueryInspectResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.borrowers) { + InspectAccount.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.failures) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInspectResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInspectResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.borrowers.push(InspectAccount.decode(reader, reader.uint32())); + break; + case 2: + message.failures.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryInspectResponse { + const message = createBaseQueryInspectResponse(); + message.borrowers = object.borrowers?.map(e => InspectAccount.fromPartial(e)) || []; + message.failures = object.failures?.map(e => e) || []; + return message; + }, + fromAmino(object: QueryInspectResponseAmino): QueryInspectResponse { + const message = createBaseQueryInspectResponse(); + message.borrowers = object.borrowers?.map(e => InspectAccount.fromAmino(e)) || []; + message.failures = object.failures?.map(e => e) || []; + return message; + }, + toAmino(message: QueryInspectResponse): QueryInspectResponseAmino { + const obj: any = {}; + if (message.borrowers) { + obj.borrowers = message.borrowers.map(e => e ? InspectAccount.toAmino(e) : undefined); + } else { + obj.borrowers = []; + } + if (message.failures) { + obj.failures = message.failures.map(e => e); + } else { + obj.failures = []; + } + return obj; + }, + fromAminoMsg(object: QueryInspectResponseAminoMsg): QueryInspectResponse { + return QueryInspectResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInspectResponseProtoMsg): QueryInspectResponse { + return QueryInspectResponse.decode(message.value); + }, + toProto(message: QueryInspectResponse): Uint8Array { + return QueryInspectResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryInspectResponse): QueryInspectResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryInspectResponse", + value: QueryInspectResponse.encode(message).finish() + }; + } +}; +function createBaseQueryInspectAccountResponse(): QueryInspectAccountResponse { + return { + borrower: InspectAccount.fromPartial({}) + }; +} +export const QueryInspectAccountResponse = { + typeUrl: "/umee.leverage.v1.QueryInspectAccountResponse", + encode(message: QueryInspectAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.borrower !== undefined) { + InspectAccount.encode(message.borrower, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInspectAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInspectAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.borrower = InspectAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryInspectAccountResponse { + const message = createBaseQueryInspectAccountResponse(); + message.borrower = object.borrower !== undefined && object.borrower !== null ? InspectAccount.fromPartial(object.borrower) : undefined; + return message; + }, + fromAmino(object: QueryInspectAccountResponseAmino): QueryInspectAccountResponse { + const message = createBaseQueryInspectAccountResponse(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = InspectAccount.fromAmino(object.borrower); + } + return message; + }, + toAmino(message: QueryInspectAccountResponse): QueryInspectAccountResponseAmino { + const obj: any = {}; + obj.borrower = message.borrower ? InspectAccount.toAmino(message.borrower) : undefined; + return obj; + }, + fromAminoMsg(object: QueryInspectAccountResponseAminoMsg): QueryInspectAccountResponse { + return QueryInspectAccountResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInspectAccountResponseProtoMsg): QueryInspectAccountResponse { + return QueryInspectAccountResponse.decode(message.value); + }, + toProto(message: QueryInspectAccountResponse): Uint8Array { + return QueryInspectAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryInspectAccountResponse): QueryInspectAccountResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.QueryInspectAccountResponse", + value: QueryInspectAccountResponse.encode(message).finish() + }; + } +}; +function createBaseInspectAccount(): InspectAccount { + return { + address: "", + analysis: undefined, + position: undefined, + info: "" + }; +} +export const InspectAccount = { + typeUrl: "/umee.leverage.v1.InspectAccount", + encode(message: InspectAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.analysis !== undefined) { + RiskInfo.encode(message.analysis, writer.uint32(18).fork()).ldelim(); + } + if (message.position !== undefined) { + DecBalances.encode(message.position, writer.uint32(26).fork()).ldelim(); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InspectAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInspectAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.analysis = RiskInfo.decode(reader, reader.uint32()); + break; + case 3: + message.position = DecBalances.decode(reader, reader.uint32()); + break; + case 4: + message.info = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): InspectAccount { + const message = createBaseInspectAccount(); + message.address = object.address ?? ""; + message.analysis = object.analysis !== undefined && object.analysis !== null ? RiskInfo.fromPartial(object.analysis) : undefined; + message.position = object.position !== undefined && object.position !== null ? DecBalances.fromPartial(object.position) : undefined; + message.info = object.info ?? ""; + return message; + }, + fromAmino(object: InspectAccountAmino): InspectAccount { + const message = createBaseInspectAccount(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.analysis !== undefined && object.analysis !== null) { + message.analysis = RiskInfo.fromAmino(object.analysis); + } + if (object.position !== undefined && object.position !== null) { + message.position = DecBalances.fromAmino(object.position); + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + return message; + }, + toAmino(message: InspectAccount): InspectAccountAmino { + const obj: any = {}; + obj.address = message.address; + obj.analysis = message.analysis ? RiskInfo.toAmino(message.analysis) : undefined; + obj.position = message.position ? DecBalances.toAmino(message.position) : undefined; + obj.info = message.info; + return obj; + }, + fromAminoMsg(object: InspectAccountAminoMsg): InspectAccount { + return InspectAccount.fromAmino(object.value); + }, + fromProtoMsg(message: InspectAccountProtoMsg): InspectAccount { + return InspectAccount.decode(message.value); + }, + toProto(message: InspectAccount): Uint8Array { + return InspectAccount.encode(message).finish(); + }, + toProtoMsg(message: InspectAccount): InspectAccountProtoMsg { + return { + typeUrl: "/umee.leverage.v1.InspectAccount", + value: InspectAccount.encode(message).finish() + }; + } +}; +function createBaseRiskInfo(): RiskInfo { + return { + Borrowed: 0, + Liquidation: 0, + Value: 0 + }; +} +export const RiskInfo = { + typeUrl: "/umee.leverage.v1.RiskInfo", + encode(message: RiskInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.Borrowed !== 0) { + writer.uint32(9).double(message.Borrowed); + } + if (message.Liquidation !== 0) { + writer.uint32(17).double(message.Liquidation); + } + if (message.Value !== 0) { + writer.uint32(25).double(message.Value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RiskInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRiskInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.Borrowed = reader.double(); + break; + case 2: + message.Liquidation = reader.double(); + break; + case 3: + message.Value = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): RiskInfo { + const message = createBaseRiskInfo(); + message.Borrowed = object.Borrowed ?? 0; + message.Liquidation = object.Liquidation ?? 0; + message.Value = object.Value ?? 0; + return message; + }, + fromAmino(object: RiskInfoAmino): RiskInfo { + const message = createBaseRiskInfo(); + if (object.Borrowed !== undefined && object.Borrowed !== null) { + message.Borrowed = object.Borrowed; + } + if (object.Liquidation !== undefined && object.Liquidation !== null) { + message.Liquidation = object.Liquidation; + } + if (object.Value !== undefined && object.Value !== null) { + message.Value = object.Value; + } + return message; + }, + toAmino(message: RiskInfo): RiskInfoAmino { + const obj: any = {}; + obj.Borrowed = message.Borrowed; + obj.Liquidation = message.Liquidation; + obj.Value = message.Value; + return obj; + }, + fromAminoMsg(object: RiskInfoAminoMsg): RiskInfo { + return RiskInfo.fromAmino(object.value); + }, + fromProtoMsg(message: RiskInfoProtoMsg): RiskInfo { + return RiskInfo.decode(message.value); + }, + toProto(message: RiskInfo): Uint8Array { + return RiskInfo.encode(message).finish(); + }, + toProtoMsg(message: RiskInfo): RiskInfoProtoMsg { + return { + typeUrl: "/umee.leverage.v1.RiskInfo", + value: RiskInfo.encode(message).finish() + }; + } +}; +function createBaseDecBalances(): DecBalances { + return { + collateral: [], + borrowed: [] + }; +} +export const DecBalances = { + typeUrl: "/umee.leverage.v1.DecBalances", + encode(message: DecBalances, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.collateral) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.borrowed) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DecBalances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecBalances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.collateral.push(DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.borrowed.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): DecBalances { + const message = createBaseDecBalances(); + message.collateral = object.collateral?.map(e => DecCoin.fromPartial(e)) || []; + message.borrowed = object.borrowed?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DecBalancesAmino): DecBalances { + const message = createBaseDecBalances(); + message.collateral = object.collateral?.map(e => DecCoin.fromAmino(e)) || []; + message.borrowed = object.borrowed?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: DecBalances): DecBalancesAmino { + const obj: any = {}; + if (message.collateral) { + obj.collateral = message.collateral.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.collateral = []; + } + if (message.borrowed) { + obj.borrowed = message.borrowed.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.borrowed = []; + } + return obj; + }, + fromAminoMsg(object: DecBalancesAminoMsg): DecBalances { + return DecBalances.fromAmino(object.value); + }, + fromProtoMsg(message: DecBalancesProtoMsg): DecBalances { + return DecBalances.decode(message.value); + }, + toProto(message: DecBalances): Uint8Array { + return DecBalances.encode(message).finish(); + }, + toProtoMsg(message: DecBalances): DecBalancesProtoMsg { + return { + typeUrl: "/umee.leverage.v1.DecBalances", + value: DecBalances.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/tx.amino.ts b/src/codegen/umee/leverage/v1/tx.amino.ts index bc88970..43f5a99 100644 --- a/src/codegen/umee/leverage/v1/tx.amino.ts +++ b/src/codegen/umee/leverage/v1/tx.amino.ts @@ -1,311 +1,73 @@ -import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; -import { MsgSupply, MsgWithdraw, MsgCollateralize, MsgDecollateralize, MsgBorrow, MsgRepay, MsgLiquidate, MsgSupplyCollateral } from "./tx"; -export interface AminoMsgSupply extends AminoMsg { - type: "/umee.leverage.v1.MsgSupply"; - value: { - supplier: string; - asset: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgWithdraw extends AminoMsg { - type: "/umee.leverage.v1.MsgWithdraw"; - value: { - supplier: string; - asset: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgCollateralize extends AminoMsg { - type: "/umee.leverage.v1.MsgCollateralize"; - value: { - borrower: string; - asset: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgDecollateralize extends AminoMsg { - type: "/umee.leverage.v1.MsgDecollateralize"; - value: { - borrower: string; - asset: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgBorrow extends AminoMsg { - type: "/umee.leverage.v1.MsgBorrow"; - value: { - borrower: string; - asset: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgRepay extends AminoMsg { - type: "/umee.leverage.v1.MsgRepay"; - value: { - borrower: string; - asset: { - denom: string; - amount: string; - }; - }; -} -export interface AminoMsgLiquidate extends AminoMsg { - type: "/umee.leverage.v1.MsgLiquidate"; - value: { - liquidator: string; - borrower: string; - repayment: { - denom: string; - amount: string; - }; - reward_denom: string; - }; -} -export interface AminoMsgSupplyCollateral extends AminoMsg { - type: "/umee.leverage.v1.MsgSupplyCollateral"; - value: { - supplier: string; - asset: { - denom: string; - amount: string; - }; - }; -} +import { MsgSupply, MsgWithdraw, MsgMaxWithdraw, MsgCollateralize, MsgDecollateralize, MsgBorrow, MsgMaxBorrow, MsgRepay, MsgLiquidate, MsgLeveragedLiquidate, MsgSupplyCollateral, MsgGovUpdateRegistry, MsgGovUpdateSpecialAssets, MsgGovSetParams } from "./tx"; export const AminoConverter = { "/umee.leverage.v1.MsgSupply": { aminoType: "/umee.leverage.v1.MsgSupply", - toAmino: ({ - supplier, - asset - }: MsgSupply): AminoMsgSupply["value"] => { - return { - supplier, - asset: { - denom: asset.denom, - amount: Long.fromValue(asset.amount).toString() - } - }; - }, - fromAmino: ({ - supplier, - asset - }: AminoMsgSupply["value"]): MsgSupply => { - return { - supplier, - asset: { - denom: asset.denom, - amount: asset.amount - } - }; - } + toAmino: MsgSupply.toAmino, + fromAmino: MsgSupply.fromAmino }, "/umee.leverage.v1.MsgWithdraw": { aminoType: "/umee.leverage.v1.MsgWithdraw", - toAmino: ({ - supplier, - asset - }: MsgWithdraw): AminoMsgWithdraw["value"] => { - return { - supplier, - asset: { - denom: asset.denom, - amount: Long.fromValue(asset.amount).toString() - } - }; - }, - fromAmino: ({ - supplier, - asset - }: AminoMsgWithdraw["value"]): MsgWithdraw => { - return { - supplier, - asset: { - denom: asset.denom, - amount: asset.amount - } - }; - } + toAmino: MsgWithdraw.toAmino, + fromAmino: MsgWithdraw.fromAmino + }, + "/umee.leverage.v1.MsgMaxWithdraw": { + aminoType: "/umee.leverage.v1.MsgMaxWithdraw", + toAmino: MsgMaxWithdraw.toAmino, + fromAmino: MsgMaxWithdraw.fromAmino }, "/umee.leverage.v1.MsgCollateralize": { aminoType: "/umee.leverage.v1.MsgCollateralize", - toAmino: ({ - borrower, - asset - }: MsgCollateralize): AminoMsgCollateralize["value"] => { - return { - borrower, - asset: { - denom: asset.denom, - amount: Long.fromValue(asset.amount).toString() - } - }; - }, - fromAmino: ({ - borrower, - asset - }: AminoMsgCollateralize["value"]): MsgCollateralize => { - return { - borrower, - asset: { - denom: asset.denom, - amount: asset.amount - } - }; - } + toAmino: MsgCollateralize.toAmino, + fromAmino: MsgCollateralize.fromAmino }, "/umee.leverage.v1.MsgDecollateralize": { aminoType: "/umee.leverage.v1.MsgDecollateralize", - toAmino: ({ - borrower, - asset - }: MsgDecollateralize): AminoMsgDecollateralize["value"] => { - return { - borrower, - asset: { - denom: asset.denom, - amount: Long.fromValue(asset.amount).toString() - } - }; - }, - fromAmino: ({ - borrower, - asset - }: AminoMsgDecollateralize["value"]): MsgDecollateralize => { - return { - borrower, - asset: { - denom: asset.denom, - amount: asset.amount - } - }; - } + toAmino: MsgDecollateralize.toAmino, + fromAmino: MsgDecollateralize.fromAmino }, "/umee.leverage.v1.MsgBorrow": { aminoType: "/umee.leverage.v1.MsgBorrow", - toAmino: ({ - borrower, - asset - }: MsgBorrow): AminoMsgBorrow["value"] => { - return { - borrower, - asset: { - denom: asset.denom, - amount: Long.fromValue(asset.amount).toString() - } - }; - }, - fromAmino: ({ - borrower, - asset - }: AminoMsgBorrow["value"]): MsgBorrow => { - return { - borrower, - asset: { - denom: asset.denom, - amount: asset.amount - } - }; - } + toAmino: MsgBorrow.toAmino, + fromAmino: MsgBorrow.fromAmino + }, + "/umee.leverage.v1.MsgMaxBorrow": { + aminoType: "/umee.leverage.v1.MsgMaxBorrow", + toAmino: MsgMaxBorrow.toAmino, + fromAmino: MsgMaxBorrow.fromAmino }, "/umee.leverage.v1.MsgRepay": { aminoType: "/umee.leverage.v1.MsgRepay", - toAmino: ({ - borrower, - asset - }: MsgRepay): AminoMsgRepay["value"] => { - return { - borrower, - asset: { - denom: asset.denom, - amount: Long.fromValue(asset.amount).toString() - } - }; - }, - fromAmino: ({ - borrower, - asset - }: AminoMsgRepay["value"]): MsgRepay => { - return { - borrower, - asset: { - denom: asset.denom, - amount: asset.amount - } - }; - } + toAmino: MsgRepay.toAmino, + fromAmino: MsgRepay.fromAmino }, "/umee.leverage.v1.MsgLiquidate": { aminoType: "/umee.leverage.v1.MsgLiquidate", - toAmino: ({ - liquidator, - borrower, - repayment, - rewardDenom - }: MsgLiquidate): AminoMsgLiquidate["value"] => { - return { - liquidator, - borrower, - repayment: { - denom: repayment.denom, - amount: Long.fromValue(repayment.amount).toString() - }, - reward_denom: rewardDenom - }; - }, - fromAmino: ({ - liquidator, - borrower, - repayment, - reward_denom - }: AminoMsgLiquidate["value"]): MsgLiquidate => { - return { - liquidator, - borrower, - repayment: { - denom: repayment.denom, - amount: repayment.amount - }, - rewardDenom: reward_denom - }; - } + toAmino: MsgLiquidate.toAmino, + fromAmino: MsgLiquidate.fromAmino + }, + "/umee.leverage.v1.MsgLeveragedLiquidate": { + aminoType: "/umee.leverage.v1.MsgLeveragedLiquidate", + toAmino: MsgLeveragedLiquidate.toAmino, + fromAmino: MsgLeveragedLiquidate.fromAmino }, "/umee.leverage.v1.MsgSupplyCollateral": { aminoType: "/umee.leverage.v1.MsgSupplyCollateral", - toAmino: ({ - supplier, - asset - }: MsgSupplyCollateral): AminoMsgSupplyCollateral["value"] => { - return { - supplier, - asset: { - denom: asset.denom, - amount: Long.fromValue(asset.amount).toString() - } - }; - }, - fromAmino: ({ - supplier, - asset - }: AminoMsgSupplyCollateral["value"]): MsgSupplyCollateral => { - return { - supplier, - asset: { - denom: asset.denom, - amount: asset.amount - } - }; - } + toAmino: MsgSupplyCollateral.toAmino, + fromAmino: MsgSupplyCollateral.fromAmino + }, + "/umee.leverage.v1.MsgGovUpdateRegistry": { + aminoType: "/umee.leverage.v1.MsgGovUpdateRegistry", + toAmino: MsgGovUpdateRegistry.toAmino, + fromAmino: MsgGovUpdateRegistry.fromAmino + }, + "/umee.leverage.v1.MsgGovUpdateSpecialAssets": { + aminoType: "/umee.leverage.v1.MsgGovUpdateSpecialAssets", + toAmino: MsgGovUpdateSpecialAssets.toAmino, + fromAmino: MsgGovUpdateSpecialAssets.fromAmino + }, + "/umee.leverage.v1.MsgGovSetParams": { + aminoType: "/umee.leverage.v1.MsgGovSetParams", + toAmino: MsgGovSetParams.toAmino, + fromAmino: MsgGovSetParams.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/tx.registry.ts b/src/codegen/umee/leverage/v1/tx.registry.ts index 49ef1c3..de04b68 100644 --- a/src/codegen/umee/leverage/v1/tx.registry.ts +++ b/src/codegen/umee/leverage/v1/tx.registry.ts @@ -1,6 +1,6 @@ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSupply, MsgWithdraw, MsgCollateralize, MsgDecollateralize, MsgBorrow, MsgRepay, MsgLiquidate, MsgSupplyCollateral } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/umee.leverage.v1.MsgSupply", MsgSupply], ["/umee.leverage.v1.MsgWithdraw", MsgWithdraw], ["/umee.leverage.v1.MsgCollateralize", MsgCollateralize], ["/umee.leverage.v1.MsgDecollateralize", MsgDecollateralize], ["/umee.leverage.v1.MsgBorrow", MsgBorrow], ["/umee.leverage.v1.MsgRepay", MsgRepay], ["/umee.leverage.v1.MsgLiquidate", MsgLiquidate], ["/umee.leverage.v1.MsgSupplyCollateral", MsgSupplyCollateral]]; +import { MsgSupply, MsgWithdraw, MsgMaxWithdraw, MsgCollateralize, MsgDecollateralize, MsgBorrow, MsgMaxBorrow, MsgRepay, MsgLiquidate, MsgLeveragedLiquidate, MsgSupplyCollateral, MsgGovUpdateRegistry, MsgGovUpdateSpecialAssets, MsgGovSetParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/umee.leverage.v1.MsgSupply", MsgSupply], ["/umee.leverage.v1.MsgWithdraw", MsgWithdraw], ["/umee.leverage.v1.MsgMaxWithdraw", MsgMaxWithdraw], ["/umee.leverage.v1.MsgCollateralize", MsgCollateralize], ["/umee.leverage.v1.MsgDecollateralize", MsgDecollateralize], ["/umee.leverage.v1.MsgBorrow", MsgBorrow], ["/umee.leverage.v1.MsgMaxBorrow", MsgMaxBorrow], ["/umee.leverage.v1.MsgRepay", MsgRepay], ["/umee.leverage.v1.MsgLiquidate", MsgLiquidate], ["/umee.leverage.v1.MsgLeveragedLiquidate", MsgLeveragedLiquidate], ["/umee.leverage.v1.MsgSupplyCollateral", MsgSupplyCollateral], ["/umee.leverage.v1.MsgGovUpdateRegistry", MsgGovUpdateRegistry], ["/umee.leverage.v1.MsgGovUpdateSpecialAssets", MsgGovUpdateSpecialAssets], ["/umee.leverage.v1.MsgGovSetParams", MsgGovSetParams]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { protoRegistry.register(typeUrl, mod); @@ -14,56 +14,84 @@ export const MessageComposer = { value: MsgSupply.encode(value).finish() }; }, - withdraw(value: MsgWithdraw) { return { typeUrl: "/umee.leverage.v1.MsgWithdraw", value: MsgWithdraw.encode(value).finish() }; }, - + maxWithdraw(value: MsgMaxWithdraw) { + return { + typeUrl: "/umee.leverage.v1.MsgMaxWithdraw", + value: MsgMaxWithdraw.encode(value).finish() + }; + }, collateralize(value: MsgCollateralize) { return { typeUrl: "/umee.leverage.v1.MsgCollateralize", value: MsgCollateralize.encode(value).finish() }; }, - decollateralize(value: MsgDecollateralize) { return { typeUrl: "/umee.leverage.v1.MsgDecollateralize", value: MsgDecollateralize.encode(value).finish() }; }, - borrow(value: MsgBorrow) { return { typeUrl: "/umee.leverage.v1.MsgBorrow", value: MsgBorrow.encode(value).finish() }; }, - + maxBorrow(value: MsgMaxBorrow) { + return { + typeUrl: "/umee.leverage.v1.MsgMaxBorrow", + value: MsgMaxBorrow.encode(value).finish() + }; + }, repay(value: MsgRepay) { return { typeUrl: "/umee.leverage.v1.MsgRepay", value: MsgRepay.encode(value).finish() }; }, - liquidate(value: MsgLiquidate) { return { typeUrl: "/umee.leverage.v1.MsgLiquidate", value: MsgLiquidate.encode(value).finish() }; }, - + leveragedLiquidate(value: MsgLeveragedLiquidate) { + return { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidate", + value: MsgLeveragedLiquidate.encode(value).finish() + }; + }, supplyCollateral(value: MsgSupplyCollateral) { return { typeUrl: "/umee.leverage.v1.MsgSupplyCollateral", value: MsgSupplyCollateral.encode(value).finish() }; + }, + govUpdateRegistry(value: MsgGovUpdateRegistry) { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistry", + value: MsgGovUpdateRegistry.encode(value).finish() + }; + }, + govUpdateSpecialAssets(value: MsgGovUpdateSpecialAssets) { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssets", + value: MsgGovUpdateSpecialAssets.encode(value).finish() + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.leverage.v1.MsgGovSetParams", + value: MsgGovSetParams.encode(value).finish() + }; } - }, withTypeUrl: { supply(value: MsgSupply) { @@ -72,56 +100,84 @@ export const MessageComposer = { value }; }, - withdraw(value: MsgWithdraw) { return { typeUrl: "/umee.leverage.v1.MsgWithdraw", value }; }, - + maxWithdraw(value: MsgMaxWithdraw) { + return { + typeUrl: "/umee.leverage.v1.MsgMaxWithdraw", + value + }; + }, collateralize(value: MsgCollateralize) { return { typeUrl: "/umee.leverage.v1.MsgCollateralize", value }; }, - decollateralize(value: MsgDecollateralize) { return { typeUrl: "/umee.leverage.v1.MsgDecollateralize", value }; }, - borrow(value: MsgBorrow) { return { typeUrl: "/umee.leverage.v1.MsgBorrow", value }; }, - + maxBorrow(value: MsgMaxBorrow) { + return { + typeUrl: "/umee.leverage.v1.MsgMaxBorrow", + value + }; + }, repay(value: MsgRepay) { return { typeUrl: "/umee.leverage.v1.MsgRepay", value }; }, - liquidate(value: MsgLiquidate) { return { typeUrl: "/umee.leverage.v1.MsgLiquidate", value }; }, - + leveragedLiquidate(value: MsgLeveragedLiquidate) { + return { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidate", + value + }; + }, supplyCollateral(value: MsgSupplyCollateral) { return { typeUrl: "/umee.leverage.v1.MsgSupplyCollateral", value }; + }, + govUpdateRegistry(value: MsgGovUpdateRegistry) { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistry", + value + }; + }, + govUpdateSpecialAssets(value: MsgGovUpdateSpecialAssets) { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssets", + value + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.leverage.v1.MsgGovSetParams", + value + }; } - }, fromPartial: { supply(value: MsgSupply) { @@ -130,55 +186,83 @@ export const MessageComposer = { value: MsgSupply.fromPartial(value) }; }, - withdraw(value: MsgWithdraw) { return { typeUrl: "/umee.leverage.v1.MsgWithdraw", value: MsgWithdraw.fromPartial(value) }; }, - + maxWithdraw(value: MsgMaxWithdraw) { + return { + typeUrl: "/umee.leverage.v1.MsgMaxWithdraw", + value: MsgMaxWithdraw.fromPartial(value) + }; + }, collateralize(value: MsgCollateralize) { return { typeUrl: "/umee.leverage.v1.MsgCollateralize", value: MsgCollateralize.fromPartial(value) }; }, - decollateralize(value: MsgDecollateralize) { return { typeUrl: "/umee.leverage.v1.MsgDecollateralize", value: MsgDecollateralize.fromPartial(value) }; }, - borrow(value: MsgBorrow) { return { typeUrl: "/umee.leverage.v1.MsgBorrow", value: MsgBorrow.fromPartial(value) }; }, - + maxBorrow(value: MsgMaxBorrow) { + return { + typeUrl: "/umee.leverage.v1.MsgMaxBorrow", + value: MsgMaxBorrow.fromPartial(value) + }; + }, repay(value: MsgRepay) { return { typeUrl: "/umee.leverage.v1.MsgRepay", value: MsgRepay.fromPartial(value) }; }, - liquidate(value: MsgLiquidate) { return { typeUrl: "/umee.leverage.v1.MsgLiquidate", value: MsgLiquidate.fromPartial(value) }; }, - + leveragedLiquidate(value: MsgLeveragedLiquidate) { + return { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidate", + value: MsgLeveragedLiquidate.fromPartial(value) + }; + }, supplyCollateral(value: MsgSupplyCollateral) { return { typeUrl: "/umee.leverage.v1.MsgSupplyCollateral", value: MsgSupplyCollateral.fromPartial(value) }; + }, + govUpdateRegistry(value: MsgGovUpdateRegistry) { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistry", + value: MsgGovUpdateRegistry.fromPartial(value) + }; + }, + govUpdateSpecialAssets(value: MsgGovUpdateSpecialAssets) { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssets", + value: MsgGovUpdateSpecialAssets.fromPartial(value) + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.leverage.v1.MsgGovSetParams", + value: MsgGovSetParams.fromPartial(value) + }; } - } }; \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/tx.rpc.msg.ts b/src/codegen/umee/leverage/v1/tx.rpc.msg.ts index 24ace1b..88e5ab6 100644 --- a/src/codegen/umee/leverage/v1/tx.rpc.msg.ts +++ b/src/codegen/umee/leverage/v1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; -import { MsgSupply, MsgSupplyResponse, MsgWithdraw, MsgWithdrawResponse, MsgCollateralize, MsgCollateralizeResponse, MsgDecollateralize, MsgDecollateralizeResponse, MsgBorrow, MsgBorrowResponse, MsgRepay, MsgRepayResponse, MsgLiquidate, MsgLiquidateResponse, MsgSupplyCollateral, MsgSupplyCollateralResponse } from "./tx"; +import { BinaryReader } from "../../../binary"; +import { MsgSupply, MsgSupplyResponse, MsgWithdraw, MsgWithdrawResponse, MsgMaxWithdraw, MsgMaxWithdrawResponse, MsgCollateralize, MsgCollateralizeResponse, MsgDecollateralize, MsgDecollateralizeResponse, MsgBorrow, MsgBorrowResponse, MsgMaxBorrow, MsgMaxBorrowResponse, MsgRepay, MsgRepayResponse, MsgLiquidate, MsgLiquidateResponse, MsgLeveragedLiquidate, MsgLeveragedLiquidateResponse, MsgSupplyCollateral, MsgSupplyCollateralResponse, MsgGovUpdateRegistry, MsgGovUpdateRegistryResponse, MsgGovUpdateSpecialAssets, MsgGovUpdateSpecialAssetsResponse, MsgGovSetParams, MsgGovSetParamsResponse } from "./tx"; /** Msg defines the x/leverage module's Msg service. */ - export interface Msg { /** * Supply moves tokens from user balance to the module for lending or collateral. @@ -13,94 +12,152 @@ export interface Msg { * Withdraw moves previously supplied tokens from the module back to the user balance in * exchange for burning uTokens. */ - withdraw(request: MsgWithdraw): Promise; + /** + * MaxWithdraw moves previously supplied tokens from the module back to the user balance in + * exchange for burning uTokens. It automatically calculates the maximum valid amount to withdraw. + * Zero is returned if no more tokens can be withdrawn. + */ + maxWithdraw(request: MsgMaxWithdraw): Promise; /** Collateralize enables selected uTokens as collateral, which moves them to the module. */ - collateralize(request: MsgCollateralize): Promise; /** * Decollateralize disables selected uTokens as collateral. They are returned to the user's * balance from the module. */ - decollateralize(request: MsgDecollateralize): Promise; /** Borrow allows a user to borrow tokens from the module if they have sufficient collateral. */ - borrow(request: MsgBorrow): Promise; + /** + * MaxBorrow allows a user to borrow the maximum amount of tokens their collateral will allow. + * Zero is returned if no more can be borrowed. + */ + maxBorrow(request: MsgMaxBorrow): Promise; /** Repay allows a user to repay previously borrowed tokens and interest. */ - repay(request: MsgRepay): Promise; /** * Liquidate allows a user to repay a different user's borrowed coins in exchange for some * of the target's collateral. */ - liquidate(request: MsgLiquidate): Promise; + /** + * LeveragedLiquidate allows a user to repay a different user's borrowed coins in exchange for some + * of the target's collateral. For leveraged liquidations, the tokens to repay are borrowed instead of + * being taken from the liquidator's wallet, and the reward is immediately collateralized. Borrow + * limit checks for the liquidator are deferred until after the reward is collateralized, allowing + * this initial borrow to exceed the liquidator's borrow limit as long as it is healthy by the end + * of the transaction. Repay amount is calculated automatically, so the liquidator only specifies + * repay and reward token denoms. For safety, the liquidator cannot exceed 80% of their borrow limit when + * executing this transaction, instead of the regular 100%. Also allows repayment and reward denoms to + * be left blank - if not specified, the module will automatically select the first (alphabetically by denom) + * borrow and/or collateral on the target account and the proceed normally. + * After v6.0, includes a MaxRepay field which limits repay value in USD. To prevent dust exploits, this + * value cannot be below $1.00 + */ + leveragedLiquidate(request: MsgLeveragedLiquidate): Promise; /** SupplyCollateral combines the Supply and Collateralize actions. */ - supplyCollateral(request: MsgSupplyCollateral): Promise; + /** + * GovUpdateRegistry adds new tokens to the token registry or + * updates existing tokens with new settings. + */ + govUpdateRegistry(request: MsgGovUpdateRegistry): Promise; + /** + * GovUpdateSpecialAssets adds, updates, or removes special asset pairs. Note that a special asset + * pair can be removed by setting its special collateral weight to negative one. Also allows for the creation + * of sets of assets, where each asset in the set forms a special asset pair with all of the others. + */ + govUpdateSpecialAssets(request: MsgGovUpdateSpecialAssets): Promise; + /** GovSetParams is used by governance proposals to update parameters. */ + govSetParams(request: MsgGovSetParams): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.supply = this.supply.bind(this); this.withdraw = this.withdraw.bind(this); + this.maxWithdraw = this.maxWithdraw.bind(this); this.collateralize = this.collateralize.bind(this); this.decollateralize = this.decollateralize.bind(this); this.borrow = this.borrow.bind(this); + this.maxBorrow = this.maxBorrow.bind(this); this.repay = this.repay.bind(this); this.liquidate = this.liquidate.bind(this); + this.leveragedLiquidate = this.leveragedLiquidate.bind(this); this.supplyCollateral = this.supplyCollateral.bind(this); + this.govUpdateRegistry = this.govUpdateRegistry.bind(this); + this.govUpdateSpecialAssets = this.govUpdateSpecialAssets.bind(this); + this.govSetParams = this.govSetParams.bind(this); } - supply(request: MsgSupply): Promise { const data = MsgSupply.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Msg", "Supply", data); - return promise.then(data => MsgSupplyResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgSupplyResponse.decode(new BinaryReader(data))); } - withdraw(request: MsgWithdraw): Promise { const data = MsgWithdraw.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Msg", "Withdraw", data); - return promise.then(data => MsgWithdrawResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgWithdrawResponse.decode(new BinaryReader(data))); + } + maxWithdraw(request: MsgMaxWithdraw): Promise { + const data = MsgMaxWithdraw.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Msg", "MaxWithdraw", data); + return promise.then(data => MsgMaxWithdrawResponse.decode(new BinaryReader(data))); } - collateralize(request: MsgCollateralize): Promise { const data = MsgCollateralize.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Msg", "Collateralize", data); - return promise.then(data => MsgCollateralizeResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgCollateralizeResponse.decode(new BinaryReader(data))); } - decollateralize(request: MsgDecollateralize): Promise { const data = MsgDecollateralize.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Msg", "Decollateralize", data); - return promise.then(data => MsgDecollateralizeResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgDecollateralizeResponse.decode(new BinaryReader(data))); } - borrow(request: MsgBorrow): Promise { const data = MsgBorrow.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Msg", "Borrow", data); - return promise.then(data => MsgBorrowResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgBorrowResponse.decode(new BinaryReader(data))); + } + maxBorrow(request: MsgMaxBorrow): Promise { + const data = MsgMaxBorrow.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Msg", "MaxBorrow", data); + return promise.then(data => MsgMaxBorrowResponse.decode(new BinaryReader(data))); } - repay(request: MsgRepay): Promise { const data = MsgRepay.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Msg", "Repay", data); - return promise.then(data => MsgRepayResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgRepayResponse.decode(new BinaryReader(data))); } - liquidate(request: MsgLiquidate): Promise { const data = MsgLiquidate.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Msg", "Liquidate", data); - return promise.then(data => MsgLiquidateResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgLiquidateResponse.decode(new BinaryReader(data))); + } + leveragedLiquidate(request: MsgLeveragedLiquidate): Promise { + const data = MsgLeveragedLiquidate.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Msg", "LeveragedLiquidate", data); + return promise.then(data => MsgLeveragedLiquidateResponse.decode(new BinaryReader(data))); } - supplyCollateral(request: MsgSupplyCollateral): Promise { const data = MsgSupplyCollateral.encode(request).finish(); const promise = this.rpc.request("umee.leverage.v1.Msg", "SupplyCollateral", data); - return promise.then(data => MsgSupplyCollateralResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgSupplyCollateralResponse.decode(new BinaryReader(data))); + } + govUpdateRegistry(request: MsgGovUpdateRegistry): Promise { + const data = MsgGovUpdateRegistry.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Msg", "GovUpdateRegistry", data); + return promise.then(data => MsgGovUpdateRegistryResponse.decode(new BinaryReader(data))); + } + govUpdateSpecialAssets(request: MsgGovUpdateSpecialAssets): Promise { + const data = MsgGovUpdateSpecialAssets.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Msg", "GovUpdateSpecialAssets", data); + return promise.then(data => MsgGovUpdateSpecialAssetsResponse.decode(new BinaryReader(data))); + } + govSetParams(request: MsgGovSetParams): Promise { + const data = MsgGovSetParams.encode(request).finish(); + const promise = this.rpc.request("umee.leverage.v1.Msg", "GovSetParams", data); + return promise.then(data => MsgGovSetParamsResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/umee/leverage/v1/tx.ts b/src/codegen/umee/leverage/v1/tx.ts index b50212d..4776762 100644 --- a/src/codegen/umee/leverage/v1/tx.ts +++ b/src/codegen/umee/leverage/v1/tx.ts @@ -1,134 +1,282 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Token, TokenAmino, TokenSDKType, SpecialAssetSet, SpecialAssetSetAmino, SpecialAssetSetSDKType, SpecialAssetPair, SpecialAssetPairAmino, SpecialAssetPairSDKType, Params, ParamsAmino, ParamsSDKType } from "./leverage"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; /** MsgSupply represents a user's request to supply assets to the module. */ - export interface MsgSupply { /** Supplier is the account address supplying assets and the signer of the message. */ supplier: string; - asset?: Coin; + asset: Coin; +} +export interface MsgSupplyProtoMsg { + typeUrl: "/umee.leverage.v1.MsgSupply"; + value: Uint8Array; } /** MsgSupply represents a user's request to supply assets to the module. */ - -export interface MsgSupplySDKType { +export interface MsgSupplyAmino { /** Supplier is the account address supplying assets and the signer of the message. */ + supplier?: string; + asset?: CoinAmino; +} +export interface MsgSupplyAminoMsg { + type: "/umee.leverage.v1.MsgSupply"; + value: MsgSupplyAmino; +} +/** MsgSupply represents a user's request to supply assets to the module. */ +export interface MsgSupplySDKType { supplier: string; - asset?: CoinSDKType; + asset: CoinSDKType; } /** * MsgWithdraw represents a user's request to withdraw supplied assets. * Asset must be a uToken. */ - export interface MsgWithdraw { /** Supplier is the account address withdrawing assets and the signer of the message. */ supplier: string; - asset?: Coin; + asset: Coin; +} +export interface MsgWithdrawProtoMsg { + typeUrl: "/umee.leverage.v1.MsgWithdraw"; + value: Uint8Array; +} +/** + * MsgWithdraw represents a user's request to withdraw supplied assets. + * Asset must be a uToken. + */ +export interface MsgWithdrawAmino { + /** Supplier is the account address withdrawing assets and the signer of the message. */ + supplier?: string; + asset?: CoinAmino; +} +export interface MsgWithdrawAminoMsg { + type: "/umee.leverage.v1.MsgWithdraw"; + value: MsgWithdrawAmino; } /** * MsgWithdraw represents a user's request to withdraw supplied assets. * Asset must be a uToken. */ - export interface MsgWithdrawSDKType { + supplier: string; + asset: CoinSDKType; +} +/** MsgMaxWithdraw represents a user's request to withdraw the maximum valid amount of supplied assets. */ +export interface MsgMaxWithdraw { /** Supplier is the account address withdrawing assets and the signer of the message. */ supplier: string; - asset?: CoinSDKType; + /** Denom is base token denom to withdraw */ + denom: string; +} +export interface MsgMaxWithdrawProtoMsg { + typeUrl: "/umee.leverage.v1.MsgMaxWithdraw"; + value: Uint8Array; +} +/** MsgMaxWithdraw represents a user's request to withdraw the maximum valid amount of supplied assets. */ +export interface MsgMaxWithdrawAmino { + /** Supplier is the account address withdrawing assets and the signer of the message. */ + supplier?: string; + /** Denom is base token denom to withdraw */ + denom?: string; +} +export interface MsgMaxWithdrawAminoMsg { + type: "/umee.leverage.v1.MsgMaxWithdraw"; + value: MsgMaxWithdrawAmino; +} +/** MsgMaxWithdraw represents a user's request to withdraw the maximum valid amount of supplied assets. */ +export interface MsgMaxWithdrawSDKType { + supplier: string; + denom: string; } /** * MsgCollateralize represents a user's request to enable selected * uTokens as collateral. */ - export interface MsgCollateralize { /** Borrower is the account address adding collateral and the signer of the message. */ borrower: string; - asset?: Coin; + asset: Coin; +} +export interface MsgCollateralizeProtoMsg { + typeUrl: "/umee.leverage.v1.MsgCollateralize"; + value: Uint8Array; } /** * MsgCollateralize represents a user's request to enable selected * uTokens as collateral. */ - -export interface MsgCollateralizeSDKType { +export interface MsgCollateralizeAmino { /** Borrower is the account address adding collateral and the signer of the message. */ + borrower?: string; + asset?: CoinAmino; +} +export interface MsgCollateralizeAminoMsg { + type: "/umee.leverage.v1.MsgCollateralize"; + value: MsgCollateralizeAmino; +} +/** + * MsgCollateralize represents a user's request to enable selected + * uTokens as collateral. + */ +export interface MsgCollateralizeSDKType { borrower: string; - asset?: CoinSDKType; + asset: CoinSDKType; } /** * MsgDecollateralize represents a user's request to disable selected * uTokens as collateral. */ - export interface MsgDecollateralize { /** Borrower is the account address removing collateral and the signer of the message. */ borrower: string; - asset?: Coin; + asset: Coin; +} +export interface MsgDecollateralizeProtoMsg { + typeUrl: "/umee.leverage.v1.MsgDecollateralize"; + value: Uint8Array; } /** * MsgDecollateralize represents a user's request to disable selected * uTokens as collateral. */ - -export interface MsgDecollateralizeSDKType { +export interface MsgDecollateralizeAmino { /** Borrower is the account address removing collateral and the signer of the message. */ + borrower?: string; + asset?: CoinAmino; +} +export interface MsgDecollateralizeAminoMsg { + type: "/umee.leverage.v1.MsgDecollateralize"; + value: MsgDecollateralizeAmino; +} +/** + * MsgDecollateralize represents a user's request to disable selected + * uTokens as collateral. + */ +export interface MsgDecollateralizeSDKType { borrower: string; - asset?: CoinSDKType; + asset: CoinSDKType; } /** * MsgBorrow represents a user's request to borrow a base asset type * from the module. */ - export interface MsgBorrow { /** * Borrower is the account address taking a loan and the signer * of the message. */ borrower: string; - asset?: Coin; + asset: Coin; +} +export interface MsgBorrowProtoMsg { + typeUrl: "/umee.leverage.v1.MsgBorrow"; + value: Uint8Array; +} +/** + * MsgBorrow represents a user's request to borrow a base asset type + * from the module. + */ +export interface MsgBorrowAmino { + /** + * Borrower is the account address taking a loan and the signer + * of the message. + */ + borrower?: string; + asset?: CoinAmino; +} +export interface MsgBorrowAminoMsg { + type: "/umee.leverage.v1.MsgBorrow"; + value: MsgBorrowAmino; } /** * MsgBorrow represents a user's request to borrow a base asset type * from the module. */ - export interface MsgBorrowSDKType { + borrower: string; + asset: CoinSDKType; +} +/** + * MsgMaxBorrow represents a user's request to borrow a base asset type + * from the module, using the maximum available amount. + */ +export interface MsgMaxBorrow { + /** + * Borrower is the account address taking a loan and the signer + * of the message. + */ + borrower: string; + denom: string; +} +export interface MsgMaxBorrowProtoMsg { + typeUrl: "/umee.leverage.v1.MsgMaxBorrow"; + value: Uint8Array; +} +/** + * MsgMaxBorrow represents a user's request to borrow a base asset type + * from the module, using the maximum available amount. + */ +export interface MsgMaxBorrowAmino { /** * Borrower is the account address taking a loan and the signer * of the message. */ + borrower?: string; + denom?: string; +} +export interface MsgMaxBorrowAminoMsg { + type: "/umee.leverage.v1.MsgMaxBorrow"; + value: MsgMaxBorrowAmino; +} +/** + * MsgMaxBorrow represents a user's request to borrow a base asset type + * from the module, using the maximum available amount. + */ +export interface MsgMaxBorrowSDKType { borrower: string; - asset?: CoinSDKType; + denom: string; } /** * MsgRepay represents a user's request to repay a borrowed base asset * type to the module. */ - export interface MsgRepay { /** * Borrower is the account address repaying a loan and the signer * of the message. */ borrower: string; - asset?: Coin; + asset: Coin; +} +export interface MsgRepayProtoMsg { + typeUrl: "/umee.leverage.v1.MsgRepay"; + value: Uint8Array; } /** * MsgRepay represents a user's request to repay a borrowed base asset * type to the module. */ - -export interface MsgRepaySDKType { +export interface MsgRepayAmino { /** * Borrower is the account address repaying a loan and the signer * of the message. */ + borrower?: string; + asset?: CoinAmino; +} +export interface MsgRepayAminoMsg { + type: "/umee.leverage.v1.MsgRepay"; + value: MsgRepayAmino; +} +/** + * MsgRepay represents a user's request to repay a borrowed base asset + * type to the module. + */ +export interface MsgRepaySDKType { borrower: string; - asset?: CoinSDKType; + asset: CoinSDKType; } /** MsgLiquidate is the request structure for the Liquidate RPC. */ - export interface MsgLiquidate { /** * Liquidator is the account address performing a liquidation and the signer @@ -139,978 +287,2611 @@ export interface MsgLiquidate { * Borrower is the account whose borrow is being repaid, and collateral consumed, * by the liquidation. It does not sign the message. */ - borrower: string; /** * Repayment is the maximum amount of base tokens that the liquidator is willing * to repay. */ - - repayment?: Coin; + repayment: Coin; /** * RewardDenom is the denom that the liquidator will receive as a liquidation reward. * If it is a uToken, the liquidator will receive uTokens from the borrower's * collateral. If it is a base token, the uTokens will be redeemed directly at * a reduced Liquidation Incentive, and the liquidator will receive base tokens. */ - rewardDenom: string; } +export interface MsgLiquidateProtoMsg { + typeUrl: "/umee.leverage.v1.MsgLiquidate"; + value: Uint8Array; +} /** MsgLiquidate is the request structure for the Liquidate RPC. */ - -export interface MsgLiquidateSDKType { +export interface MsgLiquidateAmino { /** * Liquidator is the account address performing a liquidation and the signer * of the message. */ - liquidator: string; + liquidator?: string; /** * Borrower is the account whose borrow is being repaid, and collateral consumed, * by the liquidation. It does not sign the message. */ - - borrower: string; + borrower?: string; /** * Repayment is the maximum amount of base tokens that the liquidator is willing * to repay. */ - - repayment?: CoinSDKType; + repayment?: CoinAmino; /** * RewardDenom is the denom that the liquidator will receive as a liquidation reward. * If it is a uToken, the liquidator will receive uTokens from the borrower's * collateral. If it is a base token, the uTokens will be redeemed directly at * a reduced Liquidation Incentive, and the liquidator will receive base tokens. */ - + reward_denom?: string; +} +export interface MsgLiquidateAminoMsg { + type: "/umee.leverage.v1.MsgLiquidate"; + value: MsgLiquidateAmino; +} +/** MsgLiquidate is the request structure for the Liquidate RPC. */ +export interface MsgLiquidateSDKType { + liquidator: string; + borrower: string; + repayment: CoinSDKType; + reward_denom: string; +} +/** MsgLeveragedLiquidate is the request structure for the LeveragedLiquidate RPC. */ +export interface MsgLeveragedLiquidate { + /** + * Liquidator is the account address performing a liquidation and the signer + * of the message. + */ + liquidator: string; + /** + * Borrower is the account whose borrow is being repaid, and collateral consumed, + * by the liquidation. It does not sign the message. + */ + borrower: string; + /** + * RepayDenom is the base token that the liquidator will borrow in order to repay on behalf of + * the borrower. + */ + repayDenom: string; + /** + * RewardDenom is the uToken denom that the liquidator will receive as a liquidation reward + * and immediately collateralize. + */ + rewardDenom: string; + /** MaxRepay optionally limits the USD value to repay. If specified, this cannot be below $1.00 */ + maxRepay: string; +} +export interface MsgLeveragedLiquidateProtoMsg { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidate"; + value: Uint8Array; +} +/** MsgLeveragedLiquidate is the request structure for the LeveragedLiquidate RPC. */ +export interface MsgLeveragedLiquidateAmino { + /** + * Liquidator is the account address performing a liquidation and the signer + * of the message. + */ + liquidator?: string; + /** + * Borrower is the account whose borrow is being repaid, and collateral consumed, + * by the liquidation. It does not sign the message. + */ + borrower?: string; + /** + * RepayDenom is the base token that the liquidator will borrow in order to repay on behalf of + * the borrower. + */ + repay_denom?: string; + /** + * RewardDenom is the uToken denom that the liquidator will receive as a liquidation reward + * and immediately collateralize. + */ + reward_denom?: string; + /** MaxRepay optionally limits the USD value to repay. If specified, this cannot be below $1.00 */ + max_repay?: string; +} +export interface MsgLeveragedLiquidateAminoMsg { + type: "/umee.leverage.v1.MsgLeveragedLiquidate"; + value: MsgLeveragedLiquidateAmino; +} +/** MsgLeveragedLiquidate is the request structure for the LeveragedLiquidate RPC. */ +export interface MsgLeveragedLiquidateSDKType { + liquidator: string; + borrower: string; + repay_denom: string; reward_denom: string; + max_repay: string; } /** MsgSupplyCollateral represents a user's request to supply and collateralize assets to the module. */ - export interface MsgSupplyCollateral { /** Supplier is the account address supplying assets and the signer of the message. */ supplier: string; - asset?: Coin; + asset: Coin; +} +export interface MsgSupplyCollateralProtoMsg { + typeUrl: "/umee.leverage.v1.MsgSupplyCollateral"; + value: Uint8Array; } /** MsgSupplyCollateral represents a user's request to supply and collateralize assets to the module. */ - -export interface MsgSupplyCollateralSDKType { +export interface MsgSupplyCollateralAmino { /** Supplier is the account address supplying assets and the signer of the message. */ + supplier?: string; + asset?: CoinAmino; +} +export interface MsgSupplyCollateralAminoMsg { + type: "/umee.leverage.v1.MsgSupplyCollateral"; + value: MsgSupplyCollateralAmino; +} +/** MsgSupplyCollateral represents a user's request to supply and collateralize assets to the module. */ +export interface MsgSupplyCollateralSDKType { supplier: string; - asset?: CoinSDKType; + asset: CoinSDKType; } /** MsgSupplyResponse defines the Msg/Supply response type. */ - export interface MsgSupplyResponse { /** Received is the amount of uTokens received. */ - received?: Coin; + received: Coin; +} +export interface MsgSupplyResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgSupplyResponse"; + value: Uint8Array; } /** MsgSupplyResponse defines the Msg/Supply response type. */ - -export interface MsgSupplyResponseSDKType { +export interface MsgSupplyResponseAmino { /** Received is the amount of uTokens received. */ - received?: CoinSDKType; + received?: CoinAmino; +} +export interface MsgSupplyResponseAminoMsg { + type: "/umee.leverage.v1.MsgSupplyResponse"; + value: MsgSupplyResponseAmino; +} +/** MsgSupplyResponse defines the Msg/Supply response type. */ +export interface MsgSupplyResponseSDKType { + received: CoinSDKType; } /** MsgWithdrawResponse defines the Msg/Withdraw response type. */ - export interface MsgWithdrawResponse { /** Received is the amount of base tokens received. */ - received?: Coin; + received: Coin; +} +export interface MsgWithdrawResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgWithdrawResponse"; + value: Uint8Array; +} +/** MsgWithdrawResponse defines the Msg/Withdraw response type. */ +export interface MsgWithdrawResponseAmino { + /** Received is the amount of base tokens received. */ + received?: CoinAmino; +} +export interface MsgWithdrawResponseAminoMsg { + type: "/umee.leverage.v1.MsgWithdrawResponse"; + value: MsgWithdrawResponseAmino; } /** MsgWithdrawResponse defines the Msg/Withdraw response type. */ - export interface MsgWithdrawResponseSDKType { + received: CoinSDKType; +} +/** MsgMaxWithdrawResponse defines the Msg/MaxWithdraw response type. */ +export interface MsgMaxWithdrawResponse { + /** Withdrawn is the amount of uTokens withdrawn. */ + withdrawn: Coin; /** Received is the amount of base tokens received. */ - received?: CoinSDKType; + received: Coin; +} +export interface MsgMaxWithdrawResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgMaxWithdrawResponse"; + value: Uint8Array; +} +/** MsgMaxWithdrawResponse defines the Msg/MaxWithdraw response type. */ +export interface MsgMaxWithdrawResponseAmino { + /** Withdrawn is the amount of uTokens withdrawn. */ + withdrawn?: CoinAmino; + /** Received is the amount of base tokens received. */ + received?: CoinAmino; +} +export interface MsgMaxWithdrawResponseAminoMsg { + type: "/umee.leverage.v1.MsgMaxWithdrawResponse"; + value: MsgMaxWithdrawResponseAmino; +} +/** MsgMaxWithdrawResponse defines the Msg/MaxWithdraw response type. */ +export interface MsgMaxWithdrawResponseSDKType { + withdrawn: CoinSDKType; + received: CoinSDKType; } /** MsgCollateralizeResponse defines the Msg/Collateralize response type. */ - export interface MsgCollateralizeResponse {} +export interface MsgCollateralizeResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgCollateralizeResponse"; + value: Uint8Array; +} +/** MsgCollateralizeResponse defines the Msg/Collateralize response type. */ +export interface MsgCollateralizeResponseAmino {} +export interface MsgCollateralizeResponseAminoMsg { + type: "/umee.leverage.v1.MsgCollateralizeResponse"; + value: MsgCollateralizeResponseAmino; +} /** MsgCollateralizeResponse defines the Msg/Collateralize response type. */ - export interface MsgCollateralizeResponseSDKType {} /** MsgDecollateralizeResponse defines the Msg/Decollateralize response type. */ - export interface MsgDecollateralizeResponse {} +export interface MsgDecollateralizeResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgDecollateralizeResponse"; + value: Uint8Array; +} +/** MsgDecollateralizeResponse defines the Msg/Decollateralize response type. */ +export interface MsgDecollateralizeResponseAmino {} +export interface MsgDecollateralizeResponseAminoMsg { + type: "/umee.leverage.v1.MsgDecollateralizeResponse"; + value: MsgDecollateralizeResponseAmino; +} /** MsgDecollateralizeResponse defines the Msg/Decollateralize response type. */ - export interface MsgDecollateralizeResponseSDKType {} /** MsgBorrowResponse defines the Msg/Borrow response type. */ - export interface MsgBorrowResponse {} +export interface MsgBorrowResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgBorrowResponse"; + value: Uint8Array; +} +/** MsgBorrowResponse defines the Msg/Borrow response type. */ +export interface MsgBorrowResponseAmino {} +export interface MsgBorrowResponseAminoMsg { + type: "/umee.leverage.v1.MsgBorrowResponse"; + value: MsgBorrowResponseAmino; +} /** MsgBorrowResponse defines the Msg/Borrow response type. */ - export interface MsgBorrowResponseSDKType {} +/** MsgMaxBorrowResponse defines the Msg/MaxBorrow response type. */ +export interface MsgMaxBorrowResponse { + /** Borrowed is the amount of tokens borrowed. */ + borrowed: Coin; +} +export interface MsgMaxBorrowResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgMaxBorrowResponse"; + value: Uint8Array; +} +/** MsgMaxBorrowResponse defines the Msg/MaxBorrow response type. */ +export interface MsgMaxBorrowResponseAmino { + /** Borrowed is the amount of tokens borrowed. */ + borrowed?: CoinAmino; +} +export interface MsgMaxBorrowResponseAminoMsg { + type: "/umee.leverage.v1.MsgMaxBorrowResponse"; + value: MsgMaxBorrowResponseAmino; +} +/** MsgMaxBorrowResponse defines the Msg/MaxBorrow response type. */ +export interface MsgMaxBorrowResponseSDKType { + borrowed: CoinSDKType; +} /** MsgRepayResponse defines the Msg/Repay response type. */ - export interface MsgRepayResponse { /** Repaid is the amount of base tokens repaid to the module. */ - repaid?: Coin; + repaid: Coin; +} +export interface MsgRepayResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgRepayResponse"; + value: Uint8Array; +} +/** MsgRepayResponse defines the Msg/Repay response type. */ +export interface MsgRepayResponseAmino { + /** Repaid is the amount of base tokens repaid to the module. */ + repaid?: CoinAmino; +} +export interface MsgRepayResponseAminoMsg { + type: "/umee.leverage.v1.MsgRepayResponse"; + value: MsgRepayResponseAmino; } /** MsgRepayResponse defines the Msg/Repay response type. */ - export interface MsgRepayResponseSDKType { - /** Repaid is the amount of base tokens repaid to the module. */ - repaid?: CoinSDKType; + repaid: CoinSDKType; } /** MsgLiquidateResponse defines the Msg/Liquidate response type. */ - export interface MsgLiquidateResponse { /** * Repaid is the amount of borrowed base tokens that the liquidator repaid * to the module on behalf of the borrower. */ - repaid?: Coin; + repaid: Coin; /** * Collateral is the amount of the borrower's uToken collateral that * was liquidated. */ - - collateral?: Coin; + collateral: Coin; /** * Reward is the amount of base tokens that the liquidator received from * the module as reward for the liquidation. */ - - reward?: Coin; + reward: Coin; +} +export interface MsgLiquidateResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgLiquidateResponse"; + value: Uint8Array; } /** MsgLiquidateResponse defines the Msg/Liquidate response type. */ - -export interface MsgLiquidateResponseSDKType { +export interface MsgLiquidateResponseAmino { /** * Repaid is the amount of borrowed base tokens that the liquidator repaid * to the module on behalf of the borrower. */ - repaid?: CoinSDKType; + repaid?: CoinAmino; /** * Collateral is the amount of the borrower's uToken collateral that * was liquidated. */ - - collateral?: CoinSDKType; + collateral?: CoinAmino; /** * Reward is the amount of base tokens that the liquidator received from * the module as reward for the liquidation. */ - - reward?: CoinSDKType; + reward?: CoinAmino; +} +export interface MsgLiquidateResponseAminoMsg { + type: "/umee.leverage.v1.MsgLiquidateResponse"; + value: MsgLiquidateResponseAmino; +} +/** MsgLiquidateResponse defines the Msg/Liquidate response type. */ +export interface MsgLiquidateResponseSDKType { + repaid: CoinSDKType; + collateral: CoinSDKType; + reward: CoinSDKType; +} +/** MsgLeveragedLiquidateResponse defines the Msg/LeveragedLiquidate response type. */ +export interface MsgLeveragedLiquidateResponse { + /** + * Repaid is the amount of base tokens that the liquidator borrowed and repaid + * to the module on behalf of the borrower. + */ + repaid: Coin; + /** + * Reward is the amount of collateral that the liquidator gained + * as reward for the liquidation. + */ + reward: Coin; +} +export interface MsgLeveragedLiquidateResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidateResponse"; + value: Uint8Array; +} +/** MsgLeveragedLiquidateResponse defines the Msg/LeveragedLiquidate response type. */ +export interface MsgLeveragedLiquidateResponseAmino { + /** + * Repaid is the amount of base tokens that the liquidator borrowed and repaid + * to the module on behalf of the borrower. + */ + repaid?: CoinAmino; + /** + * Reward is the amount of collateral that the liquidator gained + * as reward for the liquidation. + */ + reward?: CoinAmino; +} +export interface MsgLeveragedLiquidateResponseAminoMsg { + type: "/umee.leverage.v1.MsgLeveragedLiquidateResponse"; + value: MsgLeveragedLiquidateResponseAmino; +} +/** MsgLeveragedLiquidateResponse defines the Msg/LeveragedLiquidate response type. */ +export interface MsgLeveragedLiquidateResponseSDKType { + repaid: CoinSDKType; + reward: CoinSDKType; } /** MsgSupplyCollateralResponse defines the Msg/SupplyCollateral response type. */ - export interface MsgSupplyCollateralResponse { /** Collateralized is the amount of uTokens collateralized. */ - collateralized?: Coin; + collateralized: Coin; +} +export interface MsgSupplyCollateralResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgSupplyCollateralResponse"; + value: Uint8Array; } /** MsgSupplyCollateralResponse defines the Msg/SupplyCollateral response type. */ - -export interface MsgSupplyCollateralResponseSDKType { +export interface MsgSupplyCollateralResponseAmino { /** Collateralized is the amount of uTokens collateralized. */ - collateralized?: CoinSDKType; + collateralized?: CoinAmino; +} +export interface MsgSupplyCollateralResponseAminoMsg { + type: "/umee.leverage.v1.MsgSupplyCollateralResponse"; + value: MsgSupplyCollateralResponseAmino; +} +/** MsgSupplyCollateralResponse defines the Msg/SupplyCollateral response type. */ +export interface MsgSupplyCollateralResponseSDKType { + collateralized: CoinSDKType; } - +/** MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type. */ +export interface MsgGovUpdateRegistry { + /** authority is the address of the governance account or the Emergency Group. */ + authority: string; + /** + * description motivating the change. Should be used only when executing by the + * Emergency Group. Otherwise the x/gov Proposal metadata should be used. + */ + description: string; + /** add_tokens defines new token settings. */ + addTokens: Token[]; + /** update_tokens defines the new settings for existed tokens. */ + updateTokens: Token[]; +} +export interface MsgGovUpdateRegistryProtoMsg { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistry"; + value: Uint8Array; +} +/** MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type. */ +export interface MsgGovUpdateRegistryAmino { + /** authority is the address of the governance account or the Emergency Group. */ + authority?: string; + /** + * description motivating the change. Should be used only when executing by the + * Emergency Group. Otherwise the x/gov Proposal metadata should be used. + */ + description?: string; + /** add_tokens defines new token settings. */ + add_tokens?: TokenAmino[]; + /** update_tokens defines the new settings for existed tokens. */ + update_tokens?: TokenAmino[]; +} +export interface MsgGovUpdateRegistryAminoMsg { + type: "/umee.leverage.v1.MsgGovUpdateRegistry"; + value: MsgGovUpdateRegistryAmino; +} +/** MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type. */ +export interface MsgGovUpdateRegistrySDKType { + authority: string; + description: string; + add_tokens: TokenSDKType[]; + update_tokens: TokenSDKType[]; +} +/** MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type. */ +export interface MsgGovUpdateRegistryResponse {} +export interface MsgGovUpdateRegistryResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistryResponse"; + value: Uint8Array; +} +/** MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type. */ +export interface MsgGovUpdateRegistryResponseAmino {} +export interface MsgGovUpdateRegistryResponseAminoMsg { + type: "/umee.leverage.v1.MsgGovUpdateRegistryResponse"; + value: MsgGovUpdateRegistryResponseAmino; +} +/** MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type. */ +export interface MsgGovUpdateRegistryResponseSDKType {} +/** MsgGovUpdateSpecialAssets defines the Msg/GovUpdateSpecialAssets request type. */ +export interface MsgGovUpdateSpecialAssets { + /** authority is the address of the governance account or the Emergency Group. */ + authority: string; + /** + * description motivating the change. Should be used only when executing by the + * Emergency Group. Otherwise the x/gov Proposal metadata should be used. + */ + description: string; + /** + * sets are bidirectional groups of special asset pairs. Creating a special asset + * set causes all assets in the set to have a certain collateral weight when borrowing + * against each other (but not looping with themselves). Overrides any existing + * special asset pairs between assets in the set. Using both collateral weight + * and liquidation theshold of zero will clear all existing special pairs in the set instead. + */ + sets: SpecialAssetSet[]; + /** + * pairs are new or updated special asset pairs. Updating both a special asset pair's + * collateral weight and liquidation threshold to zero deletes the pair instead. + * These pairs will be applied after any sets above when passing a proposal, + * so they can be used to override certain set elements, set directional relationships, + * or set an asset's relation to itself (looping). + */ + pairs: SpecialAssetPair[]; +} +export interface MsgGovUpdateSpecialAssetsProtoMsg { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssets"; + value: Uint8Array; +} +/** MsgGovUpdateSpecialAssets defines the Msg/GovUpdateSpecialAssets request type. */ +export interface MsgGovUpdateSpecialAssetsAmino { + /** authority is the address of the governance account or the Emergency Group. */ + authority?: string; + /** + * description motivating the change. Should be used only when executing by the + * Emergency Group. Otherwise the x/gov Proposal metadata should be used. + */ + description?: string; + /** + * sets are bidirectional groups of special asset pairs. Creating a special asset + * set causes all assets in the set to have a certain collateral weight when borrowing + * against each other (but not looping with themselves). Overrides any existing + * special asset pairs between assets in the set. Using both collateral weight + * and liquidation theshold of zero will clear all existing special pairs in the set instead. + */ + sets?: SpecialAssetSetAmino[]; + /** + * pairs are new or updated special asset pairs. Updating both a special asset pair's + * collateral weight and liquidation threshold to zero deletes the pair instead. + * These pairs will be applied after any sets above when passing a proposal, + * so they can be used to override certain set elements, set directional relationships, + * or set an asset's relation to itself (looping). + */ + pairs?: SpecialAssetPairAmino[]; +} +export interface MsgGovUpdateSpecialAssetsAminoMsg { + type: "/umee.leverage.v1.MsgGovUpdateSpecialAssets"; + value: MsgGovUpdateSpecialAssetsAmino; +} +/** MsgGovUpdateSpecialAssets defines the Msg/GovUpdateSpecialAssets request type. */ +export interface MsgGovUpdateSpecialAssetsSDKType { + authority: string; + description: string; + sets: SpecialAssetSetSDKType[]; + pairs: SpecialAssetPairSDKType[]; +} +/** MsgGovUpdateSpecialAssetsResponse defines the Msg/GovUpdateSpecialAssets response type. */ +export interface MsgGovUpdateSpecialAssetsResponse {} +export interface MsgGovUpdateSpecialAssetsResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssetsResponse"; + value: Uint8Array; +} +/** MsgGovUpdateSpecialAssetsResponse defines the Msg/GovUpdateSpecialAssets response type. */ +export interface MsgGovUpdateSpecialAssetsResponseAmino {} +export interface MsgGovUpdateSpecialAssetsResponseAminoMsg { + type: "/umee.leverage.v1.MsgGovUpdateSpecialAssetsResponse"; + value: MsgGovUpdateSpecialAssetsResponseAmino; +} +/** MsgGovUpdateSpecialAssetsResponse defines the Msg/GovUpdateSpecialAssets response type. */ +export interface MsgGovUpdateSpecialAssetsResponseSDKType {} +/** MsgGovSetParams is used by governance to update module parameters. */ +export interface MsgGovSetParams { + /** authority must be the address of the governance account. */ + authority: string; + params: Params; +} +export interface MsgGovSetParamsProtoMsg { + typeUrl: "/umee.leverage.v1.MsgGovSetParams"; + value: Uint8Array; +} +/** MsgGovSetParams is used by governance to update module parameters. */ +export interface MsgGovSetParamsAmino { + /** authority must be the address of the governance account. */ + authority?: string; + params?: ParamsAmino; +} +export interface MsgGovSetParamsAminoMsg { + type: "/umee.leverage.v1.MsgGovSetParams"; + value: MsgGovSetParamsAmino; +} +/** MsgGovSetParams is used by governance to update module parameters. */ +export interface MsgGovSetParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** MsgGovSetParamsResponse defines the Msg/SetParams response type. */ +export interface MsgGovSetParamsResponse {} +export interface MsgGovSetParamsResponseProtoMsg { + typeUrl: "/umee.leverage.v1.MsgGovSetParamsResponse"; + value: Uint8Array; +} +/** MsgGovSetParamsResponse defines the Msg/SetParams response type. */ +export interface MsgGovSetParamsResponseAmino {} +export interface MsgGovSetParamsResponseAminoMsg { + type: "/umee.leverage.v1.MsgGovSetParamsResponse"; + value: MsgGovSetParamsResponseAmino; +} +/** MsgGovSetParamsResponse defines the Msg/SetParams response type. */ +export interface MsgGovSetParamsResponseSDKType {} function createBaseMsgSupply(): MsgSupply { return { supplier: "", - asset: undefined + asset: Coin.fromPartial({}) }; } - export const MsgSupply = { - encode(message: MsgSupply, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgSupply", + encode(message: MsgSupply, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.supplier !== "") { writer.uint32(10).string(message.supplier); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSupply { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSupply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSupply(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.supplier = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSupply { + fromPartial(object: Partial): MsgSupply { const message = createBaseMsgSupply(); message.supplier = object.supplier ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: MsgSupplyAmino): MsgSupply { + const message = createBaseMsgSupply(); + if (object.supplier !== undefined && object.supplier !== null) { + message.supplier = object.supplier; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: MsgSupply): MsgSupplyAmino { + const obj: any = {}; + obj.supplier = message.supplier; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSupplyAminoMsg): MsgSupply { + return MsgSupply.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSupplyProtoMsg): MsgSupply { + return MsgSupply.decode(message.value); + }, + toProto(message: MsgSupply): Uint8Array { + return MsgSupply.encode(message).finish(); + }, + toProtoMsg(message: MsgSupply): MsgSupplyProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgSupply", + value: MsgSupply.encode(message).finish() + }; } - }; - function createBaseMsgWithdraw(): MsgWithdraw { return { supplier: "", - asset: undefined + asset: Coin.fromPartial({}) }; } - export const MsgWithdraw = { - encode(message: MsgWithdraw, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgWithdraw", + encode(message: MsgWithdraw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.supplier !== "") { writer.uint32(10).string(message.supplier); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdraw { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdraw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgWithdraw(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.supplier = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgWithdraw { + fromPartial(object: Partial): MsgWithdraw { const message = createBaseMsgWithdraw(); message.supplier = object.supplier ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: MsgWithdrawAmino): MsgWithdraw { + const message = createBaseMsgWithdraw(); + if (object.supplier !== undefined && object.supplier !== null) { + message.supplier = object.supplier; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: MsgWithdraw): MsgWithdrawAmino { + const obj: any = {}; + obj.supplier = message.supplier; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: MsgWithdrawAminoMsg): MsgWithdraw { + return MsgWithdraw.fromAmino(object.value); + }, + fromProtoMsg(message: MsgWithdrawProtoMsg): MsgWithdraw { + return MsgWithdraw.decode(message.value); + }, + toProto(message: MsgWithdraw): Uint8Array { + return MsgWithdraw.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdraw): MsgWithdrawProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgWithdraw", + value: MsgWithdraw.encode(message).finish() + }; } - }; - -function createBaseMsgCollateralize(): MsgCollateralize { +function createBaseMsgMaxWithdraw(): MsgMaxWithdraw { return { - borrower: "", - asset: undefined + supplier: "", + denom: "" }; } - -export const MsgCollateralize = { - encode(message: MsgCollateralize, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.borrower !== "") { - writer.uint32(10).string(message.borrower); - } - +export const MsgMaxWithdraw = { + typeUrl: "/umee.leverage.v1.MsgMaxWithdraw", + encode(message: MsgMaxWithdraw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.supplier !== "") { + writer.uint32(10).string(message.supplier); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMaxWithdraw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMaxWithdraw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.supplier = reader.string(); + break; + case 2: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgMaxWithdraw { + const message = createBaseMsgMaxWithdraw(); + message.supplier = object.supplier ?? ""; + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: MsgMaxWithdrawAmino): MsgMaxWithdraw { + const message = createBaseMsgMaxWithdraw(); + if (object.supplier !== undefined && object.supplier !== null) { + message.supplier = object.supplier; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: MsgMaxWithdraw): MsgMaxWithdrawAmino { + const obj: any = {}; + obj.supplier = message.supplier; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: MsgMaxWithdrawAminoMsg): MsgMaxWithdraw { + return MsgMaxWithdraw.fromAmino(object.value); + }, + fromProtoMsg(message: MsgMaxWithdrawProtoMsg): MsgMaxWithdraw { + return MsgMaxWithdraw.decode(message.value); + }, + toProto(message: MsgMaxWithdraw): Uint8Array { + return MsgMaxWithdraw.encode(message).finish(); + }, + toProtoMsg(message: MsgMaxWithdraw): MsgMaxWithdrawProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgMaxWithdraw", + value: MsgMaxWithdraw.encode(message).finish() + }; + } +}; +function createBaseMsgCollateralize(): MsgCollateralize { + return { + borrower: "", + asset: Coin.fromPartial({}) + }; +} +export const MsgCollateralize = { + typeUrl: "/umee.leverage.v1.MsgCollateralize", + encode(message: MsgCollateralize, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.borrower !== "") { + writer.uint32(10).string(message.borrower); + } if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCollateralize { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCollateralize { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCollateralize(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgCollateralize { + fromPartial(object: Partial): MsgCollateralize { const message = createBaseMsgCollateralize(); message.borrower = object.borrower ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: MsgCollateralizeAmino): MsgCollateralize { + const message = createBaseMsgCollateralize(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: MsgCollateralize): MsgCollateralizeAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCollateralizeAminoMsg): MsgCollateralize { + return MsgCollateralize.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCollateralizeProtoMsg): MsgCollateralize { + return MsgCollateralize.decode(message.value); + }, + toProto(message: MsgCollateralize): Uint8Array { + return MsgCollateralize.encode(message).finish(); + }, + toProtoMsg(message: MsgCollateralize): MsgCollateralizeProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgCollateralize", + value: MsgCollateralize.encode(message).finish() + }; } - }; - function createBaseMsgDecollateralize(): MsgDecollateralize { return { borrower: "", - asset: undefined + asset: Coin.fromPartial({}) }; } - export const MsgDecollateralize = { - encode(message: MsgDecollateralize, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgDecollateralize", + encode(message: MsgDecollateralize, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDecollateralize { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDecollateralize { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDecollateralize(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgDecollateralize { + fromPartial(object: Partial): MsgDecollateralize { const message = createBaseMsgDecollateralize(); message.borrower = object.borrower ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: MsgDecollateralizeAmino): MsgDecollateralize { + const message = createBaseMsgDecollateralize(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: MsgDecollateralize): MsgDecollateralizeAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: MsgDecollateralizeAminoMsg): MsgDecollateralize { + return MsgDecollateralize.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDecollateralizeProtoMsg): MsgDecollateralize { + return MsgDecollateralize.decode(message.value); + }, + toProto(message: MsgDecollateralize): Uint8Array { + return MsgDecollateralize.encode(message).finish(); + }, + toProtoMsg(message: MsgDecollateralize): MsgDecollateralizeProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgDecollateralize", + value: MsgDecollateralize.encode(message).finish() + }; } - }; - function createBaseMsgBorrow(): MsgBorrow { return { borrower: "", - asset: undefined + asset: Coin.fromPartial({}) }; } - export const MsgBorrow = { - encode(message: MsgBorrow, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgBorrow", + encode(message: MsgBorrow, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgBorrow { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgBorrow { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgBorrow(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgBorrow { + fromPartial(object: Partial): MsgBorrow { const message = createBaseMsgBorrow(); message.borrower = object.borrower ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: MsgBorrowAmino): MsgBorrow { + const message = createBaseMsgBorrow(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: MsgBorrow): MsgBorrowAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: MsgBorrowAminoMsg): MsgBorrow { + return MsgBorrow.fromAmino(object.value); + }, + fromProtoMsg(message: MsgBorrowProtoMsg): MsgBorrow { + return MsgBorrow.decode(message.value); + }, + toProto(message: MsgBorrow): Uint8Array { + return MsgBorrow.encode(message).finish(); + }, + toProtoMsg(message: MsgBorrow): MsgBorrowProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgBorrow", + value: MsgBorrow.encode(message).finish() + }; + } +}; +function createBaseMsgMaxBorrow(): MsgMaxBorrow { + return { + borrower: "", + denom: "" + }; +} +export const MsgMaxBorrow = { + typeUrl: "/umee.leverage.v1.MsgMaxBorrow", + encode(message: MsgMaxBorrow, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.borrower !== "") { + writer.uint32(10).string(message.borrower); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMaxBorrow { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMaxBorrow(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.borrower = reader.string(); + break; + case 2: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgMaxBorrow { + const message = createBaseMsgMaxBorrow(); + message.borrower = object.borrower ?? ""; + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: MsgMaxBorrowAmino): MsgMaxBorrow { + const message = createBaseMsgMaxBorrow(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: MsgMaxBorrow): MsgMaxBorrowAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: MsgMaxBorrowAminoMsg): MsgMaxBorrow { + return MsgMaxBorrow.fromAmino(object.value); + }, + fromProtoMsg(message: MsgMaxBorrowProtoMsg): MsgMaxBorrow { + return MsgMaxBorrow.decode(message.value); + }, + toProto(message: MsgMaxBorrow): Uint8Array { + return MsgMaxBorrow.encode(message).finish(); + }, + toProtoMsg(message: MsgMaxBorrow): MsgMaxBorrowProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgMaxBorrow", + value: MsgMaxBorrow.encode(message).finish() + }; } - }; - function createBaseMsgRepay(): MsgRepay { return { borrower: "", - asset: undefined + asset: Coin.fromPartial({}) }; } - export const MsgRepay = { - encode(message: MsgRepay, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgRepay", + encode(message: MsgRepay, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.borrower !== "") { writer.uint32(10).string(message.borrower); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRepay { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRepay { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRepay(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.borrower = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgRepay { + fromPartial(object: Partial): MsgRepay { const message = createBaseMsgRepay(); message.borrower = object.borrower ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: MsgRepayAmino): MsgRepay { + const message = createBaseMsgRepay(); + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: MsgRepay): MsgRepayAmino { + const obj: any = {}; + obj.borrower = message.borrower; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: MsgRepayAminoMsg): MsgRepay { + return MsgRepay.fromAmino(object.value); + }, + fromProtoMsg(message: MsgRepayProtoMsg): MsgRepay { + return MsgRepay.decode(message.value); + }, + toProto(message: MsgRepay): Uint8Array { + return MsgRepay.encode(message).finish(); + }, + toProtoMsg(message: MsgRepay): MsgRepayProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgRepay", + value: MsgRepay.encode(message).finish() + }; } - }; - function createBaseMsgLiquidate(): MsgLiquidate { return { liquidator: "", borrower: "", - repayment: undefined, + repayment: Coin.fromPartial({}), rewardDenom: "" }; } - export const MsgLiquidate = { - encode(message: MsgLiquidate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgLiquidate", + encode(message: MsgLiquidate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.liquidator !== "") { writer.uint32(10).string(message.liquidator); } - if (message.borrower !== "") { writer.uint32(18).string(message.borrower); } - if (message.repayment !== undefined) { Coin.encode(message.repayment, writer.uint32(26).fork()).ldelim(); } - if (message.rewardDenom !== "") { writer.uint32(34).string(message.rewardDenom); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgLiquidate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgLiquidate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgLiquidate(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.liquidator = reader.string(); break; - case 2: message.borrower = reader.string(); break; - case 3: message.repayment = Coin.decode(reader, reader.uint32()); break; - case 4: message.rewardDenom = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgLiquidate { + fromPartial(object: Partial): MsgLiquidate { const message = createBaseMsgLiquidate(); message.liquidator = object.liquidator ?? ""; message.borrower = object.borrower ?? ""; message.repayment = object.repayment !== undefined && object.repayment !== null ? Coin.fromPartial(object.repayment) : undefined; message.rewardDenom = object.rewardDenom ?? ""; return message; + }, + fromAmino(object: MsgLiquidateAmino): MsgLiquidate { + const message = createBaseMsgLiquidate(); + if (object.liquidator !== undefined && object.liquidator !== null) { + message.liquidator = object.liquidator; + } + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.repayment !== undefined && object.repayment !== null) { + message.repayment = Coin.fromAmino(object.repayment); + } + if (object.reward_denom !== undefined && object.reward_denom !== null) { + message.rewardDenom = object.reward_denom; + } + return message; + }, + toAmino(message: MsgLiquidate): MsgLiquidateAmino { + const obj: any = {}; + obj.liquidator = message.liquidator; + obj.borrower = message.borrower; + obj.repayment = message.repayment ? Coin.toAmino(message.repayment) : undefined; + obj.reward_denom = message.rewardDenom; + return obj; + }, + fromAminoMsg(object: MsgLiquidateAminoMsg): MsgLiquidate { + return MsgLiquidate.fromAmino(object.value); + }, + fromProtoMsg(message: MsgLiquidateProtoMsg): MsgLiquidate { + return MsgLiquidate.decode(message.value); + }, + toProto(message: MsgLiquidate): Uint8Array { + return MsgLiquidate.encode(message).finish(); + }, + toProtoMsg(message: MsgLiquidate): MsgLiquidateProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgLiquidate", + value: MsgLiquidate.encode(message).finish() + }; + } +}; +function createBaseMsgLeveragedLiquidate(): MsgLeveragedLiquidate { + return { + liquidator: "", + borrower: "", + repayDenom: "", + rewardDenom: "", + maxRepay: "" + }; +} +export const MsgLeveragedLiquidate = { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidate", + encode(message: MsgLeveragedLiquidate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.liquidator !== "") { + writer.uint32(10).string(message.liquidator); + } + if (message.borrower !== "") { + writer.uint32(18).string(message.borrower); + } + if (message.repayDenom !== "") { + writer.uint32(26).string(message.repayDenom); + } + if (message.rewardDenom !== "") { + writer.uint32(34).string(message.rewardDenom); + } + if (message.maxRepay !== "") { + writer.uint32(42).string(Decimal.fromUserInput(message.maxRepay, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeveragedLiquidate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeveragedLiquidate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.liquidator = reader.string(); + break; + case 2: + message.borrower = reader.string(); + break; + case 3: + message.repayDenom = reader.string(); + break; + case 4: + message.rewardDenom = reader.string(); + break; + case 5: + message.maxRepay = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgLeveragedLiquidate { + const message = createBaseMsgLeveragedLiquidate(); + message.liquidator = object.liquidator ?? ""; + message.borrower = object.borrower ?? ""; + message.repayDenom = object.repayDenom ?? ""; + message.rewardDenom = object.rewardDenom ?? ""; + message.maxRepay = object.maxRepay ?? ""; + return message; + }, + fromAmino(object: MsgLeveragedLiquidateAmino): MsgLeveragedLiquidate { + const message = createBaseMsgLeveragedLiquidate(); + if (object.liquidator !== undefined && object.liquidator !== null) { + message.liquidator = object.liquidator; + } + if (object.borrower !== undefined && object.borrower !== null) { + message.borrower = object.borrower; + } + if (object.repay_denom !== undefined && object.repay_denom !== null) { + message.repayDenom = object.repay_denom; + } + if (object.reward_denom !== undefined && object.reward_denom !== null) { + message.rewardDenom = object.reward_denom; + } + if (object.max_repay !== undefined && object.max_repay !== null) { + message.maxRepay = object.max_repay; + } + return message; + }, + toAmino(message: MsgLeveragedLiquidate): MsgLeveragedLiquidateAmino { + const obj: any = {}; + obj.liquidator = message.liquidator; + obj.borrower = message.borrower; + obj.repay_denom = message.repayDenom; + obj.reward_denom = message.rewardDenom; + obj.max_repay = message.maxRepay; + return obj; + }, + fromAminoMsg(object: MsgLeveragedLiquidateAminoMsg): MsgLeveragedLiquidate { + return MsgLeveragedLiquidate.fromAmino(object.value); + }, + fromProtoMsg(message: MsgLeveragedLiquidateProtoMsg): MsgLeveragedLiquidate { + return MsgLeveragedLiquidate.decode(message.value); + }, + toProto(message: MsgLeveragedLiquidate): Uint8Array { + return MsgLeveragedLiquidate.encode(message).finish(); + }, + toProtoMsg(message: MsgLeveragedLiquidate): MsgLeveragedLiquidateProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidate", + value: MsgLeveragedLiquidate.encode(message).finish() + }; } - }; - function createBaseMsgSupplyCollateral(): MsgSupplyCollateral { return { supplier: "", - asset: undefined + asset: Coin.fromPartial({}) }; } - export const MsgSupplyCollateral = { - encode(message: MsgSupplyCollateral, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgSupplyCollateral", + encode(message: MsgSupplyCollateral, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.supplier !== "") { writer.uint32(10).string(message.supplier); } - if (message.asset !== undefined) { Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSupplyCollateral { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSupplyCollateral { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSupplyCollateral(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.supplier = reader.string(); break; - case 2: message.asset = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSupplyCollateral { + fromPartial(object: Partial): MsgSupplyCollateral { const message = createBaseMsgSupplyCollateral(); message.supplier = object.supplier ?? ""; message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; return message; + }, + fromAmino(object: MsgSupplyCollateralAmino): MsgSupplyCollateral { + const message = createBaseMsgSupplyCollateral(); + if (object.supplier !== undefined && object.supplier !== null) { + message.supplier = object.supplier; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: MsgSupplyCollateral): MsgSupplyCollateralAmino { + const obj: any = {}; + obj.supplier = message.supplier; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSupplyCollateralAminoMsg): MsgSupplyCollateral { + return MsgSupplyCollateral.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSupplyCollateralProtoMsg): MsgSupplyCollateral { + return MsgSupplyCollateral.decode(message.value); + }, + toProto(message: MsgSupplyCollateral): Uint8Array { + return MsgSupplyCollateral.encode(message).finish(); + }, + toProtoMsg(message: MsgSupplyCollateral): MsgSupplyCollateralProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgSupplyCollateral", + value: MsgSupplyCollateral.encode(message).finish() + }; } - }; - function createBaseMsgSupplyResponse(): MsgSupplyResponse { return { - received: undefined + received: Coin.fromPartial({}) }; } - export const MsgSupplyResponse = { - encode(message: MsgSupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgSupplyResponse", + encode(message: MsgSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.received !== undefined) { Coin.encode(message.received, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSupplyResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSupplyResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.received = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSupplyResponse { + fromPartial(object: Partial): MsgSupplyResponse { const message = createBaseMsgSupplyResponse(); message.received = object.received !== undefined && object.received !== null ? Coin.fromPartial(object.received) : undefined; return message; + }, + fromAmino(object: MsgSupplyResponseAmino): MsgSupplyResponse { + const message = createBaseMsgSupplyResponse(); + if (object.received !== undefined && object.received !== null) { + message.received = Coin.fromAmino(object.received); + } + return message; + }, + toAmino(message: MsgSupplyResponse): MsgSupplyResponseAmino { + const obj: any = {}; + obj.received = message.received ? Coin.toAmino(message.received) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSupplyResponseAminoMsg): MsgSupplyResponse { + return MsgSupplyResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSupplyResponseProtoMsg): MsgSupplyResponse { + return MsgSupplyResponse.decode(message.value); + }, + toProto(message: MsgSupplyResponse): Uint8Array { + return MsgSupplyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSupplyResponse): MsgSupplyResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgSupplyResponse", + value: MsgSupplyResponse.encode(message).finish() + }; } - }; - function createBaseMsgWithdrawResponse(): MsgWithdrawResponse { return { - received: undefined + received: Coin.fromPartial({}) }; } - export const MsgWithdrawResponse = { - encode(message: MsgWithdrawResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgWithdrawResponse", + encode(message: MsgWithdrawResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.received !== undefined) { Coin.encode(message.received, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgWithdrawResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.received = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgWithdrawResponse { + fromPartial(object: Partial): MsgWithdrawResponse { const message = createBaseMsgWithdrawResponse(); message.received = object.received !== undefined && object.received !== null ? Coin.fromPartial(object.received) : undefined; return message; + }, + fromAmino(object: MsgWithdrawResponseAmino): MsgWithdrawResponse { + const message = createBaseMsgWithdrawResponse(); + if (object.received !== undefined && object.received !== null) { + message.received = Coin.fromAmino(object.received); + } + return message; + }, + toAmino(message: MsgWithdrawResponse): MsgWithdrawResponseAmino { + const obj: any = {}; + obj.received = message.received ? Coin.toAmino(message.received) : undefined; + return obj; + }, + fromAminoMsg(object: MsgWithdrawResponseAminoMsg): MsgWithdrawResponse { + return MsgWithdrawResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgWithdrawResponseProtoMsg): MsgWithdrawResponse { + return MsgWithdrawResponse.decode(message.value); + }, + toProto(message: MsgWithdrawResponse): Uint8Array { + return MsgWithdrawResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawResponse): MsgWithdrawResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgWithdrawResponse", + value: MsgWithdrawResponse.encode(message).finish() + }; } - }; - -function createBaseMsgCollateralizeResponse(): MsgCollateralizeResponse { - return {}; +function createBaseMsgMaxWithdrawResponse(): MsgMaxWithdrawResponse { + return { + withdrawn: Coin.fromPartial({}), + received: Coin.fromPartial({}) + }; } - -export const MsgCollateralizeResponse = { - encode(_: MsgCollateralizeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgMaxWithdrawResponse = { + typeUrl: "/umee.leverage.v1.MsgMaxWithdrawResponse", + encode(message: MsgMaxWithdrawResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.withdrawn !== undefined) { + Coin.encode(message.withdrawn, writer.uint32(10).fork()).ldelim(); + } + if (message.received !== undefined) { + Coin.encode(message.received, writer.uint32(18).fork()).ldelim(); + } return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCollateralizeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgMaxWithdrawResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCollateralizeResponse(); - + const message = createBaseMsgMaxWithdrawResponse(); while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { + case 1: + message.withdrawn = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.received = Coin.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgCollateralizeResponse { - const message = createBaseMsgCollateralizeResponse(); + fromPartial(object: Partial): MsgMaxWithdrawResponse { + const message = createBaseMsgMaxWithdrawResponse(); + message.withdrawn = object.withdrawn !== undefined && object.withdrawn !== null ? Coin.fromPartial(object.withdrawn) : undefined; + message.received = object.received !== undefined && object.received !== null ? Coin.fromPartial(object.received) : undefined; + return message; + }, + fromAmino(object: MsgMaxWithdrawResponseAmino): MsgMaxWithdrawResponse { + const message = createBaseMsgMaxWithdrawResponse(); + if (object.withdrawn !== undefined && object.withdrawn !== null) { + message.withdrawn = Coin.fromAmino(object.withdrawn); + } + if (object.received !== undefined && object.received !== null) { + message.received = Coin.fromAmino(object.received); + } return message; + }, + toAmino(message: MsgMaxWithdrawResponse): MsgMaxWithdrawResponseAmino { + const obj: any = {}; + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.received = message.received ? Coin.toAmino(message.received) : undefined; + return obj; + }, + fromAminoMsg(object: MsgMaxWithdrawResponseAminoMsg): MsgMaxWithdrawResponse { + return MsgMaxWithdrawResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgMaxWithdrawResponseProtoMsg): MsgMaxWithdrawResponse { + return MsgMaxWithdrawResponse.decode(message.value); + }, + toProto(message: MsgMaxWithdrawResponse): Uint8Array { + return MsgMaxWithdrawResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgMaxWithdrawResponse): MsgMaxWithdrawResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgMaxWithdrawResponse", + value: MsgMaxWithdrawResponse.encode(message).finish() + }; } - }; - -function createBaseMsgDecollateralizeResponse(): MsgDecollateralizeResponse { +function createBaseMsgCollateralizeResponse(): MsgCollateralizeResponse { return {}; } - -export const MsgDecollateralizeResponse = { - encode(_: MsgDecollateralizeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgCollateralizeResponse = { + typeUrl: "/umee.leverage.v1.MsgCollateralizeResponse", + encode(_: MsgCollateralizeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDecollateralizeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgCollateralizeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgDecollateralizeResponse(); - + const message = createBaseMsgCollateralizeResponse(); while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgDecollateralizeResponse { - const message = createBaseMsgDecollateralizeResponse(); + fromPartial(_: Partial): MsgCollateralizeResponse { + const message = createBaseMsgCollateralizeResponse(); return message; - } - + }, + fromAmino(_: MsgCollateralizeResponseAmino): MsgCollateralizeResponse { + const message = createBaseMsgCollateralizeResponse(); + return message; + }, + toAmino(_: MsgCollateralizeResponse): MsgCollateralizeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCollateralizeResponseAminoMsg): MsgCollateralizeResponse { + return MsgCollateralizeResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCollateralizeResponseProtoMsg): MsgCollateralizeResponse { + return MsgCollateralizeResponse.decode(message.value); + }, + toProto(message: MsgCollateralizeResponse): Uint8Array { + return MsgCollateralizeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCollateralizeResponse): MsgCollateralizeResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgCollateralizeResponse", + value: MsgCollateralizeResponse.encode(message).finish() + }; + } +}; +function createBaseMsgDecollateralizeResponse(): MsgDecollateralizeResponse { + return {}; +} +export const MsgDecollateralizeResponse = { + typeUrl: "/umee.leverage.v1.MsgDecollateralizeResponse", + encode(_: MsgDecollateralizeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDecollateralizeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDecollateralizeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgDecollateralizeResponse { + const message = createBaseMsgDecollateralizeResponse(); + return message; + }, + fromAmino(_: MsgDecollateralizeResponseAmino): MsgDecollateralizeResponse { + const message = createBaseMsgDecollateralizeResponse(); + return message; + }, + toAmino(_: MsgDecollateralizeResponse): MsgDecollateralizeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDecollateralizeResponseAminoMsg): MsgDecollateralizeResponse { + return MsgDecollateralizeResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDecollateralizeResponseProtoMsg): MsgDecollateralizeResponse { + return MsgDecollateralizeResponse.decode(message.value); + }, + toProto(message: MsgDecollateralizeResponse): Uint8Array { + return MsgDecollateralizeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDecollateralizeResponse): MsgDecollateralizeResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgDecollateralizeResponse", + value: MsgDecollateralizeResponse.encode(message).finish() + }; + } }; - function createBaseMsgBorrowResponse(): MsgBorrowResponse { return {}; } - export const MsgBorrowResponse = { - encode(_: MsgBorrowResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgBorrowResponse", + encode(_: MsgBorrowResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgBorrowResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgBorrowResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgBorrowResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgBorrowResponse { + fromPartial(_: Partial): MsgBorrowResponse { const message = createBaseMsgBorrowResponse(); return message; + }, + fromAmino(_: MsgBorrowResponseAmino): MsgBorrowResponse { + const message = createBaseMsgBorrowResponse(); + return message; + }, + toAmino(_: MsgBorrowResponse): MsgBorrowResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgBorrowResponseAminoMsg): MsgBorrowResponse { + return MsgBorrowResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgBorrowResponseProtoMsg): MsgBorrowResponse { + return MsgBorrowResponse.decode(message.value); + }, + toProto(message: MsgBorrowResponse): Uint8Array { + return MsgBorrowResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgBorrowResponse): MsgBorrowResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgBorrowResponse", + value: MsgBorrowResponse.encode(message).finish() + }; + } +}; +function createBaseMsgMaxBorrowResponse(): MsgMaxBorrowResponse { + return { + borrowed: Coin.fromPartial({}) + }; +} +export const MsgMaxBorrowResponse = { + typeUrl: "/umee.leverage.v1.MsgMaxBorrowResponse", + encode(message: MsgMaxBorrowResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.borrowed !== undefined) { + Coin.encode(message.borrowed, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMaxBorrowResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMaxBorrowResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.borrowed = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgMaxBorrowResponse { + const message = createBaseMsgMaxBorrowResponse(); + message.borrowed = object.borrowed !== undefined && object.borrowed !== null ? Coin.fromPartial(object.borrowed) : undefined; + return message; + }, + fromAmino(object: MsgMaxBorrowResponseAmino): MsgMaxBorrowResponse { + const message = createBaseMsgMaxBorrowResponse(); + if (object.borrowed !== undefined && object.borrowed !== null) { + message.borrowed = Coin.fromAmino(object.borrowed); + } + return message; + }, + toAmino(message: MsgMaxBorrowResponse): MsgMaxBorrowResponseAmino { + const obj: any = {}; + obj.borrowed = message.borrowed ? Coin.toAmino(message.borrowed) : undefined; + return obj; + }, + fromAminoMsg(object: MsgMaxBorrowResponseAminoMsg): MsgMaxBorrowResponse { + return MsgMaxBorrowResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgMaxBorrowResponseProtoMsg): MsgMaxBorrowResponse { + return MsgMaxBorrowResponse.decode(message.value); + }, + toProto(message: MsgMaxBorrowResponse): Uint8Array { + return MsgMaxBorrowResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgMaxBorrowResponse): MsgMaxBorrowResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgMaxBorrowResponse", + value: MsgMaxBorrowResponse.encode(message).finish() + }; } - }; - function createBaseMsgRepayResponse(): MsgRepayResponse { return { - repaid: undefined + repaid: Coin.fromPartial({}) }; } - export const MsgRepayResponse = { - encode(message: MsgRepayResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgRepayResponse", + encode(message: MsgRepayResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.repaid !== undefined) { Coin.encode(message.repaid, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgRepayResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgRepayResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgRepayResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.repaid = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgRepayResponse { + fromPartial(object: Partial): MsgRepayResponse { const message = createBaseMsgRepayResponse(); message.repaid = object.repaid !== undefined && object.repaid !== null ? Coin.fromPartial(object.repaid) : undefined; return message; + }, + fromAmino(object: MsgRepayResponseAmino): MsgRepayResponse { + const message = createBaseMsgRepayResponse(); + if (object.repaid !== undefined && object.repaid !== null) { + message.repaid = Coin.fromAmino(object.repaid); + } + return message; + }, + toAmino(message: MsgRepayResponse): MsgRepayResponseAmino { + const obj: any = {}; + obj.repaid = message.repaid ? Coin.toAmino(message.repaid) : undefined; + return obj; + }, + fromAminoMsg(object: MsgRepayResponseAminoMsg): MsgRepayResponse { + return MsgRepayResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgRepayResponseProtoMsg): MsgRepayResponse { + return MsgRepayResponse.decode(message.value); + }, + toProto(message: MsgRepayResponse): Uint8Array { + return MsgRepayResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRepayResponse): MsgRepayResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgRepayResponse", + value: MsgRepayResponse.encode(message).finish() + }; } - }; - function createBaseMsgLiquidateResponse(): MsgLiquidateResponse { return { - repaid: undefined, - collateral: undefined, - reward: undefined + repaid: Coin.fromPartial({}), + collateral: Coin.fromPartial({}), + reward: Coin.fromPartial({}) }; } - export const MsgLiquidateResponse = { - encode(message: MsgLiquidateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgLiquidateResponse", + encode(message: MsgLiquidateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.repaid !== undefined) { Coin.encode(message.repaid, writer.uint32(10).fork()).ldelim(); } - if (message.collateral !== undefined) { Coin.encode(message.collateral, writer.uint32(18).fork()).ldelim(); } - if (message.reward !== undefined) { Coin.encode(message.reward, writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgLiquidateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgLiquidateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgLiquidateResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.repaid = Coin.decode(reader, reader.uint32()); break; - case 2: message.collateral = Coin.decode(reader, reader.uint32()); break; - case 3: message.reward = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgLiquidateResponse { + fromPartial(object: Partial): MsgLiquidateResponse { const message = createBaseMsgLiquidateResponse(); message.repaid = object.repaid !== undefined && object.repaid !== null ? Coin.fromPartial(object.repaid) : undefined; message.collateral = object.collateral !== undefined && object.collateral !== null ? Coin.fromPartial(object.collateral) : undefined; message.reward = object.reward !== undefined && object.reward !== null ? Coin.fromPartial(object.reward) : undefined; return message; + }, + fromAmino(object: MsgLiquidateResponseAmino): MsgLiquidateResponse { + const message = createBaseMsgLiquidateResponse(); + if (object.repaid !== undefined && object.repaid !== null) { + message.repaid = Coin.fromAmino(object.repaid); + } + if (object.collateral !== undefined && object.collateral !== null) { + message.collateral = Coin.fromAmino(object.collateral); + } + if (object.reward !== undefined && object.reward !== null) { + message.reward = Coin.fromAmino(object.reward); + } + return message; + }, + toAmino(message: MsgLiquidateResponse): MsgLiquidateResponseAmino { + const obj: any = {}; + obj.repaid = message.repaid ? Coin.toAmino(message.repaid) : undefined; + obj.collateral = message.collateral ? Coin.toAmino(message.collateral) : undefined; + obj.reward = message.reward ? Coin.toAmino(message.reward) : undefined; + return obj; + }, + fromAminoMsg(object: MsgLiquidateResponseAminoMsg): MsgLiquidateResponse { + return MsgLiquidateResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgLiquidateResponseProtoMsg): MsgLiquidateResponse { + return MsgLiquidateResponse.decode(message.value); + }, + toProto(message: MsgLiquidateResponse): Uint8Array { + return MsgLiquidateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgLiquidateResponse): MsgLiquidateResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgLiquidateResponse", + value: MsgLiquidateResponse.encode(message).finish() + }; + } +}; +function createBaseMsgLeveragedLiquidateResponse(): MsgLeveragedLiquidateResponse { + return { + repaid: Coin.fromPartial({}), + reward: Coin.fromPartial({}) + }; +} +export const MsgLeveragedLiquidateResponse = { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidateResponse", + encode(message: MsgLeveragedLiquidateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.repaid !== undefined) { + Coin.encode(message.repaid, writer.uint32(10).fork()).ldelim(); + } + if (message.reward !== undefined) { + Coin.encode(message.reward, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeveragedLiquidateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeveragedLiquidateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.repaid = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.reward = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgLeveragedLiquidateResponse { + const message = createBaseMsgLeveragedLiquidateResponse(); + message.repaid = object.repaid !== undefined && object.repaid !== null ? Coin.fromPartial(object.repaid) : undefined; + message.reward = object.reward !== undefined && object.reward !== null ? Coin.fromPartial(object.reward) : undefined; + return message; + }, + fromAmino(object: MsgLeveragedLiquidateResponseAmino): MsgLeveragedLiquidateResponse { + const message = createBaseMsgLeveragedLiquidateResponse(); + if (object.repaid !== undefined && object.repaid !== null) { + message.repaid = Coin.fromAmino(object.repaid); + } + if (object.reward !== undefined && object.reward !== null) { + message.reward = Coin.fromAmino(object.reward); + } + return message; + }, + toAmino(message: MsgLeveragedLiquidateResponse): MsgLeveragedLiquidateResponseAmino { + const obj: any = {}; + obj.repaid = message.repaid ? Coin.toAmino(message.repaid) : undefined; + obj.reward = message.reward ? Coin.toAmino(message.reward) : undefined; + return obj; + }, + fromAminoMsg(object: MsgLeveragedLiquidateResponseAminoMsg): MsgLeveragedLiquidateResponse { + return MsgLeveragedLiquidateResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgLeveragedLiquidateResponseProtoMsg): MsgLeveragedLiquidateResponse { + return MsgLeveragedLiquidateResponse.decode(message.value); + }, + toProto(message: MsgLeveragedLiquidateResponse): Uint8Array { + return MsgLeveragedLiquidateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgLeveragedLiquidateResponse): MsgLeveragedLiquidateResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgLeveragedLiquidateResponse", + value: MsgLeveragedLiquidateResponse.encode(message).finish() + }; } - }; - function createBaseMsgSupplyCollateralResponse(): MsgSupplyCollateralResponse { return { - collateralized: undefined + collateralized: Coin.fromPartial({}) }; } - export const MsgSupplyCollateralResponse = { - encode(message: MsgSupplyCollateralResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.leverage.v1.MsgSupplyCollateralResponse", + encode(message: MsgSupplyCollateralResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.collateralized !== undefined) { Coin.encode(message.collateralized, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgSupplyCollateralResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgSupplyCollateralResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgSupplyCollateralResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.collateralized = Coin.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgSupplyCollateralResponse { + fromPartial(object: Partial): MsgSupplyCollateralResponse { const message = createBaseMsgSupplyCollateralResponse(); message.collateralized = object.collateralized !== undefined && object.collateralized !== null ? Coin.fromPartial(object.collateralized) : undefined; return message; + }, + fromAmino(object: MsgSupplyCollateralResponseAmino): MsgSupplyCollateralResponse { + const message = createBaseMsgSupplyCollateralResponse(); + if (object.collateralized !== undefined && object.collateralized !== null) { + message.collateralized = Coin.fromAmino(object.collateralized); + } + return message; + }, + toAmino(message: MsgSupplyCollateralResponse): MsgSupplyCollateralResponseAmino { + const obj: any = {}; + obj.collateralized = message.collateralized ? Coin.toAmino(message.collateralized) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSupplyCollateralResponseAminoMsg): MsgSupplyCollateralResponse { + return MsgSupplyCollateralResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSupplyCollateralResponseProtoMsg): MsgSupplyCollateralResponse { + return MsgSupplyCollateralResponse.decode(message.value); + }, + toProto(message: MsgSupplyCollateralResponse): Uint8Array { + return MsgSupplyCollateralResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSupplyCollateralResponse): MsgSupplyCollateralResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgSupplyCollateralResponse", + value: MsgSupplyCollateralResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateRegistry(): MsgGovUpdateRegistry { + return { + authority: "", + description: "", + addTokens: [], + updateTokens: [] + }; +} +export const MsgGovUpdateRegistry = { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistry", + encode(message: MsgGovUpdateRegistry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.description !== "") { + writer.uint32(26).string(message.description); + } + for (const v of message.addTokens) { + Token.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.updateTokens) { + Token.encode(v!, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateRegistry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateRegistry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.addTokens.push(Token.decode(reader, reader.uint32())); + break; + case 5: + message.updateTokens.push(Token.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovUpdateRegistry { + const message = createBaseMsgGovUpdateRegistry(); + message.authority = object.authority ?? ""; + message.description = object.description ?? ""; + message.addTokens = object.addTokens?.map(e => Token.fromPartial(e)) || []; + message.updateTokens = object.updateTokens?.map(e => Token.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgGovUpdateRegistryAmino): MsgGovUpdateRegistry { + const message = createBaseMsgGovUpdateRegistry(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.addTokens = object.add_tokens?.map(e => Token.fromAmino(e)) || []; + message.updateTokens = object.update_tokens?.map(e => Token.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgGovUpdateRegistry): MsgGovUpdateRegistryAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.description = message.description; + if (message.addTokens) { + obj.add_tokens = message.addTokens.map(e => e ? Token.toAmino(e) : undefined); + } else { + obj.add_tokens = []; + } + if (message.updateTokens) { + obj.update_tokens = message.updateTokens.map(e => e ? Token.toAmino(e) : undefined); + } else { + obj.update_tokens = []; + } + return obj; + }, + fromAminoMsg(object: MsgGovUpdateRegistryAminoMsg): MsgGovUpdateRegistry { + return MsgGovUpdateRegistry.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateRegistryProtoMsg): MsgGovUpdateRegistry { + return MsgGovUpdateRegistry.decode(message.value); + }, + toProto(message: MsgGovUpdateRegistry): Uint8Array { + return MsgGovUpdateRegistry.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateRegistry): MsgGovUpdateRegistryProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistry", + value: MsgGovUpdateRegistry.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateRegistryResponse(): MsgGovUpdateRegistryResponse { + return {}; +} +export const MsgGovUpdateRegistryResponse = { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistryResponse", + encode(_: MsgGovUpdateRegistryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateRegistryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateRegistryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovUpdateRegistryResponse { + const message = createBaseMsgGovUpdateRegistryResponse(); + return message; + }, + fromAmino(_: MsgGovUpdateRegistryResponseAmino): MsgGovUpdateRegistryResponse { + const message = createBaseMsgGovUpdateRegistryResponse(); + return message; + }, + toAmino(_: MsgGovUpdateRegistryResponse): MsgGovUpdateRegistryResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovUpdateRegistryResponseAminoMsg): MsgGovUpdateRegistryResponse { + return MsgGovUpdateRegistryResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateRegistryResponseProtoMsg): MsgGovUpdateRegistryResponse { + return MsgGovUpdateRegistryResponse.decode(message.value); + }, + toProto(message: MsgGovUpdateRegistryResponse): Uint8Array { + return MsgGovUpdateRegistryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateRegistryResponse): MsgGovUpdateRegistryResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateRegistryResponse", + value: MsgGovUpdateRegistryResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateSpecialAssets(): MsgGovUpdateSpecialAssets { + return { + authority: "", + description: "", + sets: [], + pairs: [] + }; +} +export const MsgGovUpdateSpecialAssets = { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssets", + encode(message: MsgGovUpdateSpecialAssets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.sets) { + SpecialAssetSet.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.pairs) { + SpecialAssetPair.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateSpecialAssets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateSpecialAssets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.sets.push(SpecialAssetSet.decode(reader, reader.uint32())); + break; + case 4: + message.pairs.push(SpecialAssetPair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovUpdateSpecialAssets { + const message = createBaseMsgGovUpdateSpecialAssets(); + message.authority = object.authority ?? ""; + message.description = object.description ?? ""; + message.sets = object.sets?.map(e => SpecialAssetSet.fromPartial(e)) || []; + message.pairs = object.pairs?.map(e => SpecialAssetPair.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgGovUpdateSpecialAssetsAmino): MsgGovUpdateSpecialAssets { + const message = createBaseMsgGovUpdateSpecialAssets(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.sets = object.sets?.map(e => SpecialAssetSet.fromAmino(e)) || []; + message.pairs = object.pairs?.map(e => SpecialAssetPair.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgGovUpdateSpecialAssets): MsgGovUpdateSpecialAssetsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.description = message.description; + if (message.sets) { + obj.sets = message.sets.map(e => e ? SpecialAssetSet.toAmino(e) : undefined); + } else { + obj.sets = []; + } + if (message.pairs) { + obj.pairs = message.pairs.map(e => e ? SpecialAssetPair.toAmino(e) : undefined); + } else { + obj.pairs = []; + } + return obj; + }, + fromAminoMsg(object: MsgGovUpdateSpecialAssetsAminoMsg): MsgGovUpdateSpecialAssets { + return MsgGovUpdateSpecialAssets.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateSpecialAssetsProtoMsg): MsgGovUpdateSpecialAssets { + return MsgGovUpdateSpecialAssets.decode(message.value); + }, + toProto(message: MsgGovUpdateSpecialAssets): Uint8Array { + return MsgGovUpdateSpecialAssets.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateSpecialAssets): MsgGovUpdateSpecialAssetsProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssets", + value: MsgGovUpdateSpecialAssets.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateSpecialAssetsResponse(): MsgGovUpdateSpecialAssetsResponse { + return {}; +} +export const MsgGovUpdateSpecialAssetsResponse = { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssetsResponse", + encode(_: MsgGovUpdateSpecialAssetsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateSpecialAssetsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateSpecialAssetsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovUpdateSpecialAssetsResponse { + const message = createBaseMsgGovUpdateSpecialAssetsResponse(); + return message; + }, + fromAmino(_: MsgGovUpdateSpecialAssetsResponseAmino): MsgGovUpdateSpecialAssetsResponse { + const message = createBaseMsgGovUpdateSpecialAssetsResponse(); + return message; + }, + toAmino(_: MsgGovUpdateSpecialAssetsResponse): MsgGovUpdateSpecialAssetsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovUpdateSpecialAssetsResponseAminoMsg): MsgGovUpdateSpecialAssetsResponse { + return MsgGovUpdateSpecialAssetsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateSpecialAssetsResponseProtoMsg): MsgGovUpdateSpecialAssetsResponse { + return MsgGovUpdateSpecialAssetsResponse.decode(message.value); + }, + toProto(message: MsgGovUpdateSpecialAssetsResponse): Uint8Array { + return MsgGovUpdateSpecialAssetsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateSpecialAssetsResponse): MsgGovUpdateSpecialAssetsResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgGovUpdateSpecialAssetsResponse", + value: MsgGovUpdateSpecialAssetsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetParams(): MsgGovSetParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgGovSetParams = { + typeUrl: "/umee.leverage.v1.MsgGovSetParams", + encode(message: MsgGovSetParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovSetParams { + const message = createBaseMsgGovSetParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgGovSetParamsAmino): MsgGovSetParams { + const message = createBaseMsgGovSetParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgGovSetParams): MsgGovSetParamsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGovSetParamsAminoMsg): MsgGovSetParams { + return MsgGovSetParams.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetParamsProtoMsg): MsgGovSetParams { + return MsgGovSetParams.decode(message.value); + }, + toProto(message: MsgGovSetParams): Uint8Array { + return MsgGovSetParams.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetParams): MsgGovSetParamsProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgGovSetParams", + value: MsgGovSetParams.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetParamsResponse(): MsgGovSetParamsResponse { + return {}; +} +export const MsgGovSetParamsResponse = { + typeUrl: "/umee.leverage.v1.MsgGovSetParamsResponse", + encode(_: MsgGovSetParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovSetParamsResponse { + const message = createBaseMsgGovSetParamsResponse(); + return message; + }, + fromAmino(_: MsgGovSetParamsResponseAmino): MsgGovSetParamsResponse { + const message = createBaseMsgGovSetParamsResponse(); + return message; + }, + toAmino(_: MsgGovSetParamsResponse): MsgGovSetParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovSetParamsResponseAminoMsg): MsgGovSetParamsResponse { + return MsgGovSetParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetParamsResponseProtoMsg): MsgGovSetParamsResponse { + return MsgGovSetParamsResponse.decode(message.value); + }, + toProto(message: MsgGovSetParamsResponse): Uint8Array { + return MsgGovSetParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetParamsResponse): MsgGovSetParamsResponseProtoMsg { + return { + typeUrl: "/umee.leverage.v1.MsgGovSetParamsResponse", + value: MsgGovSetParamsResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/events.ts b/src/codegen/umee/metoken/v1/events.ts new file mode 100644 index 0000000..d2b3b26 --- /dev/null +++ b/src/codegen/umee/metoken/v1/events.ts @@ -0,0 +1,569 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** EventSwap is emitted on Msg/Swap */ +export interface EventSwap { + /** meToken recipient bech32 address. */ + recipient: string; + /** Asset provided for the swap. */ + asset: Coin; + /** meToken received by the recipient in exchange for the provided asset. */ + metoken: Coin; + /** Fee provided for the swap. */ + fee: Coin; +} +export interface EventSwapProtoMsg { + typeUrl: "/umee.metoken.v1.EventSwap"; + value: Uint8Array; +} +/** EventSwap is emitted on Msg/Swap */ +export interface EventSwapAmino { + /** meToken recipient bech32 address. */ + recipient?: string; + /** Asset provided for the swap. */ + asset?: CoinAmino; + /** meToken received by the recipient in exchange for the provided asset. */ + metoken?: CoinAmino; + /** Fee provided for the swap. */ + fee?: CoinAmino; +} +export interface EventSwapAminoMsg { + type: "/umee.metoken.v1.EventSwap"; + value: EventSwapAmino; +} +/** EventSwap is emitted on Msg/Swap */ +export interface EventSwapSDKType { + recipient: string; + asset: CoinSDKType; + metoken: CoinSDKType; + fee: CoinSDKType; +} +/** EventRedeem is emitted on Msg/Redeem */ +export interface EventRedeem { + /** Asset recipient bech32 address. */ + recipient: string; + /** meToken provided for the redemption. */ + metoken: Coin; + /** Asset received by the recipient in exchange for the provided meToken. */ + asset: Coin; + /** Fee provided for the redemption. */ + fee: Coin; +} +export interface EventRedeemProtoMsg { + typeUrl: "/umee.metoken.v1.EventRedeem"; + value: Uint8Array; +} +/** EventRedeem is emitted on Msg/Redeem */ +export interface EventRedeemAmino { + /** Asset recipient bech32 address. */ + recipient?: string; + /** meToken provided for the redemption. */ + metoken?: CoinAmino; + /** Asset received by the recipient in exchange for the provided meToken. */ + asset?: CoinAmino; + /** Fee provided for the redemption. */ + fee?: CoinAmino; +} +export interface EventRedeemAminoMsg { + type: "/umee.metoken.v1.EventRedeem"; + value: EventRedeemAmino; +} +/** EventRedeem is emitted on Msg/Redeem */ +export interface EventRedeemSDKType { + recipient: string; + metoken: CoinSDKType; + asset: CoinSDKType; + fee: CoinSDKType; +} +/** EventRebalancing is emitted when a reserve re-balancing occurs. */ +export interface EventRebalancing { + /** RebalancingResults of every asset in every Index. */ + results: RebalancingResult[]; +} +export interface EventRebalancingProtoMsg { + typeUrl: "/umee.metoken.v1.EventRebalancing"; + value: Uint8Array; +} +/** EventRebalancing is emitted when a reserve re-balancing occurs. */ +export interface EventRebalancingAmino { + /** RebalancingResults of every asset in every Index. */ + results?: RebalancingResultAmino[]; +} +export interface EventRebalancingAminoMsg { + type: "/umee.metoken.v1.EventRebalancing"; + value: EventRebalancingAmino; +} +/** EventRebalancing is emitted when a reserve re-balancing occurs. */ +export interface EventRebalancingSDKType { + results: RebalancingResultSDKType[]; +} +/** RebalancingResult of a specific Index with initial and result balances of underlying assets. */ +export interface RebalancingResult { + metokenDenom: string; + /** Initial balance of an asset in the Index before re-balancing. */ + initialBalance: Coin[]; + /** Result balance of an asset in the Index after re-balancing. */ + resultBalance: Coin[]; +} +export interface RebalancingResultProtoMsg { + typeUrl: "/umee.metoken.v1.RebalancingResult"; + value: Uint8Array; +} +/** RebalancingResult of a specific Index with initial and result balances of underlying assets. */ +export interface RebalancingResultAmino { + metoken_denom?: string; + /** Initial balance of an asset in the Index before re-balancing. */ + initial_balance?: CoinAmino[]; + /** Result balance of an asset in the Index after re-balancing. */ + result_balance?: CoinAmino[]; +} +export interface RebalancingResultAminoMsg { + type: "/umee.metoken.v1.RebalancingResult"; + value: RebalancingResultAmino; +} +/** RebalancingResult of a specific Index with initial and result balances of underlying assets. */ +export interface RebalancingResultSDKType { + metoken_denom: string; + initial_balance: CoinSDKType[]; + result_balance: CoinSDKType[]; +} +/** EventInterestClaim is emitted when the accrued interest was claimed from x/leverage */ +export interface EventInterestClaim { + /** The denom and amount of successfully claimed interest */ + claimedAsset: Coin[]; +} +export interface EventInterestClaimProtoMsg { + typeUrl: "/umee.metoken.v1.EventInterestClaim"; + value: Uint8Array; +} +/** EventInterestClaim is emitted when the accrued interest was claimed from x/leverage */ +export interface EventInterestClaimAmino { + /** The denom and amount of successfully claimed interest */ + claimed_asset?: CoinAmino[]; +} +export interface EventInterestClaimAminoMsg { + type: "/umee.metoken.v1.EventInterestClaim"; + value: EventInterestClaimAmino; +} +/** EventInterestClaim is emitted when the accrued interest was claimed from x/leverage */ +export interface EventInterestClaimSDKType { + claimed_asset: CoinSDKType[]; +} +function createBaseEventSwap(): EventSwap { + return { + recipient: "", + asset: Coin.fromPartial({}), + metoken: Coin.fromPartial({}), + fee: Coin.fromPartial({}) + }; +} +export const EventSwap = { + typeUrl: "/umee.metoken.v1.EventSwap", + encode(message: EventSwap, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.recipient !== "") { + writer.uint32(10).string(message.recipient); + } + if (message.asset !== undefined) { + Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); + } + if (message.metoken !== undefined) { + Coin.encode(message.metoken, writer.uint32(26).fork()).ldelim(); + } + if (message.fee !== undefined) { + Coin.encode(message.fee, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventSwap { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSwap(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recipient = reader.string(); + break; + case 2: + message.asset = Coin.decode(reader, reader.uint32()); + break; + case 3: + message.metoken = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.fee = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventSwap { + const message = createBaseEventSwap(); + message.recipient = object.recipient ?? ""; + message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; + message.metoken = object.metoken !== undefined && object.metoken !== null ? Coin.fromPartial(object.metoken) : undefined; + message.fee = object.fee !== undefined && object.fee !== null ? Coin.fromPartial(object.fee) : undefined; + return message; + }, + fromAmino(object: EventSwapAmino): EventSwap { + const message = createBaseEventSwap(); + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + if (object.metoken !== undefined && object.metoken !== null) { + message.metoken = Coin.fromAmino(object.metoken); + } + if (object.fee !== undefined && object.fee !== null) { + message.fee = Coin.fromAmino(object.fee); + } + return message; + }, + toAmino(message: EventSwap): EventSwapAmino { + const obj: any = {}; + obj.recipient = message.recipient; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + obj.metoken = message.metoken ? Coin.toAmino(message.metoken) : undefined; + obj.fee = message.fee ? Coin.toAmino(message.fee) : undefined; + return obj; + }, + fromAminoMsg(object: EventSwapAminoMsg): EventSwap { + return EventSwap.fromAmino(object.value); + }, + fromProtoMsg(message: EventSwapProtoMsg): EventSwap { + return EventSwap.decode(message.value); + }, + toProto(message: EventSwap): Uint8Array { + return EventSwap.encode(message).finish(); + }, + toProtoMsg(message: EventSwap): EventSwapProtoMsg { + return { + typeUrl: "/umee.metoken.v1.EventSwap", + value: EventSwap.encode(message).finish() + }; + } +}; +function createBaseEventRedeem(): EventRedeem { + return { + recipient: "", + metoken: Coin.fromPartial({}), + asset: Coin.fromPartial({}), + fee: Coin.fromPartial({}) + }; +} +export const EventRedeem = { + typeUrl: "/umee.metoken.v1.EventRedeem", + encode(message: EventRedeem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.recipient !== "") { + writer.uint32(10).string(message.recipient); + } + if (message.metoken !== undefined) { + Coin.encode(message.metoken, writer.uint32(18).fork()).ldelim(); + } + if (message.asset !== undefined) { + Coin.encode(message.asset, writer.uint32(26).fork()).ldelim(); + } + if (message.fee !== undefined) { + Coin.encode(message.fee, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventRedeem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRedeem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recipient = reader.string(); + break; + case 2: + message.metoken = Coin.decode(reader, reader.uint32()); + break; + case 3: + message.asset = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.fee = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventRedeem { + const message = createBaseEventRedeem(); + message.recipient = object.recipient ?? ""; + message.metoken = object.metoken !== undefined && object.metoken !== null ? Coin.fromPartial(object.metoken) : undefined; + message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; + message.fee = object.fee !== undefined && object.fee !== null ? Coin.fromPartial(object.fee) : undefined; + return message; + }, + fromAmino(object: EventRedeemAmino): EventRedeem { + const message = createBaseEventRedeem(); + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + if (object.metoken !== undefined && object.metoken !== null) { + message.metoken = Coin.fromAmino(object.metoken); + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + if (object.fee !== undefined && object.fee !== null) { + message.fee = Coin.fromAmino(object.fee); + } + return message; + }, + toAmino(message: EventRedeem): EventRedeemAmino { + const obj: any = {}; + obj.recipient = message.recipient; + obj.metoken = message.metoken ? Coin.toAmino(message.metoken) : undefined; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + obj.fee = message.fee ? Coin.toAmino(message.fee) : undefined; + return obj; + }, + fromAminoMsg(object: EventRedeemAminoMsg): EventRedeem { + return EventRedeem.fromAmino(object.value); + }, + fromProtoMsg(message: EventRedeemProtoMsg): EventRedeem { + return EventRedeem.decode(message.value); + }, + toProto(message: EventRedeem): Uint8Array { + return EventRedeem.encode(message).finish(); + }, + toProtoMsg(message: EventRedeem): EventRedeemProtoMsg { + return { + typeUrl: "/umee.metoken.v1.EventRedeem", + value: EventRedeem.encode(message).finish() + }; + } +}; +function createBaseEventRebalancing(): EventRebalancing { + return { + results: [] + }; +} +export const EventRebalancing = { + typeUrl: "/umee.metoken.v1.EventRebalancing", + encode(message: EventRebalancing, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.results) { + RebalancingResult.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventRebalancing { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRebalancing(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.results.push(RebalancingResult.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventRebalancing { + const message = createBaseEventRebalancing(); + message.results = object.results?.map(e => RebalancingResult.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EventRebalancingAmino): EventRebalancing { + const message = createBaseEventRebalancing(); + message.results = object.results?.map(e => RebalancingResult.fromAmino(e)) || []; + return message; + }, + toAmino(message: EventRebalancing): EventRebalancingAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => e ? RebalancingResult.toAmino(e) : undefined); + } else { + obj.results = []; + } + return obj; + }, + fromAminoMsg(object: EventRebalancingAminoMsg): EventRebalancing { + return EventRebalancing.fromAmino(object.value); + }, + fromProtoMsg(message: EventRebalancingProtoMsg): EventRebalancing { + return EventRebalancing.decode(message.value); + }, + toProto(message: EventRebalancing): Uint8Array { + return EventRebalancing.encode(message).finish(); + }, + toProtoMsg(message: EventRebalancing): EventRebalancingProtoMsg { + return { + typeUrl: "/umee.metoken.v1.EventRebalancing", + value: EventRebalancing.encode(message).finish() + }; + } +}; +function createBaseRebalancingResult(): RebalancingResult { + return { + metokenDenom: "", + initialBalance: [], + resultBalance: [] + }; +} +export const RebalancingResult = { + typeUrl: "/umee.metoken.v1.RebalancingResult", + encode(message: RebalancingResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metokenDenom !== "") { + writer.uint32(10).string(message.metokenDenom); + } + for (const v of message.initialBalance) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.resultBalance) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RebalancingResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRebalancingResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metokenDenom = reader.string(); + break; + case 2: + message.initialBalance.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.resultBalance.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): RebalancingResult { + const message = createBaseRebalancingResult(); + message.metokenDenom = object.metokenDenom ?? ""; + message.initialBalance = object.initialBalance?.map(e => Coin.fromPartial(e)) || []; + message.resultBalance = object.resultBalance?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: RebalancingResultAmino): RebalancingResult { + const message = createBaseRebalancingResult(); + if (object.metoken_denom !== undefined && object.metoken_denom !== null) { + message.metokenDenom = object.metoken_denom; + } + message.initialBalance = object.initial_balance?.map(e => Coin.fromAmino(e)) || []; + message.resultBalance = object.result_balance?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: RebalancingResult): RebalancingResultAmino { + const obj: any = {}; + obj.metoken_denom = message.metokenDenom; + if (message.initialBalance) { + obj.initial_balance = message.initialBalance.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.initial_balance = []; + } + if (message.resultBalance) { + obj.result_balance = message.resultBalance.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.result_balance = []; + } + return obj; + }, + fromAminoMsg(object: RebalancingResultAminoMsg): RebalancingResult { + return RebalancingResult.fromAmino(object.value); + }, + fromProtoMsg(message: RebalancingResultProtoMsg): RebalancingResult { + return RebalancingResult.decode(message.value); + }, + toProto(message: RebalancingResult): Uint8Array { + return RebalancingResult.encode(message).finish(); + }, + toProtoMsg(message: RebalancingResult): RebalancingResultProtoMsg { + return { + typeUrl: "/umee.metoken.v1.RebalancingResult", + value: RebalancingResult.encode(message).finish() + }; + } +}; +function createBaseEventInterestClaim(): EventInterestClaim { + return { + claimedAsset: [] + }; +} +export const EventInterestClaim = { + typeUrl: "/umee.metoken.v1.EventInterestClaim", + encode(message: EventInterestClaim, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.claimedAsset) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventInterestClaim { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventInterestClaim(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.claimedAsset.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventInterestClaim { + const message = createBaseEventInterestClaim(); + message.claimedAsset = object.claimedAsset?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EventInterestClaimAmino): EventInterestClaim { + const message = createBaseEventInterestClaim(); + message.claimedAsset = object.claimed_asset?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: EventInterestClaim): EventInterestClaimAmino { + const obj: any = {}; + if (message.claimedAsset) { + obj.claimed_asset = message.claimedAsset.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.claimed_asset = []; + } + return obj; + }, + fromAminoMsg(object: EventInterestClaimAminoMsg): EventInterestClaim { + return EventInterestClaim.fromAmino(object.value); + }, + fromProtoMsg(message: EventInterestClaimProtoMsg): EventInterestClaim { + return EventInterestClaim.decode(message.value); + }, + toProto(message: EventInterestClaim): Uint8Array { + return EventInterestClaim.encode(message).finish(); + }, + toProtoMsg(message: EventInterestClaim): EventInterestClaimProtoMsg { + return { + typeUrl: "/umee.metoken.v1.EventInterestClaim", + value: EventInterestClaim.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/genesis.ts b/src/codegen/umee/metoken/v1/genesis.ts new file mode 100644 index 0000000..db3c55f --- /dev/null +++ b/src/codegen/umee/metoken/v1/genesis.ts @@ -0,0 +1,395 @@ +import { Params, ParamsAmino, ParamsSDKType, Index, IndexAmino, IndexSDKType } from "./metoken"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +/** GenesisState defines the x/metoken module's genesis state. */ +export interface GenesisState { + params: Params; + registry: Index[]; + balances: IndexBalances[]; + nextRebalancingTime: Date; + nextInterestClaimTime: Date; +} +export interface GenesisStateProtoMsg { + typeUrl: "/umee.metoken.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the x/metoken module's genesis state. */ +export interface GenesisStateAmino { + params?: ParamsAmino; + registry?: IndexAmino[]; + balances?: IndexBalancesAmino[]; + next_rebalancing_time?: string; + next_interest_claim_time?: string; +} +export interface GenesisStateAminoMsg { + type: "/umee.metoken.v1.GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the x/metoken module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + registry: IndexSDKType[]; + balances: IndexBalancesSDKType[]; + next_rebalancing_time: Date; + next_interest_claim_time: Date; +} +/** IndexBalances is the state of an Index, containing its meToken supply and all underlying asset balances. */ +export interface IndexBalances { + metokenSupply: Coin; + assetBalances: AssetBalance[]; +} +export interface IndexBalancesProtoMsg { + typeUrl: "/umee.metoken.v1.IndexBalances"; + value: Uint8Array; +} +/** IndexBalances is the state of an Index, containing its meToken supply and all underlying asset balances. */ +export interface IndexBalancesAmino { + metoken_supply?: CoinAmino; + asset_balances?: AssetBalanceAmino[]; +} +export interface IndexBalancesAminoMsg { + type: "/umee.metoken.v1.IndexBalances"; + value: IndexBalancesAmino; +} +/** IndexBalances is the state of an Index, containing its meToken supply and all underlying asset balances. */ +export interface IndexBalancesSDKType { + metoken_supply: CoinSDKType; + asset_balances: AssetBalanceSDKType[]; +} +/** AssetBalance tracks how much of a single asset is held in leverage, reserves, fees and interest account. */ +export interface AssetBalance { + denom: string; + leveraged: string; + reserved: string; + fees: string; + interest: string; +} +export interface AssetBalanceProtoMsg { + typeUrl: "/umee.metoken.v1.AssetBalance"; + value: Uint8Array; +} +/** AssetBalance tracks how much of a single asset is held in leverage, reserves, fees and interest account. */ +export interface AssetBalanceAmino { + denom?: string; + leveraged?: string; + reserved?: string; + fees?: string; + interest?: string; +} +export interface AssetBalanceAminoMsg { + type: "/umee.metoken.v1.AssetBalance"; + value: AssetBalanceAmino; +} +/** AssetBalance tracks how much of a single asset is held in leverage, reserves, fees and interest account. */ +export interface AssetBalanceSDKType { + denom: string; + leveraged: string; + reserved: string; + fees: string; + interest: string; +} +function createBaseGenesisState(): GenesisState { + return { + params: Params.fromPartial({}), + registry: [], + balances: [], + nextRebalancingTime: new Date(), + nextInterestClaimTime: new Date() + }; +} +export const GenesisState = { + typeUrl: "/umee.metoken.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.registry) { + Index.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.balances) { + IndexBalances.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.nextRebalancingTime !== undefined) { + Timestamp.encode(toTimestamp(message.nextRebalancingTime), writer.uint32(34).fork()).ldelim(); + } + if (message.nextInterestClaimTime !== undefined) { + Timestamp.encode(toTimestamp(message.nextInterestClaimTime), writer.uint32(42).fork()).ldelim(); + } + 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: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.registry.push(Index.decode(reader, reader.uint32())); + break; + case 3: + message.balances.push(IndexBalances.decode(reader, reader.uint32())); + break; + case 4: + message.nextRebalancingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.nextInterestClaimTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.registry = object.registry?.map(e => Index.fromPartial(e)) || []; + message.balances = object.balances?.map(e => IndexBalances.fromPartial(e)) || []; + message.nextRebalancingTime = object.nextRebalancingTime ?? undefined; + message.nextInterestClaimTime = object.nextInterestClaimTime ?? undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.registry = object.registry?.map(e => Index.fromAmino(e)) || []; + message.balances = object.balances?.map(e => IndexBalances.fromAmino(e)) || []; + if (object.next_rebalancing_time !== undefined && object.next_rebalancing_time !== null) { + message.nextRebalancingTime = fromTimestamp(Timestamp.fromAmino(object.next_rebalancing_time)); + } + if (object.next_interest_claim_time !== undefined && object.next_interest_claim_time !== null) { + message.nextInterestClaimTime = fromTimestamp(Timestamp.fromAmino(object.next_interest_claim_time)); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.registry) { + obj.registry = message.registry.map(e => e ? Index.toAmino(e) : undefined); + } else { + obj.registry = []; + } + if (message.balances) { + obj.balances = message.balances.map(e => e ? IndexBalances.toAmino(e) : undefined); + } else { + obj.balances = []; + } + obj.next_rebalancing_time = message.nextRebalancingTime ? Timestamp.toAmino(toTimestamp(message.nextRebalancingTime)) : undefined; + obj.next_interest_claim_time = message.nextInterestClaimTime ? Timestamp.toAmino(toTimestamp(message.nextInterestClaimTime)) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/umee.metoken.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; +function createBaseIndexBalances(): IndexBalances { + return { + metokenSupply: Coin.fromPartial({}), + assetBalances: [] + }; +} +export const IndexBalances = { + typeUrl: "/umee.metoken.v1.IndexBalances", + encode(message: IndexBalances, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metokenSupply !== undefined) { + Coin.encode(message.metokenSupply, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.assetBalances) { + AssetBalance.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IndexBalances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexBalances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metokenSupply = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.assetBalances.push(AssetBalance.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): IndexBalances { + const message = createBaseIndexBalances(); + message.metokenSupply = object.metokenSupply !== undefined && object.metokenSupply !== null ? Coin.fromPartial(object.metokenSupply) : undefined; + message.assetBalances = object.assetBalances?.map(e => AssetBalance.fromPartial(e)) || []; + return message; + }, + fromAmino(object: IndexBalancesAmino): IndexBalances { + const message = createBaseIndexBalances(); + if (object.metoken_supply !== undefined && object.metoken_supply !== null) { + message.metokenSupply = Coin.fromAmino(object.metoken_supply); + } + message.assetBalances = object.asset_balances?.map(e => AssetBalance.fromAmino(e)) || []; + return message; + }, + toAmino(message: IndexBalances): IndexBalancesAmino { + const obj: any = {}; + obj.metoken_supply = message.metokenSupply ? Coin.toAmino(message.metokenSupply) : undefined; + if (message.assetBalances) { + obj.asset_balances = message.assetBalances.map(e => e ? AssetBalance.toAmino(e) : undefined); + } else { + obj.asset_balances = []; + } + return obj; + }, + fromAminoMsg(object: IndexBalancesAminoMsg): IndexBalances { + return IndexBalances.fromAmino(object.value); + }, + fromProtoMsg(message: IndexBalancesProtoMsg): IndexBalances { + return IndexBalances.decode(message.value); + }, + toProto(message: IndexBalances): Uint8Array { + return IndexBalances.encode(message).finish(); + }, + toProtoMsg(message: IndexBalances): IndexBalancesProtoMsg { + return { + typeUrl: "/umee.metoken.v1.IndexBalances", + value: IndexBalances.encode(message).finish() + }; + } +}; +function createBaseAssetBalance(): AssetBalance { + return { + denom: "", + leveraged: "", + reserved: "", + fees: "", + interest: "" + }; +} +export const AssetBalance = { + typeUrl: "/umee.metoken.v1.AssetBalance", + encode(message: AssetBalance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.leveraged !== "") { + writer.uint32(18).string(message.leveraged); + } + if (message.reserved !== "") { + writer.uint32(26).string(message.reserved); + } + if (message.fees !== "") { + writer.uint32(34).string(message.fees); + } + if (message.interest !== "") { + writer.uint32(42).string(message.interest); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AssetBalance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAssetBalance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.leveraged = reader.string(); + break; + case 3: + message.reserved = reader.string(); + break; + case 4: + message.fees = reader.string(); + break; + case 5: + message.interest = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): AssetBalance { + const message = createBaseAssetBalance(); + message.denom = object.denom ?? ""; + message.leveraged = object.leveraged ?? ""; + message.reserved = object.reserved ?? ""; + message.fees = object.fees ?? ""; + message.interest = object.interest ?? ""; + return message; + }, + fromAmino(object: AssetBalanceAmino): AssetBalance { + const message = createBaseAssetBalance(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.leveraged !== undefined && object.leveraged !== null) { + message.leveraged = object.leveraged; + } + if (object.reserved !== undefined && object.reserved !== null) { + message.reserved = object.reserved; + } + if (object.fees !== undefined && object.fees !== null) { + message.fees = object.fees; + } + if (object.interest !== undefined && object.interest !== null) { + message.interest = object.interest; + } + return message; + }, + toAmino(message: AssetBalance): AssetBalanceAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.leveraged = message.leveraged; + obj.reserved = message.reserved; + obj.fees = message.fees; + obj.interest = message.interest; + return obj; + }, + fromAminoMsg(object: AssetBalanceAminoMsg): AssetBalance { + return AssetBalance.fromAmino(object.value); + }, + fromProtoMsg(message: AssetBalanceProtoMsg): AssetBalance { + return AssetBalance.decode(message.value); + }, + toProto(message: AssetBalance): Uint8Array { + return AssetBalance.encode(message).finish(); + }, + toProtoMsg(message: AssetBalance): AssetBalanceProtoMsg { + return { + typeUrl: "/umee.metoken.v1.AssetBalance", + value: AssetBalance.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/metoken.ts b/src/codegen/umee/metoken/v1/metoken.ts new file mode 100644 index 0000000..66f8510 --- /dev/null +++ b/src/codegen/umee/metoken/v1/metoken.ts @@ -0,0 +1,935 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +/** Params defines the parameters for the metoken module. */ +export interface Params { + /** + * Reserves Re-balancing Frequency in seconds, determines how often the re-balancing of the module reserves will be + * triggered + */ + rebalancingFrequency: bigint; + /** + * Interest claiming frequency in seconds, determines how often metoken module will claim accrued interest from + * leverage module + */ + claimingFrequency: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/umee.metoken.v1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the metoken module. */ +export interface ParamsAmino { + /** + * Reserves Re-balancing Frequency in seconds, determines how often the re-balancing of the module reserves will be + * triggered + */ + rebalancing_frequency?: string; + /** + * Interest claiming frequency in seconds, determines how often metoken module will claim accrued interest from + * leverage module + */ + claiming_frequency?: string; +} +export interface ParamsAminoMsg { + type: "/umee.metoken.v1.Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the metoken module. */ +export interface ParamsSDKType { + rebalancing_frequency: bigint; + claiming_frequency: bigint; +} +/** + * Index defines an index of assets that are allowed to swap and redeem for the Index's meToken, + * along with its metadata and parameters. + */ +export interface Index { + /** + * Denom is the denomination of the Index's meToken denom that will be given to user in exchange of accepted + * assets. + */ + denom: string; + /** + * MaxSupply is the maximum amount of Index's meTokens can be minted. + * A swap that requires to mint more Index's meToken than this value will result in an error. + * Must be a non negative value. 0 means that there is no limit. + */ + maxSupply: string; + /** + * Exponent is the power of ten by which to multiply, in order to convert + * an amount of the meToken for the exchange operations. + * Valid value: must be the same as the oracle.Denom.exponent. + */ + exponent: number; + /** + * Fee contains fee parameters used for swap and redemption fee calculations for all underlying + * assets in this index. + */ + fee: Fee; + /** + * Accepted Assets is the list of underlying Tokens that can be swapped and redeemed for the Index's meToken, + * along with their token-specific parameters. + */ + acceptedAssets: AcceptedAsset[]; +} +export interface IndexProtoMsg { + typeUrl: "/umee.metoken.v1.Index"; + value: Uint8Array; +} +/** + * Index defines an index of assets that are allowed to swap and redeem for the Index's meToken, + * along with its metadata and parameters. + */ +export interface IndexAmino { + /** + * Denom is the denomination of the Index's meToken denom that will be given to user in exchange of accepted + * assets. + */ + denom?: string; + /** + * MaxSupply is the maximum amount of Index's meTokens can be minted. + * A swap that requires to mint more Index's meToken than this value will result in an error. + * Must be a non negative value. 0 means that there is no limit. + */ + max_supply?: string; + /** + * Exponent is the power of ten by which to multiply, in order to convert + * an amount of the meToken for the exchange operations. + * Valid value: must be the same as the oracle.Denom.exponent. + */ + exponent?: number; + /** + * Fee contains fee parameters used for swap and redemption fee calculations for all underlying + * assets in this index. + */ + fee?: FeeAmino; + /** + * Accepted Assets is the list of underlying Tokens that can be swapped and redeemed for the Index's meToken, + * along with their token-specific parameters. + */ + accepted_assets?: AcceptedAssetAmino[]; +} +export interface IndexAminoMsg { + type: "/umee.metoken.v1.Index"; + value: IndexAmino; +} +/** + * Index defines an index of assets that are allowed to swap and redeem for the Index's meToken, + * along with its metadata and parameters. + */ +export interface IndexSDKType { + denom: string; + max_supply: string; + exponent: number; + fee: FeeSDKType; + accepted_assets: AcceptedAssetSDKType[]; +} +/** + * Fee are the parameters used for the calculation of the fee to be applied for swaps and redemptions and charged to + * the user. The usage of these parameters is explained here: + * https://github.com/umee-network/umee/tree/main/x/metoken#dynamic-fee + */ +export interface Fee { + /** + * Min fee is the minimum fee to be charged to the user. The applied fee will tend to decrease down to this value, + * when the accepted asset is undersupplied in the index. It must be less than Balanced and Max fees. + * Valid values: 0-1. + */ + minFee: string; + /** + * Balanced fee is the fee to be charged to the user when the index is balanced. It must be greater than min_fee and + * lower than max_fee + * Valid values: 0-1. + */ + balancedFee: string; + /** + * Max fee is the maximum fee to be charged to the user. The applied fee will tend to increase up to this value, + * when the accepted asset is oversupplied in the index. It must be greater than Min and Balanced fee. + * Valid values: 0-1. + */ + maxFee: string; +} +export interface FeeProtoMsg { + typeUrl: "/umee.metoken.v1.Fee"; + value: Uint8Array; +} +/** + * Fee are the parameters used for the calculation of the fee to be applied for swaps and redemptions and charged to + * the user. The usage of these parameters is explained here: + * https://github.com/umee-network/umee/tree/main/x/metoken#dynamic-fee + */ +export interface FeeAmino { + /** + * Min fee is the minimum fee to be charged to the user. The applied fee will tend to decrease down to this value, + * when the accepted asset is undersupplied in the index. It must be less than Balanced and Max fees. + * Valid values: 0-1. + */ + min_fee?: string; + /** + * Balanced fee is the fee to be charged to the user when the index is balanced. It must be greater than min_fee and + * lower than max_fee + * Valid values: 0-1. + */ + balanced_fee?: string; + /** + * Max fee is the maximum fee to be charged to the user. The applied fee will tend to increase up to this value, + * when the accepted asset is oversupplied in the index. It must be greater than Min and Balanced fee. + * Valid values: 0-1. + */ + max_fee?: string; +} +export interface FeeAminoMsg { + type: "/umee.metoken.v1.Fee"; + value: FeeAmino; +} +/** + * Fee are the parameters used for the calculation of the fee to be applied for swaps and redemptions and charged to + * the user. The usage of these parameters is explained here: + * https://github.com/umee-network/umee/tree/main/x/metoken#dynamic-fee + */ +export interface FeeSDKType { + min_fee: string; + balanced_fee: string; + max_fee: string; +} +/** + * AcceptedAsset is an asset that is accepted to participate in the Index's swaps and redemptions, along with its + * metadata and parameters + */ +export interface AcceptedAsset { + /** + * Denom is the denomination of the underlying asset. Must be the base + * denom as registered in the Bank module (so IBC denom for IBC tokens). + */ + denom: string; + /** + * Reserve portion is the portion of swapped assets that will be kept in the metoken module as reserves, + * instead of supplied to the leverage module. It is also the + * portion that will be taken from metoken module reserves when a redemption occurs. + * Valid values: 0-1. + */ + reservePortion: string; + /** + * Target allocation is the portion of an accepted asset the Index is targeting to have. The sum of + * target allocations of every accepted asset in the Index should be equal to 1. + * Valid values: 0-1. + */ + targetAllocation: string; +} +export interface AcceptedAssetProtoMsg { + typeUrl: "/umee.metoken.v1.AcceptedAsset"; + value: Uint8Array; +} +/** + * AcceptedAsset is an asset that is accepted to participate in the Index's swaps and redemptions, along with its + * metadata and parameters + */ +export interface AcceptedAssetAmino { + /** + * Denom is the denomination of the underlying asset. Must be the base + * denom as registered in the Bank module (so IBC denom for IBC tokens). + */ + denom?: string; + /** + * Reserve portion is the portion of swapped assets that will be kept in the metoken module as reserves, + * instead of supplied to the leverage module. It is also the + * portion that will be taken from metoken module reserves when a redemption occurs. + * Valid values: 0-1. + */ + reserve_portion?: string; + /** + * Target allocation is the portion of an accepted asset the Index is targeting to have. The sum of + * target allocations of every accepted asset in the Index should be equal to 1. + * Valid values: 0-1. + */ + target_allocation?: string; +} +export interface AcceptedAssetAminoMsg { + type: "/umee.metoken.v1.AcceptedAsset"; + value: AcceptedAssetAmino; +} +/** + * AcceptedAsset is an asset that is accepted to participate in the Index's swaps and redemptions, along with its + * metadata and parameters + */ +export interface AcceptedAssetSDKType { + denom: string; + reserve_portion: string; + target_allocation: string; +} +/** IndexPrices provides meToken price related index information. */ +export interface IndexPrices { + /** meToken denom. */ + denom: string; + /** Price in USD of one unit of meToken, expressed in decimals. */ + price: string; + /** + * Exponent is the power of ten by which to multiply, in order to convert + * an amount of the meToken for the exchange operations. + */ + exponent: number; + assets: AssetPrice[]; +} +export interface IndexPricesProtoMsg { + typeUrl: "/umee.metoken.v1.IndexPrices"; + value: Uint8Array; +} +/** IndexPrices provides meToken price related index information. */ +export interface IndexPricesAmino { + /** meToken denom. */ + denom?: string; + /** Price in USD of one unit of meToken, expressed in decimals. */ + price?: string; + /** + * Exponent is the power of ten by which to multiply, in order to convert + * an amount of the meToken for the exchange operations. + */ + exponent?: number; + assets?: AssetPriceAmino[]; +} +export interface IndexPricesAminoMsg { + type: "/umee.metoken.v1.IndexPrices"; + value: IndexPricesAmino; +} +/** IndexPrices provides meToken price related index information. */ +export interface IndexPricesSDKType { + denom: string; + price: string; + exponent: number; + assets: AssetPriceSDKType[]; +} +/** AssetPrice information related to the index operations. */ +export interface AssetPrice { + baseDenom: string; + symbolDenom: string; + /** Price in USD of one unit of asset, expressed in decimals. */ + price: string; + /** + * Exponent is the power of ten by which to multiply, in order to convert + * an amount of the asset for the exchange operations. + */ + exponent: number; + /** SwapRate used for exchange calculations asset -> meToken. */ + swapRate: string; + /** RedeemRate used for exchange calculations meToken -> asset. */ + redeemRate: string; +} +export interface AssetPriceProtoMsg { + typeUrl: "/umee.metoken.v1.AssetPrice"; + value: Uint8Array; +} +/** AssetPrice information related to the index operations. */ +export interface AssetPriceAmino { + base_denom?: string; + symbol_denom?: string; + /** Price in USD of one unit of asset, expressed in decimals. */ + price?: string; + /** + * Exponent is the power of ten by which to multiply, in order to convert + * an amount of the asset for the exchange operations. + */ + exponent?: number; + /** SwapRate used for exchange calculations asset -> meToken. */ + swap_rate?: string; + /** RedeemRate used for exchange calculations meToken -> asset. */ + redeem_rate?: string; +} +export interface AssetPriceAminoMsg { + type: "/umee.metoken.v1.AssetPrice"; + value: AssetPriceAmino; +} +/** AssetPrice information related to the index operations. */ +export interface AssetPriceSDKType { + base_denom: string; + symbol_denom: string; + price: string; + exponent: number; + swap_rate: string; + redeem_rate: string; +} +function createBaseParams(): Params { + return { + rebalancingFrequency: BigInt(0), + claimingFrequency: BigInt(0) + }; +} +export const Params = { + typeUrl: "/umee.metoken.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.rebalancingFrequency !== BigInt(0)) { + writer.uint32(8).int64(message.rebalancingFrequency); + } + if (message.claimingFrequency !== BigInt(0)) { + writer.uint32(16).int64(message.claimingFrequency); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rebalancingFrequency = reader.int64(); + break; + case 2: + message.claimingFrequency = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.rebalancingFrequency = object.rebalancingFrequency !== undefined && object.rebalancingFrequency !== null ? BigInt(object.rebalancingFrequency.toString()) : BigInt(0); + message.claimingFrequency = object.claimingFrequency !== undefined && object.claimingFrequency !== null ? BigInt(object.claimingFrequency.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.rebalancing_frequency !== undefined && object.rebalancing_frequency !== null) { + message.rebalancingFrequency = BigInt(object.rebalancing_frequency); + } + if (object.claiming_frequency !== undefined && object.claiming_frequency !== null) { + message.claimingFrequency = BigInt(object.claiming_frequency); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.rebalancing_frequency = message.rebalancingFrequency ? message.rebalancingFrequency.toString() : undefined; + obj.claiming_frequency = message.claimingFrequency ? message.claimingFrequency.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/umee.metoken.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +function createBaseIndex(): Index { + return { + denom: "", + maxSupply: "", + exponent: 0, + fee: Fee.fromPartial({}), + acceptedAssets: [] + }; +} +export const Index = { + typeUrl: "/umee.metoken.v1.Index", + encode(message: Index, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.maxSupply !== "") { + writer.uint32(18).string(message.maxSupply); + } + if (message.exponent !== 0) { + writer.uint32(24).uint32(message.exponent); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.acceptedAssets) { + AcceptedAsset.encode(v!, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Index { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndex(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.maxSupply = reader.string(); + break; + case 3: + message.exponent = reader.uint32(); + break; + case 4: + message.fee = Fee.decode(reader, reader.uint32()); + break; + case 5: + message.acceptedAssets.push(AcceptedAsset.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Index { + const message = createBaseIndex(); + message.denom = object.denom ?? ""; + message.maxSupply = object.maxSupply ?? ""; + message.exponent = object.exponent ?? 0; + message.fee = object.fee !== undefined && object.fee !== null ? Fee.fromPartial(object.fee) : undefined; + message.acceptedAssets = object.acceptedAssets?.map(e => AcceptedAsset.fromPartial(e)) || []; + return message; + }, + fromAmino(object: IndexAmino): Index { + const message = createBaseIndex(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.max_supply !== undefined && object.max_supply !== null) { + message.maxSupply = object.max_supply; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + if (object.fee !== undefined && object.fee !== null) { + message.fee = Fee.fromAmino(object.fee); + } + message.acceptedAssets = object.accepted_assets?.map(e => AcceptedAsset.fromAmino(e)) || []; + return message; + }, + toAmino(message: Index): IndexAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.max_supply = message.maxSupply; + obj.exponent = message.exponent; + obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; + if (message.acceptedAssets) { + obj.accepted_assets = message.acceptedAssets.map(e => e ? AcceptedAsset.toAmino(e) : undefined); + } else { + obj.accepted_assets = []; + } + return obj; + }, + fromAminoMsg(object: IndexAminoMsg): Index { + return Index.fromAmino(object.value); + }, + fromProtoMsg(message: IndexProtoMsg): Index { + return Index.decode(message.value); + }, + toProto(message: Index): Uint8Array { + return Index.encode(message).finish(); + }, + toProtoMsg(message: Index): IndexProtoMsg { + return { + typeUrl: "/umee.metoken.v1.Index", + value: Index.encode(message).finish() + }; + } +}; +function createBaseFee(): Fee { + return { + minFee: "", + balancedFee: "", + maxFee: "" + }; +} +export const Fee = { + typeUrl: "/umee.metoken.v1.Fee", + encode(message: Fee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.minFee !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.minFee, 18).atomics); + } + if (message.balancedFee !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.balancedFee, 18).atomics); + } + if (message.maxFee !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.maxFee, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minFee = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 2: + message.balancedFee = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.maxFee = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Fee { + const message = createBaseFee(); + message.minFee = object.minFee ?? ""; + message.balancedFee = object.balancedFee ?? ""; + message.maxFee = object.maxFee ?? ""; + return message; + }, + fromAmino(object: FeeAmino): Fee { + const message = createBaseFee(); + if (object.min_fee !== undefined && object.min_fee !== null) { + message.minFee = object.min_fee; + } + if (object.balanced_fee !== undefined && object.balanced_fee !== null) { + message.balancedFee = object.balanced_fee; + } + if (object.max_fee !== undefined && object.max_fee !== null) { + message.maxFee = object.max_fee; + } + return message; + }, + toAmino(message: Fee): FeeAmino { + const obj: any = {}; + obj.min_fee = message.minFee; + obj.balanced_fee = message.balancedFee; + obj.max_fee = message.maxFee; + return obj; + }, + fromAminoMsg(object: FeeAminoMsg): Fee { + return Fee.fromAmino(object.value); + }, + fromProtoMsg(message: FeeProtoMsg): Fee { + return Fee.decode(message.value); + }, + toProto(message: Fee): Uint8Array { + return Fee.encode(message).finish(); + }, + toProtoMsg(message: Fee): FeeProtoMsg { + return { + typeUrl: "/umee.metoken.v1.Fee", + value: Fee.encode(message).finish() + }; + } +}; +function createBaseAcceptedAsset(): AcceptedAsset { + return { + denom: "", + reservePortion: "", + targetAllocation: "" + }; +} +export const AcceptedAsset = { + typeUrl: "/umee.metoken.v1.AcceptedAsset", + encode(message: AcceptedAsset, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.reservePortion !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.reservePortion, 18).atomics); + } + if (message.targetAllocation !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.targetAllocation, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AcceptedAsset { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcceptedAsset(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.reservePortion = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.targetAllocation = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): AcceptedAsset { + const message = createBaseAcceptedAsset(); + message.denom = object.denom ?? ""; + message.reservePortion = object.reservePortion ?? ""; + message.targetAllocation = object.targetAllocation ?? ""; + return message; + }, + fromAmino(object: AcceptedAssetAmino): AcceptedAsset { + const message = createBaseAcceptedAsset(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.reserve_portion !== undefined && object.reserve_portion !== null) { + message.reservePortion = object.reserve_portion; + } + if (object.target_allocation !== undefined && object.target_allocation !== null) { + message.targetAllocation = object.target_allocation; + } + return message; + }, + toAmino(message: AcceptedAsset): AcceptedAssetAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.reserve_portion = message.reservePortion; + obj.target_allocation = message.targetAllocation; + return obj; + }, + fromAminoMsg(object: AcceptedAssetAminoMsg): AcceptedAsset { + return AcceptedAsset.fromAmino(object.value); + }, + fromProtoMsg(message: AcceptedAssetProtoMsg): AcceptedAsset { + return AcceptedAsset.decode(message.value); + }, + toProto(message: AcceptedAsset): Uint8Array { + return AcceptedAsset.encode(message).finish(); + }, + toProtoMsg(message: AcceptedAsset): AcceptedAssetProtoMsg { + return { + typeUrl: "/umee.metoken.v1.AcceptedAsset", + value: AcceptedAsset.encode(message).finish() + }; + } +}; +function createBaseIndexPrices(): IndexPrices { + return { + denom: "", + price: "", + exponent: 0, + assets: [] + }; +} +export const IndexPrices = { + typeUrl: "/umee.metoken.v1.IndexPrices", + encode(message: IndexPrices, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.price !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.price, 18).atomics); + } + if (message.exponent !== 0) { + writer.uint32(24).uint32(message.exponent); + } + for (const v of message.assets) { + AssetPrice.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IndexPrices { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexPrices(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.price = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.exponent = reader.uint32(); + break; + case 4: + message.assets.push(AssetPrice.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): IndexPrices { + const message = createBaseIndexPrices(); + message.denom = object.denom ?? ""; + message.price = object.price ?? ""; + message.exponent = object.exponent ?? 0; + message.assets = object.assets?.map(e => AssetPrice.fromPartial(e)) || []; + return message; + }, + fromAmino(object: IndexPricesAmino): IndexPrices { + const message = createBaseIndexPrices(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.price !== undefined && object.price !== null) { + message.price = object.price; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + message.assets = object.assets?.map(e => AssetPrice.fromAmino(e)) || []; + return message; + }, + toAmino(message: IndexPrices): IndexPricesAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.price = message.price; + obj.exponent = message.exponent; + if (message.assets) { + obj.assets = message.assets.map(e => e ? AssetPrice.toAmino(e) : undefined); + } else { + obj.assets = []; + } + return obj; + }, + fromAminoMsg(object: IndexPricesAminoMsg): IndexPrices { + return IndexPrices.fromAmino(object.value); + }, + fromProtoMsg(message: IndexPricesProtoMsg): IndexPrices { + return IndexPrices.decode(message.value); + }, + toProto(message: IndexPrices): Uint8Array { + return IndexPrices.encode(message).finish(); + }, + toProtoMsg(message: IndexPrices): IndexPricesProtoMsg { + return { + typeUrl: "/umee.metoken.v1.IndexPrices", + value: IndexPrices.encode(message).finish() + }; + } +}; +function createBaseAssetPrice(): AssetPrice { + return { + baseDenom: "", + symbolDenom: "", + price: "", + exponent: 0, + swapRate: "", + redeemRate: "" + }; +} +export const AssetPrice = { + typeUrl: "/umee.metoken.v1.AssetPrice", + encode(message: AssetPrice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseDenom !== "") { + writer.uint32(10).string(message.baseDenom); + } + if (message.symbolDenom !== "") { + writer.uint32(18).string(message.symbolDenom); + } + if (message.price !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.price, 18).atomics); + } + if (message.exponent !== 0) { + writer.uint32(32).uint32(message.exponent); + } + if (message.swapRate !== "") { + writer.uint32(42).string(Decimal.fromUserInput(message.swapRate, 18).atomics); + } + if (message.redeemRate !== "") { + writer.uint32(50).string(Decimal.fromUserInput(message.redeemRate, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AssetPrice { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAssetPrice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseDenom = reader.string(); + break; + case 2: + message.symbolDenom = reader.string(); + break; + case 3: + message.price = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 4: + message.exponent = reader.uint32(); + break; + case 5: + message.swapRate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 6: + message.redeemRate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): AssetPrice { + const message = createBaseAssetPrice(); + message.baseDenom = object.baseDenom ?? ""; + message.symbolDenom = object.symbolDenom ?? ""; + message.price = object.price ?? ""; + message.exponent = object.exponent ?? 0; + message.swapRate = object.swapRate ?? ""; + message.redeemRate = object.redeemRate ?? ""; + return message; + }, + fromAmino(object: AssetPriceAmino): AssetPrice { + const message = createBaseAssetPrice(); + if (object.base_denom !== undefined && object.base_denom !== null) { + message.baseDenom = object.base_denom; + } + if (object.symbol_denom !== undefined && object.symbol_denom !== null) { + message.symbolDenom = object.symbol_denom; + } + if (object.price !== undefined && object.price !== null) { + message.price = object.price; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + if (object.swap_rate !== undefined && object.swap_rate !== null) { + message.swapRate = object.swap_rate; + } + if (object.redeem_rate !== undefined && object.redeem_rate !== null) { + message.redeemRate = object.redeem_rate; + } + return message; + }, + toAmino(message: AssetPrice): AssetPriceAmino { + const obj: any = {}; + obj.base_denom = message.baseDenom; + obj.symbol_denom = message.symbolDenom; + obj.price = message.price; + obj.exponent = message.exponent; + obj.swap_rate = message.swapRate; + obj.redeem_rate = message.redeemRate; + return obj; + }, + fromAminoMsg(object: AssetPriceAminoMsg): AssetPrice { + return AssetPrice.fromAmino(object.value); + }, + fromProtoMsg(message: AssetPriceProtoMsg): AssetPrice { + return AssetPrice.decode(message.value); + }, + toProto(message: AssetPrice): Uint8Array { + return AssetPrice.encode(message).finish(); + }, + toProtoMsg(message: AssetPrice): AssetPriceProtoMsg { + return { + typeUrl: "/umee.metoken.v1.AssetPrice", + value: AssetPrice.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/query.lcd.ts b/src/codegen/umee/metoken/v1/query.lcd.ts new file mode 100644 index 0000000..0e4dc78 --- /dev/null +++ b/src/codegen/umee/metoken/v1/query.lcd.ts @@ -0,0 +1,85 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryParams, QueryParamsResponseSDKType, QueryIndexes, QueryIndexesResponseSDKType, QuerySwapFee, QuerySwapFeeResponseSDKType, QueryRedeemFee, QueryRedeemFeeResponseSDKType, QueryIndexBalances, QueryIndexBalancesResponseSDKType, QueryIndexPrices, QueryIndexPricesResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.params = this.params.bind(this); + this.indexes = this.indexes.bind(this); + this.swapFee = this.swapFee.bind(this); + this.redeemFee = this.redeemFee.bind(this); + this.indexBalances = this.indexBalances.bind(this); + this.indexPrices = this.indexPrices.bind(this); + } + /* Params queries the parameters of the x/metoken module. */ + async params(_params: QueryParams = {}): Promise { + const endpoint = `umee/metoken/v1/params`; + return await this.req.get(endpoint); + } + /* Indexes queries for a specific or all the registered indexes. */ + async indexes(params: QueryIndexes): Promise { + const options: any = { + params: {} + }; + if (typeof params?.metokenDenom !== "undefined") { + options.params.metoken_denom = params.metokenDenom; + } + const endpoint = `umee/metoken/v1/indexes`; + return await this.req.get(endpoint, options); + } + /* SwapFee computes fee that would be applied when executing MsgSwap. */ + async swapFee(params: QuerySwapFee): Promise { + const options: any = { + params: {} + }; + if (typeof params?.asset !== "undefined") { + options.params.asset = params.asset; + } + if (typeof params?.metokenDenom !== "undefined") { + options.params.metoken_denom = params.metokenDenom; + } + const endpoint = `umee/metoken/v1/swap_fee`; + return await this.req.get(endpoint, options); + } + /* RedeemFee computes a fee that would be applied when executing MsgRedeem. */ + async redeemFee(params: QueryRedeemFee): Promise { + const options: any = { + params: {} + }; + if (typeof params?.metoken !== "undefined") { + options.params.metoken = params.metoken; + } + if (typeof params?.assetDenom !== "undefined") { + options.params.asset_denom = params.assetDenom; + } + const endpoint = `umee/metoken/v1/redeem_fee`; + return await this.req.get(endpoint, options); + } + /* IndexBalances queries for Index's balances of a specific or all the registered indexes. */ + async indexBalances(params: QueryIndexBalances): Promise { + const options: any = { + params: {} + }; + if (typeof params?.metokenDenom !== "undefined") { + options.params.metoken_denom = params.metokenDenom; + } + const endpoint = `umee/metoken/v1/index_balances`; + return await this.req.get(endpoint, options); + } + /* IndexPrices queries for Index's price of a specific or all the registered indexes. It also includes the + underlying assets prices as well as swap and redeem rates. */ + async indexPrices(params: QueryIndexPrices): Promise { + const options: any = { + params: {} + }; + if (typeof params?.metokenDenom !== "undefined") { + options.params.metoken_denom = params.metokenDenom; + } + const endpoint = `umee/metoken/v1/index_prices`; + return await this.req.get(endpoint, options); + } +} \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/query.rpc.Query.ts b/src/codegen/umee/metoken/v1/query.rpc.Query.ts new file mode 100644 index 0000000..892822e --- /dev/null +++ b/src/codegen/umee/metoken/v1/query.rpc.Query.ts @@ -0,0 +1,88 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParams, QueryParamsResponse, QueryIndexes, QueryIndexesResponse, QuerySwapFee, QuerySwapFeeResponse, QueryRedeemFee, QueryRedeemFeeResponse, QueryIndexBalances, QueryIndexBalancesResponse, QueryIndexPrices, QueryIndexPricesResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of the x/metoken module. */ + params(request?: QueryParams): Promise; + /** Indexes queries for a specific or all the registered indexes. */ + indexes(request: QueryIndexes): Promise; + /** SwapFee computes fee that would be applied when executing MsgSwap. */ + swapFee(request: QuerySwapFee): Promise; + /** RedeemFee computes a fee that would be applied when executing MsgRedeem. */ + redeemFee(request: QueryRedeemFee): Promise; + /** IndexBalances queries for Index's balances of a specific or all the registered indexes. */ + indexBalances(request: QueryIndexBalances): Promise; + /** + * IndexPrices queries for Index's price of a specific or all the registered indexes. It also includes the + * underlying assets prices as well as swap and redeem rates. + */ + indexPrices(request: QueryIndexPrices): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.params = this.params.bind(this); + this.indexes = this.indexes.bind(this); + this.swapFee = this.swapFee.bind(this); + this.redeemFee = this.redeemFee.bind(this); + this.indexBalances = this.indexBalances.bind(this); + this.indexPrices = this.indexPrices.bind(this); + } + params(request: QueryParams = {}): Promise { + const data = QueryParams.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + } + indexes(request: QueryIndexes): Promise { + const data = QueryIndexes.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Query", "Indexes", data); + return promise.then(data => QueryIndexesResponse.decode(new BinaryReader(data))); + } + swapFee(request: QuerySwapFee): Promise { + const data = QuerySwapFee.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Query", "SwapFee", data); + return promise.then(data => QuerySwapFeeResponse.decode(new BinaryReader(data))); + } + redeemFee(request: QueryRedeemFee): Promise { + const data = QueryRedeemFee.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Query", "RedeemFee", data); + return promise.then(data => QueryRedeemFeeResponse.decode(new BinaryReader(data))); + } + indexBalances(request: QueryIndexBalances): Promise { + const data = QueryIndexBalances.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Query", "IndexBalances", data); + return promise.then(data => QueryIndexBalancesResponse.decode(new BinaryReader(data))); + } + indexPrices(request: QueryIndexPrices): Promise { + const data = QueryIndexPrices.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Query", "IndexPrices", data); + return promise.then(data => QueryIndexPricesResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParams): Promise { + return queryService.params(request); + }, + indexes(request: QueryIndexes): Promise { + return queryService.indexes(request); + }, + swapFee(request: QuerySwapFee): Promise { + return queryService.swapFee(request); + }, + redeemFee(request: QueryRedeemFee): Promise { + return queryService.redeemFee(request); + }, + indexBalances(request: QueryIndexBalances): Promise { + return queryService.indexBalances(request); + }, + indexPrices(request: QueryIndexPrices): Promise { + return queryService.indexPrices(request); + } + }; +}; \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/query.ts b/src/codegen/umee/metoken/v1/query.ts new file mode 100644 index 0000000..9aae1f3 --- /dev/null +++ b/src/codegen/umee/metoken/v1/query.ts @@ -0,0 +1,1079 @@ +import { Params, ParamsAmino, ParamsSDKType, Index, IndexAmino, IndexSDKType, IndexPrices, IndexPricesAmino, IndexPricesSDKType } from "./metoken"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { IndexBalances, IndexBalancesAmino, IndexBalancesSDKType } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParams {} +export interface QueryParamsProtoMsg { + typeUrl: "/umee.metoken.v1.QueryParams"; + value: Uint8Array; +} +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParamsAmino {} +export interface QueryParamsAminoMsg { + type: "/umee.metoken.v1.QueryParams"; + value: QueryParamsAmino; +} +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParamsSDKType {} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponse { + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/umee.metoken.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "/umee.metoken.v1.QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +/** + * QueryIndexes defines the request structure for the Indexes gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Indexes. + */ +export interface QueryIndexes { + metokenDenom: string; +} +export interface QueryIndexesProtoMsg { + typeUrl: "/umee.metoken.v1.QueryIndexes"; + value: Uint8Array; +} +/** + * QueryIndexes defines the request structure for the Indexes gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Indexes. + */ +export interface QueryIndexesAmino { + metoken_denom?: string; +} +export interface QueryIndexesAminoMsg { + type: "/umee.metoken.v1.QueryIndexes"; + value: QueryIndexesAmino; +} +/** + * QueryIndexes defines the request structure for the Indexes gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Indexes. + */ +export interface QueryIndexesSDKType { + metoken_denom: string; +} +/** QueryIndexesResponse defines the response structure for the Indexes gRPC service handler. */ +export interface QueryIndexesResponse { + registry: Index[]; +} +export interface QueryIndexesResponseProtoMsg { + typeUrl: "/umee.metoken.v1.QueryIndexesResponse"; + value: Uint8Array; +} +/** QueryIndexesResponse defines the response structure for the Indexes gRPC service handler. */ +export interface QueryIndexesResponseAmino { + registry?: IndexAmino[]; +} +export interface QueryIndexesResponseAminoMsg { + type: "/umee.metoken.v1.QueryIndexesResponse"; + value: QueryIndexesResponseAmino; +} +/** QueryIndexesResponse defines the response structure for the Indexes gRPC service handler. */ +export interface QueryIndexesResponseSDKType { + registry: IndexSDKType[]; +} +/** QuerySwapFee defines the request structure for the SwapFee gRPC service handler. */ +export interface QuerySwapFee { + asset: string; + metokenDenom: string; +} +export interface QuerySwapFeeProtoMsg { + typeUrl: "/umee.metoken.v1.QuerySwapFee"; + value: Uint8Array; +} +/** QuerySwapFee defines the request structure for the SwapFee gRPC service handler. */ +export interface QuerySwapFeeAmino { + asset?: string; + metoken_denom?: string; +} +export interface QuerySwapFeeAminoMsg { + type: "/umee.metoken.v1.QuerySwapFee"; + value: QuerySwapFeeAmino; +} +/** QuerySwapFee defines the request structure for the SwapFee gRPC service handler. */ +export interface QuerySwapFeeSDKType { + asset: string; + metoken_denom: string; +} +/** QuerySwapFeeResponse defines the response structure for the SwapFee gRPC service handler. */ +export interface QuerySwapFeeResponse { + asset: Coin; +} +export interface QuerySwapFeeResponseProtoMsg { + typeUrl: "/umee.metoken.v1.QuerySwapFeeResponse"; + value: Uint8Array; +} +/** QuerySwapFeeResponse defines the response structure for the SwapFee gRPC service handler. */ +export interface QuerySwapFeeResponseAmino { + asset?: CoinAmino; +} +export interface QuerySwapFeeResponseAminoMsg { + type: "/umee.metoken.v1.QuerySwapFeeResponse"; + value: QuerySwapFeeResponseAmino; +} +/** QuerySwapFeeResponse defines the response structure for the SwapFee gRPC service handler. */ +export interface QuerySwapFeeResponseSDKType { + asset: CoinSDKType; +} +/** QueryRedeemFee defines the request structure for the RedeemFee gRPC service handler. */ +export interface QueryRedeemFee { + metoken: string; + assetDenom: string; +} +export interface QueryRedeemFeeProtoMsg { + typeUrl: "/umee.metoken.v1.QueryRedeemFee"; + value: Uint8Array; +} +/** QueryRedeemFee defines the request structure for the RedeemFee gRPC service handler. */ +export interface QueryRedeemFeeAmino { + metoken?: string; + asset_denom?: string; +} +export interface QueryRedeemFeeAminoMsg { + type: "/umee.metoken.v1.QueryRedeemFee"; + value: QueryRedeemFeeAmino; +} +/** QueryRedeemFee defines the request structure for the RedeemFee gRPC service handler. */ +export interface QueryRedeemFeeSDKType { + metoken: string; + asset_denom: string; +} +/** QueryRedeemFeeResponse defines the response structure for the RedeemFee gRPC service handler. */ +export interface QueryRedeemFeeResponse { + asset: Coin; +} +export interface QueryRedeemFeeResponseProtoMsg { + typeUrl: "/umee.metoken.v1.QueryRedeemFeeResponse"; + value: Uint8Array; +} +/** QueryRedeemFeeResponse defines the response structure for the RedeemFee gRPC service handler. */ +export interface QueryRedeemFeeResponseAmino { + asset?: CoinAmino; +} +export interface QueryRedeemFeeResponseAminoMsg { + type: "/umee.metoken.v1.QueryRedeemFeeResponse"; + value: QueryRedeemFeeResponseAmino; +} +/** QueryRedeemFeeResponse defines the response structure for the RedeemFee gRPC service handler. */ +export interface QueryRedeemFeeResponseSDKType { + asset: CoinSDKType; +} +/** + * QueryIndexBalances defines the request structure for the IndexBalances gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Indexes. + */ +export interface QueryIndexBalances { + metokenDenom: string; +} +export interface QueryIndexBalancesProtoMsg { + typeUrl: "/umee.metoken.v1.QueryIndexBalances"; + value: Uint8Array; +} +/** + * QueryIndexBalances defines the request structure for the IndexBalances gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Indexes. + */ +export interface QueryIndexBalancesAmino { + metoken_denom?: string; +} +export interface QueryIndexBalancesAminoMsg { + type: "/umee.metoken.v1.QueryIndexBalances"; + value: QueryIndexBalancesAmino; +} +/** + * QueryIndexBalances defines the request structure for the IndexBalances gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Indexes. + */ +export interface QueryIndexBalancesSDKType { + metoken_denom: string; +} +/** QueryIndexBalanceResponse defines the response structure for the IndexBalances gRPC service handler. */ +export interface QueryIndexBalancesResponse { + indexBalances: IndexBalances[]; + prices: IndexPrices[]; +} +export interface QueryIndexBalancesResponseProtoMsg { + typeUrl: "/umee.metoken.v1.QueryIndexBalancesResponse"; + value: Uint8Array; +} +/** QueryIndexBalanceResponse defines the response structure for the IndexBalances gRPC service handler. */ +export interface QueryIndexBalancesResponseAmino { + index_balances?: IndexBalancesAmino[]; + prices?: IndexPricesAmino[]; +} +export interface QueryIndexBalancesResponseAminoMsg { + type: "/umee.metoken.v1.QueryIndexBalancesResponse"; + value: QueryIndexBalancesResponseAmino; +} +/** QueryIndexBalanceResponse defines the response structure for the IndexBalances gRPC service handler. */ +export interface QueryIndexBalancesResponseSDKType { + index_balances: IndexBalancesSDKType[]; + prices: IndexPricesSDKType[]; +} +/** + * QueryIndexPrices defines the request structure for the IndexPrice gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Index's prices. + */ +export interface QueryIndexPrices { + metokenDenom: string; +} +export interface QueryIndexPricesProtoMsg { + typeUrl: "/umee.metoken.v1.QueryIndexPrices"; + value: Uint8Array; +} +/** + * QueryIndexPrices defines the request structure for the IndexPrice gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Index's prices. + */ +export interface QueryIndexPricesAmino { + metoken_denom?: string; +} +export interface QueryIndexPricesAminoMsg { + type: "/umee.metoken.v1.QueryIndexPrices"; + value: QueryIndexPricesAmino; +} +/** + * QueryIndexPrices defines the request structure for the IndexPrice gRPC service handler. + * metoken_denom param is optional, if it is not informed the query will return all the Index's prices. + */ +export interface QueryIndexPricesSDKType { + metoken_denom: string; +} +/** QueryIndexPriceResponses defines the response structure for the IndexPrice gRPC service handler. */ +export interface QueryIndexPricesResponse { + prices: IndexPrices[]; +} +export interface QueryIndexPricesResponseProtoMsg { + typeUrl: "/umee.metoken.v1.QueryIndexPricesResponse"; + value: Uint8Array; +} +/** QueryIndexPriceResponses defines the response structure for the IndexPrice gRPC service handler. */ +export interface QueryIndexPricesResponseAmino { + prices?: IndexPricesAmino[]; +} +export interface QueryIndexPricesResponseAminoMsg { + type: "/umee.metoken.v1.QueryIndexPricesResponse"; + value: QueryIndexPricesResponseAmino; +} +/** QueryIndexPriceResponses defines the response structure for the IndexPrice gRPC service handler. */ +export interface QueryIndexPricesResponseSDKType { + prices: IndexPricesSDKType[]; +} +function createBaseQueryParams(): QueryParams { + return {}; +} +export const QueryParams = { + typeUrl: "/umee.metoken.v1.QueryParams", + encode(_: QueryParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryParams { + const message = createBaseQueryParams(); + return message; + }, + fromAmino(_: QueryParamsAmino): QueryParams { + const message = createBaseQueryParams(); + return message; + }, + toAmino(_: QueryParams): QueryParamsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsAminoMsg): QueryParams { + return QueryParams.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsProtoMsg): QueryParams { + return QueryParams.decode(message.value); + }, + toProto(message: QueryParams): Uint8Array { + return QueryParams.encode(message).finish(); + }, + toProtoMsg(message: QueryParams): QueryParamsProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryParams", + value: QueryParams.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/umee.metoken.v1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryIndexes(): QueryIndexes { + return { + metokenDenom: "" + }; +} +export const QueryIndexes = { + typeUrl: "/umee.metoken.v1.QueryIndexes", + encode(message: QueryIndexes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metokenDenom !== "") { + writer.uint32(10).string(message.metokenDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryIndexes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryIndexes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metokenDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryIndexes { + const message = createBaseQueryIndexes(); + message.metokenDenom = object.metokenDenom ?? ""; + return message; + }, + fromAmino(object: QueryIndexesAmino): QueryIndexes { + const message = createBaseQueryIndexes(); + if (object.metoken_denom !== undefined && object.metoken_denom !== null) { + message.metokenDenom = object.metoken_denom; + } + return message; + }, + toAmino(message: QueryIndexes): QueryIndexesAmino { + const obj: any = {}; + obj.metoken_denom = message.metokenDenom; + return obj; + }, + fromAminoMsg(object: QueryIndexesAminoMsg): QueryIndexes { + return QueryIndexes.fromAmino(object.value); + }, + fromProtoMsg(message: QueryIndexesProtoMsg): QueryIndexes { + return QueryIndexes.decode(message.value); + }, + toProto(message: QueryIndexes): Uint8Array { + return QueryIndexes.encode(message).finish(); + }, + toProtoMsg(message: QueryIndexes): QueryIndexesProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryIndexes", + value: QueryIndexes.encode(message).finish() + }; + } +}; +function createBaseQueryIndexesResponse(): QueryIndexesResponse { + return { + registry: [] + }; +} +export const QueryIndexesResponse = { + typeUrl: "/umee.metoken.v1.QueryIndexesResponse", + encode(message: QueryIndexesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.registry) { + Index.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryIndexesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryIndexesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.registry.push(Index.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryIndexesResponse { + const message = createBaseQueryIndexesResponse(); + message.registry = object.registry?.map(e => Index.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryIndexesResponseAmino): QueryIndexesResponse { + const message = createBaseQueryIndexesResponse(); + message.registry = object.registry?.map(e => Index.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryIndexesResponse): QueryIndexesResponseAmino { + const obj: any = {}; + if (message.registry) { + obj.registry = message.registry.map(e => e ? Index.toAmino(e) : undefined); + } else { + obj.registry = []; + } + return obj; + }, + fromAminoMsg(object: QueryIndexesResponseAminoMsg): QueryIndexesResponse { + return QueryIndexesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryIndexesResponseProtoMsg): QueryIndexesResponse { + return QueryIndexesResponse.decode(message.value); + }, + toProto(message: QueryIndexesResponse): Uint8Array { + return QueryIndexesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryIndexesResponse): QueryIndexesResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryIndexesResponse", + value: QueryIndexesResponse.encode(message).finish() + }; + } +}; +function createBaseQuerySwapFee(): QuerySwapFee { + return { + asset: "", + metokenDenom: "" + }; +} +export const QuerySwapFee = { + typeUrl: "/umee.metoken.v1.QuerySwapFee", + encode(message: QuerySwapFee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.asset !== "") { + writer.uint32(10).string(message.asset); + } + if (message.metokenDenom !== "") { + writer.uint32(18).string(message.metokenDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySwapFee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySwapFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.asset = reader.string(); + break; + case 2: + message.metokenDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QuerySwapFee { + const message = createBaseQuerySwapFee(); + message.asset = object.asset ?? ""; + message.metokenDenom = object.metokenDenom ?? ""; + return message; + }, + fromAmino(object: QuerySwapFeeAmino): QuerySwapFee { + const message = createBaseQuerySwapFee(); + if (object.asset !== undefined && object.asset !== null) { + message.asset = object.asset; + } + if (object.metoken_denom !== undefined && object.metoken_denom !== null) { + message.metokenDenom = object.metoken_denom; + } + return message; + }, + toAmino(message: QuerySwapFee): QuerySwapFeeAmino { + const obj: any = {}; + obj.asset = message.asset; + obj.metoken_denom = message.metokenDenom; + return obj; + }, + fromAminoMsg(object: QuerySwapFeeAminoMsg): QuerySwapFee { + return QuerySwapFee.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySwapFeeProtoMsg): QuerySwapFee { + return QuerySwapFee.decode(message.value); + }, + toProto(message: QuerySwapFee): Uint8Array { + return QuerySwapFee.encode(message).finish(); + }, + toProtoMsg(message: QuerySwapFee): QuerySwapFeeProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QuerySwapFee", + value: QuerySwapFee.encode(message).finish() + }; + } +}; +function createBaseQuerySwapFeeResponse(): QuerySwapFeeResponse { + return { + asset: Coin.fromPartial({}) + }; +} +export const QuerySwapFeeResponse = { + typeUrl: "/umee.metoken.v1.QuerySwapFeeResponse", + encode(message: QuerySwapFeeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.asset !== undefined) { + Coin.encode(message.asset, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySwapFeeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySwapFeeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.asset = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QuerySwapFeeResponse { + const message = createBaseQuerySwapFeeResponse(); + message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; + return message; + }, + fromAmino(object: QuerySwapFeeResponseAmino): QuerySwapFeeResponse { + const message = createBaseQuerySwapFeeResponse(); + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: QuerySwapFeeResponse): QuerySwapFeeResponseAmino { + const obj: any = {}; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySwapFeeResponseAminoMsg): QuerySwapFeeResponse { + return QuerySwapFeeResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySwapFeeResponseProtoMsg): QuerySwapFeeResponse { + return QuerySwapFeeResponse.decode(message.value); + }, + toProto(message: QuerySwapFeeResponse): Uint8Array { + return QuerySwapFeeResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySwapFeeResponse): QuerySwapFeeResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QuerySwapFeeResponse", + value: QuerySwapFeeResponse.encode(message).finish() + }; + } +}; +function createBaseQueryRedeemFee(): QueryRedeemFee { + return { + metoken: "", + assetDenom: "" + }; +} +export const QueryRedeemFee = { + typeUrl: "/umee.metoken.v1.QueryRedeemFee", + encode(message: QueryRedeemFee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metoken !== "") { + writer.uint32(10).string(message.metoken); + } + if (message.assetDenom !== "") { + writer.uint32(18).string(message.assetDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedeemFee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedeemFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metoken = reader.string(); + break; + case 2: + message.assetDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryRedeemFee { + const message = createBaseQueryRedeemFee(); + message.metoken = object.metoken ?? ""; + message.assetDenom = object.assetDenom ?? ""; + return message; + }, + fromAmino(object: QueryRedeemFeeAmino): QueryRedeemFee { + const message = createBaseQueryRedeemFee(); + if (object.metoken !== undefined && object.metoken !== null) { + message.metoken = object.metoken; + } + if (object.asset_denom !== undefined && object.asset_denom !== null) { + message.assetDenom = object.asset_denom; + } + return message; + }, + toAmino(message: QueryRedeemFee): QueryRedeemFeeAmino { + const obj: any = {}; + obj.metoken = message.metoken; + obj.asset_denom = message.assetDenom; + return obj; + }, + fromAminoMsg(object: QueryRedeemFeeAminoMsg): QueryRedeemFee { + return QueryRedeemFee.fromAmino(object.value); + }, + fromProtoMsg(message: QueryRedeemFeeProtoMsg): QueryRedeemFee { + return QueryRedeemFee.decode(message.value); + }, + toProto(message: QueryRedeemFee): Uint8Array { + return QueryRedeemFee.encode(message).finish(); + }, + toProtoMsg(message: QueryRedeemFee): QueryRedeemFeeProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryRedeemFee", + value: QueryRedeemFee.encode(message).finish() + }; + } +}; +function createBaseQueryRedeemFeeResponse(): QueryRedeemFeeResponse { + return { + asset: Coin.fromPartial({}) + }; +} +export const QueryRedeemFeeResponse = { + typeUrl: "/umee.metoken.v1.QueryRedeemFeeResponse", + encode(message: QueryRedeemFeeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.asset !== undefined) { + Coin.encode(message.asset, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedeemFeeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedeemFeeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.asset = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryRedeemFeeResponse { + const message = createBaseQueryRedeemFeeResponse(); + message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; + return message; + }, + fromAmino(object: QueryRedeemFeeResponseAmino): QueryRedeemFeeResponse { + const message = createBaseQueryRedeemFeeResponse(); + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + return message; + }, + toAmino(message: QueryRedeemFeeResponse): QueryRedeemFeeResponseAmino { + const obj: any = {}; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRedeemFeeResponseAminoMsg): QueryRedeemFeeResponse { + return QueryRedeemFeeResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryRedeemFeeResponseProtoMsg): QueryRedeemFeeResponse { + return QueryRedeemFeeResponse.decode(message.value); + }, + toProto(message: QueryRedeemFeeResponse): Uint8Array { + return QueryRedeemFeeResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryRedeemFeeResponse): QueryRedeemFeeResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryRedeemFeeResponse", + value: QueryRedeemFeeResponse.encode(message).finish() + }; + } +}; +function createBaseQueryIndexBalances(): QueryIndexBalances { + return { + metokenDenom: "" + }; +} +export const QueryIndexBalances = { + typeUrl: "/umee.metoken.v1.QueryIndexBalances", + encode(message: QueryIndexBalances, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metokenDenom !== "") { + writer.uint32(10).string(message.metokenDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryIndexBalances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryIndexBalances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metokenDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryIndexBalances { + const message = createBaseQueryIndexBalances(); + message.metokenDenom = object.metokenDenom ?? ""; + return message; + }, + fromAmino(object: QueryIndexBalancesAmino): QueryIndexBalances { + const message = createBaseQueryIndexBalances(); + if (object.metoken_denom !== undefined && object.metoken_denom !== null) { + message.metokenDenom = object.metoken_denom; + } + return message; + }, + toAmino(message: QueryIndexBalances): QueryIndexBalancesAmino { + const obj: any = {}; + obj.metoken_denom = message.metokenDenom; + return obj; + }, + fromAminoMsg(object: QueryIndexBalancesAminoMsg): QueryIndexBalances { + return QueryIndexBalances.fromAmino(object.value); + }, + fromProtoMsg(message: QueryIndexBalancesProtoMsg): QueryIndexBalances { + return QueryIndexBalances.decode(message.value); + }, + toProto(message: QueryIndexBalances): Uint8Array { + return QueryIndexBalances.encode(message).finish(); + }, + toProtoMsg(message: QueryIndexBalances): QueryIndexBalancesProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryIndexBalances", + value: QueryIndexBalances.encode(message).finish() + }; + } +}; +function createBaseQueryIndexBalancesResponse(): QueryIndexBalancesResponse { + return { + indexBalances: [], + prices: [] + }; +} +export const QueryIndexBalancesResponse = { + typeUrl: "/umee.metoken.v1.QueryIndexBalancesResponse", + encode(message: QueryIndexBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.indexBalances) { + IndexBalances.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.prices) { + IndexPrices.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryIndexBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryIndexBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.indexBalances.push(IndexBalances.decode(reader, reader.uint32())); + break; + case 2: + message.prices.push(IndexPrices.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryIndexBalancesResponse { + const message = createBaseQueryIndexBalancesResponse(); + message.indexBalances = object.indexBalances?.map(e => IndexBalances.fromPartial(e)) || []; + message.prices = object.prices?.map(e => IndexPrices.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryIndexBalancesResponseAmino): QueryIndexBalancesResponse { + const message = createBaseQueryIndexBalancesResponse(); + message.indexBalances = object.index_balances?.map(e => IndexBalances.fromAmino(e)) || []; + message.prices = object.prices?.map(e => IndexPrices.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryIndexBalancesResponse): QueryIndexBalancesResponseAmino { + const obj: any = {}; + if (message.indexBalances) { + obj.index_balances = message.indexBalances.map(e => e ? IndexBalances.toAmino(e) : undefined); + } else { + obj.index_balances = []; + } + if (message.prices) { + obj.prices = message.prices.map(e => e ? IndexPrices.toAmino(e) : undefined); + } else { + obj.prices = []; + } + return obj; + }, + fromAminoMsg(object: QueryIndexBalancesResponseAminoMsg): QueryIndexBalancesResponse { + return QueryIndexBalancesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryIndexBalancesResponseProtoMsg): QueryIndexBalancesResponse { + return QueryIndexBalancesResponse.decode(message.value); + }, + toProto(message: QueryIndexBalancesResponse): Uint8Array { + return QueryIndexBalancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryIndexBalancesResponse): QueryIndexBalancesResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryIndexBalancesResponse", + value: QueryIndexBalancesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryIndexPrices(): QueryIndexPrices { + return { + metokenDenom: "" + }; +} +export const QueryIndexPrices = { + typeUrl: "/umee.metoken.v1.QueryIndexPrices", + encode(message: QueryIndexPrices, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metokenDenom !== "") { + writer.uint32(10).string(message.metokenDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryIndexPrices { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryIndexPrices(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metokenDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryIndexPrices { + const message = createBaseQueryIndexPrices(); + message.metokenDenom = object.metokenDenom ?? ""; + return message; + }, + fromAmino(object: QueryIndexPricesAmino): QueryIndexPrices { + const message = createBaseQueryIndexPrices(); + if (object.metoken_denom !== undefined && object.metoken_denom !== null) { + message.metokenDenom = object.metoken_denom; + } + return message; + }, + toAmino(message: QueryIndexPrices): QueryIndexPricesAmino { + const obj: any = {}; + obj.metoken_denom = message.metokenDenom; + return obj; + }, + fromAminoMsg(object: QueryIndexPricesAminoMsg): QueryIndexPrices { + return QueryIndexPrices.fromAmino(object.value); + }, + fromProtoMsg(message: QueryIndexPricesProtoMsg): QueryIndexPrices { + return QueryIndexPrices.decode(message.value); + }, + toProto(message: QueryIndexPrices): Uint8Array { + return QueryIndexPrices.encode(message).finish(); + }, + toProtoMsg(message: QueryIndexPrices): QueryIndexPricesProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryIndexPrices", + value: QueryIndexPrices.encode(message).finish() + }; + } +}; +function createBaseQueryIndexPricesResponse(): QueryIndexPricesResponse { + return { + prices: [] + }; +} +export const QueryIndexPricesResponse = { + typeUrl: "/umee.metoken.v1.QueryIndexPricesResponse", + encode(message: QueryIndexPricesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.prices) { + IndexPrices.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryIndexPricesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryIndexPricesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.prices.push(IndexPrices.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryIndexPricesResponse { + const message = createBaseQueryIndexPricesResponse(); + message.prices = object.prices?.map(e => IndexPrices.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryIndexPricesResponseAmino): QueryIndexPricesResponse { + const message = createBaseQueryIndexPricesResponse(); + message.prices = object.prices?.map(e => IndexPrices.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryIndexPricesResponse): QueryIndexPricesResponseAmino { + const obj: any = {}; + if (message.prices) { + obj.prices = message.prices.map(e => e ? IndexPrices.toAmino(e) : undefined); + } else { + obj.prices = []; + } + return obj; + }, + fromAminoMsg(object: QueryIndexPricesResponseAminoMsg): QueryIndexPricesResponse { + return QueryIndexPricesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryIndexPricesResponseProtoMsg): QueryIndexPricesResponse { + return QueryIndexPricesResponse.decode(message.value); + }, + toProto(message: QueryIndexPricesResponse): Uint8Array { + return QueryIndexPricesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryIndexPricesResponse): QueryIndexPricesResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.QueryIndexPricesResponse", + value: QueryIndexPricesResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/tx.amino.ts b/src/codegen/umee/metoken/v1/tx.amino.ts new file mode 100644 index 0000000..c717beb --- /dev/null +++ b/src/codegen/umee/metoken/v1/tx.amino.ts @@ -0,0 +1,23 @@ +import { MsgSwap, MsgRedeem, MsgGovSetParams, MsgGovUpdateRegistry } from "./tx"; +export const AminoConverter = { + "/umee.metoken.v1.MsgSwap": { + aminoType: "/umee.metoken.v1.MsgSwap", + toAmino: MsgSwap.toAmino, + fromAmino: MsgSwap.fromAmino + }, + "/umee.metoken.v1.MsgRedeem": { + aminoType: "/umee.metoken.v1.MsgRedeem", + toAmino: MsgRedeem.toAmino, + fromAmino: MsgRedeem.fromAmino + }, + "/umee.metoken.v1.MsgGovSetParams": { + aminoType: "/umee.metoken.v1.MsgGovSetParams", + toAmino: MsgGovSetParams.toAmino, + fromAmino: MsgGovSetParams.fromAmino + }, + "/umee.metoken.v1.MsgGovUpdateRegistry": { + aminoType: "/umee.metoken.v1.MsgGovUpdateRegistry", + toAmino: MsgGovUpdateRegistry.toAmino, + fromAmino: MsgGovUpdateRegistry.fromAmino + } +}; \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/tx.registry.ts b/src/codegen/umee/metoken/v1/tx.registry.ts new file mode 100644 index 0000000..051076b --- /dev/null +++ b/src/codegen/umee/metoken/v1/tx.registry.ts @@ -0,0 +1,88 @@ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgSwap, MsgRedeem, MsgGovSetParams, MsgGovUpdateRegistry } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/umee.metoken.v1.MsgSwap", MsgSwap], ["/umee.metoken.v1.MsgRedeem", MsgRedeem], ["/umee.metoken.v1.MsgGovSetParams", MsgGovSetParams], ["/umee.metoken.v1.MsgGovUpdateRegistry", MsgGovUpdateRegistry]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + swap(value: MsgSwap) { + return { + typeUrl: "/umee.metoken.v1.MsgSwap", + value: MsgSwap.encode(value).finish() + }; + }, + redeem(value: MsgRedeem) { + return { + typeUrl: "/umee.metoken.v1.MsgRedeem", + value: MsgRedeem.encode(value).finish() + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.metoken.v1.MsgGovSetParams", + value: MsgGovSetParams.encode(value).finish() + }; + }, + govUpdateRegistry(value: MsgGovUpdateRegistry) { + return { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistry", + value: MsgGovUpdateRegistry.encode(value).finish() + }; + } + }, + withTypeUrl: { + swap(value: MsgSwap) { + return { + typeUrl: "/umee.metoken.v1.MsgSwap", + value + }; + }, + redeem(value: MsgRedeem) { + return { + typeUrl: "/umee.metoken.v1.MsgRedeem", + value + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.metoken.v1.MsgGovSetParams", + value + }; + }, + govUpdateRegistry(value: MsgGovUpdateRegistry) { + return { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistry", + value + }; + } + }, + fromPartial: { + swap(value: MsgSwap) { + return { + typeUrl: "/umee.metoken.v1.MsgSwap", + value: MsgSwap.fromPartial(value) + }; + }, + redeem(value: MsgRedeem) { + return { + typeUrl: "/umee.metoken.v1.MsgRedeem", + value: MsgRedeem.fromPartial(value) + }; + }, + govSetParams(value: MsgGovSetParams) { + return { + typeUrl: "/umee.metoken.v1.MsgGovSetParams", + value: MsgGovSetParams.fromPartial(value) + }; + }, + govUpdateRegistry(value: MsgGovUpdateRegistry) { + return { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistry", + value: MsgGovUpdateRegistry.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/tx.rpc.msg.ts b/src/codegen/umee/metoken/v1/tx.rpc.msg.ts new file mode 100644 index 0000000..06cdfee --- /dev/null +++ b/src/codegen/umee/metoken/v1/tx.rpc.msg.ts @@ -0,0 +1,47 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSwap, MsgSwapResponse, MsgRedeem, MsgRedeemResponse, MsgGovSetParams, MsgGovSetParamsResponse, MsgGovUpdateRegistry, MsgGovUpdateRegistryResponse } from "./tx"; +/** Msg defines the x/metoken module's Msg service. */ +export interface Msg { + /** Swap defines a method for swapping an accepted asset for Index's meToken. */ + swap(request: MsgSwap): Promise; + /** Redeem defines a method for redeeming Index's meToken for an accepted asset. */ + redeem(request: MsgRedeem): Promise; + /** GovSetParams is used by governance proposals to update parameters. */ + govSetParams(request: MsgGovSetParams): Promise; + /** + * GovUpdateRegistry adds new index to the index registry or + * updates existing index with new settings. + */ + govUpdateRegistry(request: MsgGovUpdateRegistry): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.swap = this.swap.bind(this); + this.redeem = this.redeem.bind(this); + this.govSetParams = this.govSetParams.bind(this); + this.govUpdateRegistry = this.govUpdateRegistry.bind(this); + } + swap(request: MsgSwap): Promise { + const data = MsgSwap.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Msg", "Swap", data); + return promise.then(data => MsgSwapResponse.decode(new BinaryReader(data))); + } + redeem(request: MsgRedeem): Promise { + const data = MsgRedeem.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Msg", "Redeem", data); + return promise.then(data => MsgRedeemResponse.decode(new BinaryReader(data))); + } + govSetParams(request: MsgGovSetParams): Promise { + const data = MsgGovSetParams.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Msg", "GovSetParams", data); + return promise.then(data => MsgGovSetParamsResponse.decode(new BinaryReader(data))); + } + govUpdateRegistry(request: MsgGovUpdateRegistry): Promise { + const data = MsgGovUpdateRegistry.encode(request).finish(); + const promise = this.rpc.request("umee.metoken.v1.Msg", "GovUpdateRegistry", data); + return promise.then(data => MsgGovUpdateRegistryResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/src/codegen/umee/metoken/v1/tx.ts b/src/codegen/umee/metoken/v1/tx.ts new file mode 100644 index 0000000..e35d09b --- /dev/null +++ b/src/codegen/umee/metoken/v1/tx.ts @@ -0,0 +1,788 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsAmino, ParamsSDKType, Index, IndexAmino, IndexSDKType } from "./metoken"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** MsgSwap represents a user's request to swap assets for Index's meToken. */ +export interface MsgSwap { + /** User is the account address swapping assets and the signer of the message. */ + user: string; + asset: Coin; + metokenDenom: string; +} +export interface MsgSwapProtoMsg { + typeUrl: "/umee.metoken.v1.MsgSwap"; + value: Uint8Array; +} +/** MsgSwap represents a user's request to swap assets for Index's meToken. */ +export interface MsgSwapAmino { + /** User is the account address swapping assets and the signer of the message. */ + user?: string; + asset?: CoinAmino; + metoken_denom?: string; +} +export interface MsgSwapAminoMsg { + type: "/umee.metoken.v1.MsgSwap"; + value: MsgSwapAmino; +} +/** MsgSwap represents a user's request to swap assets for Index's meToken. */ +export interface MsgSwapSDKType { + user: string; + asset: CoinSDKType; + metoken_denom: string; +} +/** MsgSwapResponse defines the Msg/Swap response type. */ +export interface MsgSwapResponse { + /** Fee is the amount of accepted asset charged to the user as the fee for the transaction. */ + fee: Coin; + /** Returned is the amount of Index's meToken minted and returned to the user. */ + returned: Coin; +} +export interface MsgSwapResponseProtoMsg { + typeUrl: "/umee.metoken.v1.MsgSwapResponse"; + value: Uint8Array; +} +/** MsgSwapResponse defines the Msg/Swap response type. */ +export interface MsgSwapResponseAmino { + /** Fee is the amount of accepted asset charged to the user as the fee for the transaction. */ + fee?: CoinAmino; + /** Returned is the amount of Index's meToken minted and returned to the user. */ + returned?: CoinAmino; +} +export interface MsgSwapResponseAminoMsg { + type: "/umee.metoken.v1.MsgSwapResponse"; + value: MsgSwapResponseAmino; +} +/** MsgSwapResponse defines the Msg/Swap response type. */ +export interface MsgSwapResponseSDKType { + fee: CoinSDKType; + returned: CoinSDKType; +} +/** MsgRedeem represents a user's request to redeem Index's meTokens for one of the accepted assets. */ +export interface MsgRedeem { + /** User is the account address redeeming assets and the signer of the message. */ + user: string; + metoken: Coin; + assetDenom: string; +} +export interface MsgRedeemProtoMsg { + typeUrl: "/umee.metoken.v1.MsgRedeem"; + value: Uint8Array; +} +/** MsgRedeem represents a user's request to redeem Index's meTokens for one of the accepted assets. */ +export interface MsgRedeemAmino { + /** User is the account address redeeming assets and the signer of the message. */ + user?: string; + metoken?: CoinAmino; + asset_denom?: string; +} +export interface MsgRedeemAminoMsg { + type: "/umee.metoken.v1.MsgRedeem"; + value: MsgRedeemAmino; +} +/** MsgRedeem represents a user's request to redeem Index's meTokens for one of the accepted assets. */ +export interface MsgRedeemSDKType { + user: string; + metoken: CoinSDKType; + asset_denom: string; +} +/** MsgRedeemResponse defines the Msg/Redeem response type. */ +export interface MsgRedeemResponse { + /** Returned is the amount of accepted asset returned to the user. */ + returned: Coin; + /** Fee is the amount of accepted asset charged to the user as the fee for the transaction. */ + fee: Coin; +} +export interface MsgRedeemResponseProtoMsg { + typeUrl: "/umee.metoken.v1.MsgRedeemResponse"; + value: Uint8Array; +} +/** MsgRedeemResponse defines the Msg/Redeem response type. */ +export interface MsgRedeemResponseAmino { + /** Returned is the amount of accepted asset returned to the user. */ + returned?: CoinAmino; + /** Fee is the amount of accepted asset charged to the user as the fee for the transaction. */ + fee?: CoinAmino; +} +export interface MsgRedeemResponseAminoMsg { + type: "/umee.metoken.v1.MsgRedeemResponse"; + value: MsgRedeemResponseAmino; +} +/** MsgRedeemResponse defines the Msg/Redeem response type. */ +export interface MsgRedeemResponseSDKType { + returned: CoinSDKType; + fee: CoinSDKType; +} +/** MsgGovSetParams defines the Msg/GovSetParams request type. */ +export interface MsgGovSetParams { + /** authority must be the address of the governance account. */ + authority: string; + params: Params; +} +export interface MsgGovSetParamsProtoMsg { + typeUrl: "/umee.metoken.v1.MsgGovSetParams"; + value: Uint8Array; +} +/** MsgGovSetParams defines the Msg/GovSetParams request type. */ +export interface MsgGovSetParamsAmino { + /** authority must be the address of the governance account. */ + authority?: string; + params?: ParamsAmino; +} +export interface MsgGovSetParamsAminoMsg { + type: "/umee.metoken.v1.MsgGovSetParams"; + value: MsgGovSetParamsAmino; +} +/** MsgGovSetParams defines the Msg/GovSetParams request type. */ +export interface MsgGovSetParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** MsgGovSetParamsResponse defines the Msg/GovSetParams response type. */ +export interface MsgGovSetParamsResponse {} +export interface MsgGovSetParamsResponseProtoMsg { + typeUrl: "/umee.metoken.v1.MsgGovSetParamsResponse"; + value: Uint8Array; +} +/** MsgGovSetParamsResponse defines the Msg/GovSetParams response type. */ +export interface MsgGovSetParamsResponseAmino {} +export interface MsgGovSetParamsResponseAminoMsg { + type: "/umee.metoken.v1.MsgGovSetParamsResponse"; + value: MsgGovSetParamsResponseAmino; +} +/** MsgGovSetParamsResponse defines the Msg/GovSetParams response type. */ +export interface MsgGovSetParamsResponseSDKType {} +/** MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type. */ +export interface MsgGovUpdateRegistry { + /** authority is the address of the governance account. */ + authority: string; + /** add_index defines new index settings. */ + addIndex: Index[]; + /** update_index defines the new settings for existing index. */ + updateIndex: Index[]; +} +export interface MsgGovUpdateRegistryProtoMsg { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistry"; + value: Uint8Array; +} +/** MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type. */ +export interface MsgGovUpdateRegistryAmino { + /** authority is the address of the governance account. */ + authority?: string; + /** add_index defines new index settings. */ + add_index?: IndexAmino[]; + /** update_index defines the new settings for existing index. */ + update_index?: IndexAmino[]; +} +export interface MsgGovUpdateRegistryAminoMsg { + type: "/umee.metoken.v1.MsgGovUpdateRegistry"; + value: MsgGovUpdateRegistryAmino; +} +/** MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type. */ +export interface MsgGovUpdateRegistrySDKType { + authority: string; + add_index: IndexSDKType[]; + update_index: IndexSDKType[]; +} +/** MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type. */ +export interface MsgGovUpdateRegistryResponse {} +export interface MsgGovUpdateRegistryResponseProtoMsg { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistryResponse"; + value: Uint8Array; +} +/** MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type. */ +export interface MsgGovUpdateRegistryResponseAmino {} +export interface MsgGovUpdateRegistryResponseAminoMsg { + type: "/umee.metoken.v1.MsgGovUpdateRegistryResponse"; + value: MsgGovUpdateRegistryResponseAmino; +} +/** MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type. */ +export interface MsgGovUpdateRegistryResponseSDKType {} +function createBaseMsgSwap(): MsgSwap { + return { + user: "", + asset: Coin.fromPartial({}), + metokenDenom: "" + }; +} +export const MsgSwap = { + typeUrl: "/umee.metoken.v1.MsgSwap", + encode(message: MsgSwap, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.user !== "") { + writer.uint32(10).string(message.user); + } + if (message.asset !== undefined) { + Coin.encode(message.asset, writer.uint32(18).fork()).ldelim(); + } + if (message.metokenDenom !== "") { + writer.uint32(26).string(message.metokenDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSwap { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSwap(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.user = reader.string(); + break; + case 2: + message.asset = Coin.decode(reader, reader.uint32()); + break; + case 3: + message.metokenDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgSwap { + const message = createBaseMsgSwap(); + message.user = object.user ?? ""; + message.asset = object.asset !== undefined && object.asset !== null ? Coin.fromPartial(object.asset) : undefined; + message.metokenDenom = object.metokenDenom ?? ""; + return message; + }, + fromAmino(object: MsgSwapAmino): MsgSwap { + const message = createBaseMsgSwap(); + if (object.user !== undefined && object.user !== null) { + message.user = object.user; + } + if (object.asset !== undefined && object.asset !== null) { + message.asset = Coin.fromAmino(object.asset); + } + if (object.metoken_denom !== undefined && object.metoken_denom !== null) { + message.metokenDenom = object.metoken_denom; + } + return message; + }, + toAmino(message: MsgSwap): MsgSwapAmino { + const obj: any = {}; + obj.user = message.user; + obj.asset = message.asset ? Coin.toAmino(message.asset) : undefined; + obj.metoken_denom = message.metokenDenom; + return obj; + }, + fromAminoMsg(object: MsgSwapAminoMsg): MsgSwap { + return MsgSwap.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSwapProtoMsg): MsgSwap { + return MsgSwap.decode(message.value); + }, + toProto(message: MsgSwap): Uint8Array { + return MsgSwap.encode(message).finish(); + }, + toProtoMsg(message: MsgSwap): MsgSwapProtoMsg { + return { + typeUrl: "/umee.metoken.v1.MsgSwap", + value: MsgSwap.encode(message).finish() + }; + } +}; +function createBaseMsgSwapResponse(): MsgSwapResponse { + return { + fee: Coin.fromPartial({}), + returned: Coin.fromPartial({}) + }; +} +export const MsgSwapResponse = { + typeUrl: "/umee.metoken.v1.MsgSwapResponse", + encode(message: MsgSwapResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fee !== undefined) { + Coin.encode(message.fee, writer.uint32(10).fork()).ldelim(); + } + if (message.returned !== undefined) { + Coin.encode(message.returned, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSwapResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSwapResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fee = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.returned = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgSwapResponse { + const message = createBaseMsgSwapResponse(); + message.fee = object.fee !== undefined && object.fee !== null ? Coin.fromPartial(object.fee) : undefined; + message.returned = object.returned !== undefined && object.returned !== null ? Coin.fromPartial(object.returned) : undefined; + return message; + }, + fromAmino(object: MsgSwapResponseAmino): MsgSwapResponse { + const message = createBaseMsgSwapResponse(); + if (object.fee !== undefined && object.fee !== null) { + message.fee = Coin.fromAmino(object.fee); + } + if (object.returned !== undefined && object.returned !== null) { + message.returned = Coin.fromAmino(object.returned); + } + return message; + }, + toAmino(message: MsgSwapResponse): MsgSwapResponseAmino { + const obj: any = {}; + obj.fee = message.fee ? Coin.toAmino(message.fee) : undefined; + obj.returned = message.returned ? Coin.toAmino(message.returned) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSwapResponseAminoMsg): MsgSwapResponse { + return MsgSwapResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSwapResponseProtoMsg): MsgSwapResponse { + return MsgSwapResponse.decode(message.value); + }, + toProto(message: MsgSwapResponse): Uint8Array { + return MsgSwapResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSwapResponse): MsgSwapResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.MsgSwapResponse", + value: MsgSwapResponse.encode(message).finish() + }; + } +}; +function createBaseMsgRedeem(): MsgRedeem { + return { + user: "", + metoken: Coin.fromPartial({}), + assetDenom: "" + }; +} +export const MsgRedeem = { + typeUrl: "/umee.metoken.v1.MsgRedeem", + encode(message: MsgRedeem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.user !== "") { + writer.uint32(10).string(message.user); + } + if (message.metoken !== undefined) { + Coin.encode(message.metoken, writer.uint32(18).fork()).ldelim(); + } + if (message.assetDenom !== "") { + writer.uint32(26).string(message.assetDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRedeem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRedeem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.user = reader.string(); + break; + case 2: + message.metoken = Coin.decode(reader, reader.uint32()); + break; + case 3: + message.assetDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgRedeem { + const message = createBaseMsgRedeem(); + message.user = object.user ?? ""; + message.metoken = object.metoken !== undefined && object.metoken !== null ? Coin.fromPartial(object.metoken) : undefined; + message.assetDenom = object.assetDenom ?? ""; + return message; + }, + fromAmino(object: MsgRedeemAmino): MsgRedeem { + const message = createBaseMsgRedeem(); + if (object.user !== undefined && object.user !== null) { + message.user = object.user; + } + if (object.metoken !== undefined && object.metoken !== null) { + message.metoken = Coin.fromAmino(object.metoken); + } + if (object.asset_denom !== undefined && object.asset_denom !== null) { + message.assetDenom = object.asset_denom; + } + return message; + }, + toAmino(message: MsgRedeem): MsgRedeemAmino { + const obj: any = {}; + obj.user = message.user; + obj.metoken = message.metoken ? Coin.toAmino(message.metoken) : undefined; + obj.asset_denom = message.assetDenom; + return obj; + }, + fromAminoMsg(object: MsgRedeemAminoMsg): MsgRedeem { + return MsgRedeem.fromAmino(object.value); + }, + fromProtoMsg(message: MsgRedeemProtoMsg): MsgRedeem { + return MsgRedeem.decode(message.value); + }, + toProto(message: MsgRedeem): Uint8Array { + return MsgRedeem.encode(message).finish(); + }, + toProtoMsg(message: MsgRedeem): MsgRedeemProtoMsg { + return { + typeUrl: "/umee.metoken.v1.MsgRedeem", + value: MsgRedeem.encode(message).finish() + }; + } +}; +function createBaseMsgRedeemResponse(): MsgRedeemResponse { + return { + returned: Coin.fromPartial({}), + fee: Coin.fromPartial({}) + }; +} +export const MsgRedeemResponse = { + typeUrl: "/umee.metoken.v1.MsgRedeemResponse", + encode(message: MsgRedeemResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.returned !== undefined) { + Coin.encode(message.returned, writer.uint32(10).fork()).ldelim(); + } + if (message.fee !== undefined) { + Coin.encode(message.fee, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRedeemResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRedeemResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.returned = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.fee = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgRedeemResponse { + const message = createBaseMsgRedeemResponse(); + message.returned = object.returned !== undefined && object.returned !== null ? Coin.fromPartial(object.returned) : undefined; + message.fee = object.fee !== undefined && object.fee !== null ? Coin.fromPartial(object.fee) : undefined; + return message; + }, + fromAmino(object: MsgRedeemResponseAmino): MsgRedeemResponse { + const message = createBaseMsgRedeemResponse(); + if (object.returned !== undefined && object.returned !== null) { + message.returned = Coin.fromAmino(object.returned); + } + if (object.fee !== undefined && object.fee !== null) { + message.fee = Coin.fromAmino(object.fee); + } + return message; + }, + toAmino(message: MsgRedeemResponse): MsgRedeemResponseAmino { + const obj: any = {}; + obj.returned = message.returned ? Coin.toAmino(message.returned) : undefined; + obj.fee = message.fee ? Coin.toAmino(message.fee) : undefined; + return obj; + }, + fromAminoMsg(object: MsgRedeemResponseAminoMsg): MsgRedeemResponse { + return MsgRedeemResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgRedeemResponseProtoMsg): MsgRedeemResponse { + return MsgRedeemResponse.decode(message.value); + }, + toProto(message: MsgRedeemResponse): Uint8Array { + return MsgRedeemResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRedeemResponse): MsgRedeemResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.MsgRedeemResponse", + value: MsgRedeemResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetParams(): MsgGovSetParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgGovSetParams = { + typeUrl: "/umee.metoken.v1.MsgGovSetParams", + encode(message: MsgGovSetParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovSetParams { + const message = createBaseMsgGovSetParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgGovSetParamsAmino): MsgGovSetParams { + const message = createBaseMsgGovSetParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgGovSetParams): MsgGovSetParamsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGovSetParamsAminoMsg): MsgGovSetParams { + return MsgGovSetParams.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetParamsProtoMsg): MsgGovSetParams { + return MsgGovSetParams.decode(message.value); + }, + toProto(message: MsgGovSetParams): Uint8Array { + return MsgGovSetParams.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetParams): MsgGovSetParamsProtoMsg { + return { + typeUrl: "/umee.metoken.v1.MsgGovSetParams", + value: MsgGovSetParams.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetParamsResponse(): MsgGovSetParamsResponse { + return {}; +} +export const MsgGovSetParamsResponse = { + typeUrl: "/umee.metoken.v1.MsgGovSetParamsResponse", + encode(_: MsgGovSetParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovSetParamsResponse { + const message = createBaseMsgGovSetParamsResponse(); + return message; + }, + fromAmino(_: MsgGovSetParamsResponseAmino): MsgGovSetParamsResponse { + const message = createBaseMsgGovSetParamsResponse(); + return message; + }, + toAmino(_: MsgGovSetParamsResponse): MsgGovSetParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovSetParamsResponseAminoMsg): MsgGovSetParamsResponse { + return MsgGovSetParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetParamsResponseProtoMsg): MsgGovSetParamsResponse { + return MsgGovSetParamsResponse.decode(message.value); + }, + toProto(message: MsgGovSetParamsResponse): Uint8Array { + return MsgGovSetParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetParamsResponse): MsgGovSetParamsResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.MsgGovSetParamsResponse", + value: MsgGovSetParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateRegistry(): MsgGovUpdateRegistry { + return { + authority: "", + addIndex: [], + updateIndex: [] + }; +} +export const MsgGovUpdateRegistry = { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistry", + encode(message: MsgGovUpdateRegistry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.addIndex) { + Index.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.updateIndex) { + Index.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateRegistry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateRegistry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.addIndex.push(Index.decode(reader, reader.uint32())); + break; + case 3: + message.updateIndex.push(Index.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovUpdateRegistry { + const message = createBaseMsgGovUpdateRegistry(); + message.authority = object.authority ?? ""; + message.addIndex = object.addIndex?.map(e => Index.fromPartial(e)) || []; + message.updateIndex = object.updateIndex?.map(e => Index.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgGovUpdateRegistryAmino): MsgGovUpdateRegistry { + const message = createBaseMsgGovUpdateRegistry(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.addIndex = object.add_index?.map(e => Index.fromAmino(e)) || []; + message.updateIndex = object.update_index?.map(e => Index.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgGovUpdateRegistry): MsgGovUpdateRegistryAmino { + const obj: any = {}; + obj.authority = message.authority; + if (message.addIndex) { + obj.add_index = message.addIndex.map(e => e ? Index.toAmino(e) : undefined); + } else { + obj.add_index = []; + } + if (message.updateIndex) { + obj.update_index = message.updateIndex.map(e => e ? Index.toAmino(e) : undefined); + } else { + obj.update_index = []; + } + return obj; + }, + fromAminoMsg(object: MsgGovUpdateRegistryAminoMsg): MsgGovUpdateRegistry { + return MsgGovUpdateRegistry.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateRegistryProtoMsg): MsgGovUpdateRegistry { + return MsgGovUpdateRegistry.decode(message.value); + }, + toProto(message: MsgGovUpdateRegistry): Uint8Array { + return MsgGovUpdateRegistry.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateRegistry): MsgGovUpdateRegistryProtoMsg { + return { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistry", + value: MsgGovUpdateRegistry.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateRegistryResponse(): MsgGovUpdateRegistryResponse { + return {}; +} +export const MsgGovUpdateRegistryResponse = { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistryResponse", + encode(_: MsgGovUpdateRegistryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateRegistryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateRegistryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovUpdateRegistryResponse { + const message = createBaseMsgGovUpdateRegistryResponse(); + return message; + }, + fromAmino(_: MsgGovUpdateRegistryResponseAmino): MsgGovUpdateRegistryResponse { + const message = createBaseMsgGovUpdateRegistryResponse(); + return message; + }, + toAmino(_: MsgGovUpdateRegistryResponse): MsgGovUpdateRegistryResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovUpdateRegistryResponseAminoMsg): MsgGovUpdateRegistryResponse { + return MsgGovUpdateRegistryResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateRegistryResponseProtoMsg): MsgGovUpdateRegistryResponse { + return MsgGovUpdateRegistryResponse.decode(message.value); + }, + toProto(message: MsgGovUpdateRegistryResponse): Uint8Array { + return MsgGovUpdateRegistryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateRegistryResponse): MsgGovUpdateRegistryResponseProtoMsg { + return { + typeUrl: "/umee.metoken.v1.MsgGovUpdateRegistryResponse", + value: MsgGovUpdateRegistryResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/events.ts b/src/codegen/umee/oracle/v1/events.ts index f866c05..2992c1e 100644 --- a/src/codegen/umee/oracle/v1/events.ts +++ b/src/codegen/umee/oracle/v1/events.ts @@ -1,148 +1,206 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; /** EventDelegateFeedConsent is emitted on Msg/DelegateFeedConsent */ - export interface EventDelegateFeedConsent { /** Operator bech32 address who delegates his feed consent */ operator: string; /** Delegate bech32 address */ - delegate: string; } +export interface EventDelegateFeedConsentProtoMsg { + typeUrl: "/umee.oracle.v1.EventDelegateFeedConsent"; + value: Uint8Array; +} /** EventDelegateFeedConsent is emitted on Msg/DelegateFeedConsent */ - -export interface EventDelegateFeedConsentSDKType { +export interface EventDelegateFeedConsentAmino { /** Operator bech32 address who delegates his feed consent */ - operator: string; + operator?: string; /** Delegate bech32 address */ - + delegate?: string; +} +export interface EventDelegateFeedConsentAminoMsg { + type: "/umee.oracle.v1.EventDelegateFeedConsent"; + value: EventDelegateFeedConsentAmino; +} +/** EventDelegateFeedConsent is emitted on Msg/DelegateFeedConsent */ +export interface EventDelegateFeedConsentSDKType { + operator: string; delegate: string; } /** EventSetFxRate is emitted on exchange rate update */ - export interface EventSetFxRate { /** uToken denom */ denom: string; /** Exchange rate (based to USD) */ - rate: string; } +export interface EventSetFxRateProtoMsg { + typeUrl: "/umee.oracle.v1.EventSetFxRate"; + value: Uint8Array; +} /** EventSetFxRate is emitted on exchange rate update */ - -export interface EventSetFxRateSDKType { +export interface EventSetFxRateAmino { /** uToken denom */ - denom: string; + denom?: string; /** Exchange rate (based to USD) */ - + rate?: string; +} +export interface EventSetFxRateAminoMsg { + type: "/umee.oracle.v1.EventSetFxRate"; + value: EventSetFxRateAmino; +} +/** EventSetFxRate is emitted on exchange rate update */ +export interface EventSetFxRateSDKType { + denom: string; rate: string; } - function createBaseEventDelegateFeedConsent(): EventDelegateFeedConsent { return { operator: "", delegate: "" }; } - export const EventDelegateFeedConsent = { - encode(message: EventDelegateFeedConsent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.EventDelegateFeedConsent", + encode(message: EventDelegateFeedConsent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operator !== "") { writer.uint32(10).string(message.operator); } - if (message.delegate !== "") { writer.uint32(18).string(message.delegate); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventDelegateFeedConsent { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventDelegateFeedConsent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventDelegateFeedConsent(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.operator = reader.string(); break; - case 2: message.delegate = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventDelegateFeedConsent { + fromPartial(object: Partial): EventDelegateFeedConsent { const message = createBaseEventDelegateFeedConsent(); message.operator = object.operator ?? ""; message.delegate = object.delegate ?? ""; return message; + }, + fromAmino(object: EventDelegateFeedConsentAmino): EventDelegateFeedConsent { + const message = createBaseEventDelegateFeedConsent(); + if (object.operator !== undefined && object.operator !== null) { + message.operator = object.operator; + } + if (object.delegate !== undefined && object.delegate !== null) { + message.delegate = object.delegate; + } + return message; + }, + toAmino(message: EventDelegateFeedConsent): EventDelegateFeedConsentAmino { + const obj: any = {}; + obj.operator = message.operator; + obj.delegate = message.delegate; + return obj; + }, + fromAminoMsg(object: EventDelegateFeedConsentAminoMsg): EventDelegateFeedConsent { + return EventDelegateFeedConsent.fromAmino(object.value); + }, + fromProtoMsg(message: EventDelegateFeedConsentProtoMsg): EventDelegateFeedConsent { + return EventDelegateFeedConsent.decode(message.value); + }, + toProto(message: EventDelegateFeedConsent): Uint8Array { + return EventDelegateFeedConsent.encode(message).finish(); + }, + toProtoMsg(message: EventDelegateFeedConsent): EventDelegateFeedConsentProtoMsg { + return { + typeUrl: "/umee.oracle.v1.EventDelegateFeedConsent", + value: EventDelegateFeedConsent.encode(message).finish() + }; } - }; - function createBaseEventSetFxRate(): EventSetFxRate { return { denom: "", rate: "" }; } - export const EventSetFxRate = { - encode(message: EventSetFxRate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.EventSetFxRate", + encode(message: EventSetFxRate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.rate !== "") { - writer.uint32(18).string(message.rate); + writer.uint32(18).string(Decimal.fromUserInput(message.rate, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): EventSetFxRate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EventSetFxRate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventSetFxRate(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: - message.rate = reader.string(); + message.rate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): EventSetFxRate { + fromPartial(object: Partial): EventSetFxRate { const message = createBaseEventSetFxRate(); message.denom = object.denom ?? ""; message.rate = object.rate ?? ""; return message; + }, + fromAmino(object: EventSetFxRateAmino): EventSetFxRate { + const message = createBaseEventSetFxRate(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.rate !== undefined && object.rate !== null) { + message.rate = object.rate; + } + return message; + }, + toAmino(message: EventSetFxRate): EventSetFxRateAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.rate = message.rate; + return obj; + }, + fromAminoMsg(object: EventSetFxRateAminoMsg): EventSetFxRate { + return EventSetFxRate.fromAmino(object.value); + }, + fromProtoMsg(message: EventSetFxRateProtoMsg): EventSetFxRate { + return EventSetFxRate.decode(message.value); + }, + toProto(message: EventSetFxRate): Uint8Array { + return EventSetFxRate.encode(message).finish(); + }, + toProtoMsg(message: EventSetFxRate): EventSetFxRateProtoMsg { + return { + typeUrl: "/umee.oracle.v1.EventSetFxRate", + value: EventSetFxRate.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/genesis.ts b/src/codegen/umee/oracle/v1/genesis.ts index 89ecfce..6e4d519 100644 --- a/src/codegen/umee/oracle/v1/genesis.ts +++ b/src/codegen/umee/oracle/v1/genesis.ts @@ -1,47 +1,85 @@ -import { Params, ParamsSDKType, ExchangeRateTuple, ExchangeRateTupleSDKType, AggregateExchangeRatePrevote, AggregateExchangeRatePrevoteSDKType, AggregateExchangeRateVote, AggregateExchangeRateVoteSDKType, HistoricPrice, HistoricPriceSDKType } from "./oracle"; -import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { Params, ParamsAmino, ParamsSDKType, DenomExchangeRate, DenomExchangeRateAmino, DenomExchangeRateSDKType, AggregateExchangeRatePrevote, AggregateExchangeRatePrevoteAmino, AggregateExchangeRatePrevoteSDKType, AggregateExchangeRateVote, AggregateExchangeRateVoteAmino, AggregateExchangeRateVoteSDKType, AvgCounterParams, AvgCounterParamsAmino, AvgCounterParamsSDKType, ExchangeRateTuple, ExchangeRateTupleAmino, ExchangeRateTupleSDKType } from "./oracle"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the oracle module's genesis state. */ - export interface GenesisState { - params?: Params; + params: Params; feederDelegations: FeederDelegation[]; - exchangeRates: ExchangeRateTuple[]; + exchangeRates: DenomExchangeRate[]; missCounters: MissCounter[]; aggregateExchangeRatePrevotes: AggregateExchangeRatePrevote[]; aggregateExchangeRateVotes: AggregateExchangeRateVote[]; - medians: DecCoin[]; - historicPrices: HistoricPrice[]; + medians: Price[]; + historicPrices: Price[]; + medianDeviations: Price[]; + /** Historic Avg Counter params */ + avgCounterParams: AvgCounterParams; +} +export interface GenesisStateProtoMsg { + typeUrl: "/umee.oracle.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the oracle module's genesis state. */ +export interface GenesisStateAmino { + params?: ParamsAmino; + feeder_delegations?: FeederDelegationAmino[]; + exchange_rates?: DenomExchangeRateAmino[]; + miss_counters?: MissCounterAmino[]; + aggregate_exchange_rate_prevotes?: AggregateExchangeRatePrevoteAmino[]; + aggregate_exchange_rate_votes?: AggregateExchangeRateVoteAmino[]; + medians?: PriceAmino[]; + historic_prices?: PriceAmino[]; + medianDeviations?: PriceAmino[]; + /** Historic Avg Counter params */ + avg_counter_params?: AvgCounterParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "/umee.oracle.v1.GenesisState"; + value: GenesisStateAmino; } /** GenesisState defines the oracle module's genesis state. */ - export interface GenesisStateSDKType { - params?: ParamsSDKType; + params: ParamsSDKType; feeder_delegations: FeederDelegationSDKType[]; - exchange_rates: ExchangeRateTupleSDKType[]; + exchange_rates: DenomExchangeRateSDKType[]; miss_counters: MissCounterSDKType[]; aggregate_exchange_rate_prevotes: AggregateExchangeRatePrevoteSDKType[]; aggregate_exchange_rate_votes: AggregateExchangeRateVoteSDKType[]; - medians: DecCoinSDKType[]; - historic_prices: HistoricPriceSDKType[]; + medians: PriceSDKType[]; + historic_prices: PriceSDKType[]; + medianDeviations: PriceSDKType[]; + avg_counter_params: AvgCounterParamsSDKType; } /** * FeederDelegation is the address for where oracle feeder authority are * delegated to. By default this struct is only used at genesis to feed in * default feeder addresses. */ - export interface FeederDelegation { feederAddress: string; validatorAddress: string; } +export interface FeederDelegationProtoMsg { + typeUrl: "/umee.oracle.v1.FeederDelegation"; + value: Uint8Array; +} +/** + * FeederDelegation is the address for where oracle feeder authority are + * delegated to. By default this struct is only used at genesis to feed in + * default feeder addresses. + */ +export interface FeederDelegationAmino { + feeder_address?: string; + validator_address?: string; +} +export interface FeederDelegationAminoMsg { + type: "/umee.oracle.v1.FeederDelegation"; + value: FeederDelegationAmino; +} /** * FeederDelegation is the address for where oracle feeder authority are * delegated to. By default this struct is only used at genesis to feed in * default feeder addresses. */ - export interface FeederDelegationSDKType { feeder_address: string; validator_address: string; @@ -50,242 +88,466 @@ export interface FeederDelegationSDKType { * MissCounter defines an miss counter and validator address pair used in * oracle module's genesis state */ - export interface MissCounter { validatorAddress: string; - missCounter: Long; + missCounter: bigint; +} +export interface MissCounterProtoMsg { + typeUrl: "/umee.oracle.v1.MissCounter"; + value: Uint8Array; +} +/** + * MissCounter defines an miss counter and validator address pair used in + * oracle module's genesis state + */ +export interface MissCounterAmino { + validator_address?: string; + miss_counter?: string; +} +export interface MissCounterAminoMsg { + type: "/umee.oracle.v1.MissCounter"; + value: MissCounterAmino; } /** * MissCounter defines an miss counter and validator address pair used in * oracle module's genesis state */ - export interface MissCounterSDKType { validator_address: string; - miss_counter: Long; + miss_counter: bigint; +} +/** Price is an instance of a price "stamp" */ +export interface Price { + exchangeRateTuple: ExchangeRateTuple; + blockNum: bigint; +} +export interface PriceProtoMsg { + typeUrl: "/umee.oracle.v1.Price"; + value: Uint8Array; +} +/** Price is an instance of a price "stamp" */ +export interface PriceAmino { + exchange_rate_tuple?: ExchangeRateTupleAmino; + block_num?: string; +} +export interface PriceAminoMsg { + type: "/umee.oracle.v1.Price"; + value: PriceAmino; +} +/** Price is an instance of a price "stamp" */ +export interface PriceSDKType { + exchange_rate_tuple: ExchangeRateTupleSDKType; + block_num: bigint; } - function createBaseGenesisState(): GenesisState { return { - params: undefined, + params: Params.fromPartial({}), feederDelegations: [], exchangeRates: [], missCounters: [], aggregateExchangeRatePrevotes: [], aggregateExchangeRateVotes: [], medians: [], - historicPrices: [] + historicPrices: [], + medianDeviations: [], + avgCounterParams: AvgCounterParams.fromPartial({}) }; } - export const GenesisState = { - encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - for (const v of message.feederDelegations) { FeederDelegation.encode(v!, writer.uint32(18).fork()).ldelim(); } - for (const v of message.exchangeRates) { - ExchangeRateTuple.encode(v!, writer.uint32(26).fork()).ldelim(); + DenomExchangeRate.encode(v!, writer.uint32(26).fork()).ldelim(); } - for (const v of message.missCounters) { MissCounter.encode(v!, writer.uint32(34).fork()).ldelim(); } - for (const v of message.aggregateExchangeRatePrevotes) { AggregateExchangeRatePrevote.encode(v!, writer.uint32(42).fork()).ldelim(); } - for (const v of message.aggregateExchangeRateVotes) { AggregateExchangeRateVote.encode(v!, writer.uint32(50).fork()).ldelim(); } - for (const v of message.medians) { - DecCoin.encode(v!, writer.uint32(58).fork()).ldelim(); + Price.encode(v!, writer.uint32(58).fork()).ldelim(); } - for (const v of message.historicPrices) { - HistoricPrice.encode(v!, writer.uint32(66).fork()).ldelim(); + Price.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.medianDeviations) { + Price.encode(v!, writer.uint32(74).fork()).ldelim(); + } + if (message.avgCounterParams !== undefined) { + AvgCounterParams.encode(message.avgCounterParams, writer.uint32(82).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + 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: message.params = Params.decode(reader, reader.uint32()); break; - case 2: message.feederDelegations.push(FeederDelegation.decode(reader, reader.uint32())); break; - case 3: - message.exchangeRates.push(ExchangeRateTuple.decode(reader, reader.uint32())); + message.exchangeRates.push(DenomExchangeRate.decode(reader, reader.uint32())); break; - case 4: message.missCounters.push(MissCounter.decode(reader, reader.uint32())); break; - case 5: message.aggregateExchangeRatePrevotes.push(AggregateExchangeRatePrevote.decode(reader, reader.uint32())); break; - case 6: message.aggregateExchangeRateVotes.push(AggregateExchangeRateVote.decode(reader, reader.uint32())); break; - case 7: - message.medians.push(DecCoin.decode(reader, reader.uint32())); + message.medians.push(Price.decode(reader, reader.uint32())); break; - case 8: - message.historicPrices.push(HistoricPrice.decode(reader, reader.uint32())); + message.historicPrices.push(Price.decode(reader, reader.uint32())); + break; + case 9: + message.medianDeviations.push(Price.decode(reader, reader.uint32())); + break; + case 10: + message.avgCounterParams = AvgCounterParams.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): GenesisState { + fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.feederDelegations = object.feederDelegations?.map(e => FeederDelegation.fromPartial(e)) || []; - message.exchangeRates = object.exchangeRates?.map(e => ExchangeRateTuple.fromPartial(e)) || []; + message.exchangeRates = object.exchangeRates?.map(e => DenomExchangeRate.fromPartial(e)) || []; message.missCounters = object.missCounters?.map(e => MissCounter.fromPartial(e)) || []; message.aggregateExchangeRatePrevotes = object.aggregateExchangeRatePrevotes?.map(e => AggregateExchangeRatePrevote.fromPartial(e)) || []; message.aggregateExchangeRateVotes = object.aggregateExchangeRateVotes?.map(e => AggregateExchangeRateVote.fromPartial(e)) || []; - message.medians = object.medians?.map(e => DecCoin.fromPartial(e)) || []; - message.historicPrices = object.historicPrices?.map(e => HistoricPrice.fromPartial(e)) || []; + message.medians = object.medians?.map(e => Price.fromPartial(e)) || []; + message.historicPrices = object.historicPrices?.map(e => Price.fromPartial(e)) || []; + message.medianDeviations = object.medianDeviations?.map(e => Price.fromPartial(e)) || []; + message.avgCounterParams = object.avgCounterParams !== undefined && object.avgCounterParams !== null ? AvgCounterParams.fromPartial(object.avgCounterParams) : undefined; return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.feederDelegations = object.feeder_delegations?.map(e => FeederDelegation.fromAmino(e)) || []; + message.exchangeRates = object.exchange_rates?.map(e => DenomExchangeRate.fromAmino(e)) || []; + message.missCounters = object.miss_counters?.map(e => MissCounter.fromAmino(e)) || []; + message.aggregateExchangeRatePrevotes = object.aggregate_exchange_rate_prevotes?.map(e => AggregateExchangeRatePrevote.fromAmino(e)) || []; + message.aggregateExchangeRateVotes = object.aggregate_exchange_rate_votes?.map(e => AggregateExchangeRateVote.fromAmino(e)) || []; + message.medians = object.medians?.map(e => Price.fromAmino(e)) || []; + message.historicPrices = object.historic_prices?.map(e => Price.fromAmino(e)) || []; + message.medianDeviations = object.medianDeviations?.map(e => Price.fromAmino(e)) || []; + if (object.avg_counter_params !== undefined && object.avg_counter_params !== null) { + message.avgCounterParams = AvgCounterParams.fromAmino(object.avg_counter_params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.feederDelegations) { + obj.feeder_delegations = message.feederDelegations.map(e => e ? FeederDelegation.toAmino(e) : undefined); + } else { + obj.feeder_delegations = []; + } + if (message.exchangeRates) { + obj.exchange_rates = message.exchangeRates.map(e => e ? DenomExchangeRate.toAmino(e) : undefined); + } else { + obj.exchange_rates = []; + } + if (message.missCounters) { + obj.miss_counters = message.missCounters.map(e => e ? MissCounter.toAmino(e) : undefined); + } else { + obj.miss_counters = []; + } + if (message.aggregateExchangeRatePrevotes) { + obj.aggregate_exchange_rate_prevotes = message.aggregateExchangeRatePrevotes.map(e => e ? AggregateExchangeRatePrevote.toAmino(e) : undefined); + } else { + obj.aggregate_exchange_rate_prevotes = []; + } + if (message.aggregateExchangeRateVotes) { + obj.aggregate_exchange_rate_votes = message.aggregateExchangeRateVotes.map(e => e ? AggregateExchangeRateVote.toAmino(e) : undefined); + } else { + obj.aggregate_exchange_rate_votes = []; + } + if (message.medians) { + obj.medians = message.medians.map(e => e ? Price.toAmino(e) : undefined); + } else { + obj.medians = []; + } + if (message.historicPrices) { + obj.historic_prices = message.historicPrices.map(e => e ? Price.toAmino(e) : undefined); + } else { + obj.historic_prices = []; + } + if (message.medianDeviations) { + obj.medianDeviations = message.medianDeviations.map(e => e ? Price.toAmino(e) : undefined); + } else { + obj.medianDeviations = []; + } + obj.avg_counter_params = message.avgCounterParams ? AvgCounterParams.toAmino(message.avgCounterParams) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/umee.oracle.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; } - }; - function createBaseFeederDelegation(): FeederDelegation { return { feederAddress: "", validatorAddress: "" }; } - export const FeederDelegation = { - encode(message: FeederDelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.FeederDelegation", + encode(message: FeederDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.feederAddress !== "") { writer.uint32(10).string(message.feederAddress); } - if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FeederDelegation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): FeederDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFeederDelegation(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.feederAddress = reader.string(); break; - case 2: message.validatorAddress = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): FeederDelegation { + fromPartial(object: Partial): FeederDelegation { const message = createBaseFeederDelegation(); message.feederAddress = object.feederAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; return message; + }, + fromAmino(object: FeederDelegationAmino): FeederDelegation { + const message = createBaseFeederDelegation(); + if (object.feeder_address !== undefined && object.feeder_address !== null) { + message.feederAddress = object.feeder_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: FeederDelegation): FeederDelegationAmino { + const obj: any = {}; + obj.feeder_address = message.feederAddress; + obj.validator_address = message.validatorAddress; + return obj; + }, + fromAminoMsg(object: FeederDelegationAminoMsg): FeederDelegation { + return FeederDelegation.fromAmino(object.value); + }, + fromProtoMsg(message: FeederDelegationProtoMsg): FeederDelegation { + return FeederDelegation.decode(message.value); + }, + toProto(message: FeederDelegation): Uint8Array { + return FeederDelegation.encode(message).finish(); + }, + toProtoMsg(message: FeederDelegation): FeederDelegationProtoMsg { + return { + typeUrl: "/umee.oracle.v1.FeederDelegation", + value: FeederDelegation.encode(message).finish() + }; } - }; - function createBaseMissCounter(): MissCounter { return { validatorAddress: "", - missCounter: Long.UZERO + missCounter: BigInt(0) }; } - export const MissCounter = { - encode(message: MissCounter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.MissCounter", + encode(message: MissCounter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); } - - if (!message.missCounter.isZero()) { + if (message.missCounter !== BigInt(0)) { writer.uint32(16).uint64(message.missCounter); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MissCounter { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MissCounter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMissCounter(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddress = reader.string(); break; - case 2: - message.missCounter = (reader.uint64() as Long); + message.missCounter = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MissCounter { + fromPartial(object: Partial): MissCounter { const message = createBaseMissCounter(); message.validatorAddress = object.validatorAddress ?? ""; - message.missCounter = object.missCounter !== undefined && object.missCounter !== null ? Long.fromValue(object.missCounter) : Long.UZERO; + message.missCounter = object.missCounter !== undefined && object.missCounter !== null ? BigInt(object.missCounter.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MissCounterAmino): MissCounter { + const message = createBaseMissCounter(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.miss_counter !== undefined && object.miss_counter !== null) { + message.missCounter = BigInt(object.miss_counter); + } + return message; + }, + toAmino(message: MissCounter): MissCounterAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress; + obj.miss_counter = message.missCounter ? message.missCounter.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MissCounterAminoMsg): MissCounter { + return MissCounter.fromAmino(object.value); + }, + fromProtoMsg(message: MissCounterProtoMsg): MissCounter { + return MissCounter.decode(message.value); + }, + toProto(message: MissCounter): Uint8Array { + return MissCounter.encode(message).finish(); + }, + toProtoMsg(message: MissCounter): MissCounterProtoMsg { + return { + typeUrl: "/umee.oracle.v1.MissCounter", + value: MissCounter.encode(message).finish() + }; + } +}; +function createBasePrice(): Price { + return { + exchangeRateTuple: ExchangeRateTuple.fromPartial({}), + blockNum: BigInt(0) + }; +} +export const Price = { + typeUrl: "/umee.oracle.v1.Price", + encode(message: Price, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.exchangeRateTuple !== undefined) { + ExchangeRateTuple.encode(message.exchangeRateTuple, writer.uint32(10).fork()).ldelim(); + } + if (message.blockNum !== BigInt(0)) { + writer.uint32(16).uint64(message.blockNum); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Price { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exchangeRateTuple = ExchangeRateTuple.decode(reader, reader.uint32()); + break; + case 2: + message.blockNum = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Price { + const message = createBasePrice(); + message.exchangeRateTuple = object.exchangeRateTuple !== undefined && object.exchangeRateTuple !== null ? ExchangeRateTuple.fromPartial(object.exchangeRateTuple) : undefined; + message.blockNum = object.blockNum !== undefined && object.blockNum !== null ? BigInt(object.blockNum.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PriceAmino): Price { + const message = createBasePrice(); + if (object.exchange_rate_tuple !== undefined && object.exchange_rate_tuple !== null) { + message.exchangeRateTuple = ExchangeRateTuple.fromAmino(object.exchange_rate_tuple); + } + if (object.block_num !== undefined && object.block_num !== null) { + message.blockNum = BigInt(object.block_num); + } return message; + }, + toAmino(message: Price): PriceAmino { + const obj: any = {}; + obj.exchange_rate_tuple = message.exchangeRateTuple ? ExchangeRateTuple.toAmino(message.exchangeRateTuple) : undefined; + obj.block_num = message.blockNum ? message.blockNum.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PriceAminoMsg): Price { + return Price.fromAmino(object.value); + }, + fromProtoMsg(message: PriceProtoMsg): Price { + return Price.decode(message.value); + }, + toProto(message: Price): Uint8Array { + return Price.encode(message).finish(); + }, + toProtoMsg(message: Price): PriceProtoMsg { + return { + typeUrl: "/umee.oracle.v1.Price", + value: Price.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/oracle.ts b/src/codegen/umee/oracle/v1/oracle.ts index de7720d..8ec8450 100644 --- a/src/codegen/umee/oracle/v1/oracle.ts +++ b/src/codegen/umee/oracle/v1/oracle.ts @@ -1,76 +1,143 @@ -import * as _m0 from "protobufjs/minimal"; -import { Long, DeepPartial } from "../../../helpers"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** Params defines the parameters for the oracle module. */ - export interface Params { - votePeriod: Long; + votePeriod: bigint; voteThreshold: string; rewardBand: string; - rewardDistributionWindow: Long; + rewardDistributionWindow: bigint; acceptList: Denom[]; slashFraction: string; - slashWindow: Long; + slashWindow: bigint; minValidPerWindow: string; /** - * Stamp Period represents the amount of blocks the historacle module - * waits before recording a set of prices from the oracle. + * Historic Stamp Period represents the amount of blocks the oracle + * module waits before recording a new historic price. */ - - stampPeriod: Long; + historicStampPeriod: bigint; /** - * Prune Period represents the maximum amount of blocks which we want - * to keep a record of our set of exchange rates. + * Median Stamp Period represents the amount blocks the oracle module + * waits between calculating and stamping a new median and standard + * deviation of that median. */ - - prunePeriod: Long; + medianStampPeriod: bigint; /** - * Median Period represents the amount blocks we will wait between - * calculating the median and standard deviation of the median of - * historic prices in the last Prune Period. + * Maximum Price Stamps represents the maximum amount of historic prices + * the oracle module will store before pruning via FIFO. */ - - medianPeriod: Long; + maximumPriceStamps: bigint; + /** + * Maximum Median Stamps represents the maximum amount of medians the + * oracle module will store before pruning via FIFO. + */ + maximumMedianStamps: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/umee.oracle.v1.Params"; + value: Uint8Array; } /** Params defines the parameters for the oracle module. */ - -export interface ParamsSDKType { - vote_period: Long; - vote_threshold: string; - reward_band: string; - reward_distribution_window: Long; - accept_list: DenomSDKType[]; - slash_fraction: string; - slash_window: Long; - min_valid_per_window: string; +export interface ParamsAmino { + vote_period?: string; + vote_threshold?: string; + reward_band?: string; + reward_distribution_window?: string; + accept_list?: DenomAmino[]; + slash_fraction?: string; + slash_window?: string; + min_valid_per_window?: string; + /** + * Historic Stamp Period represents the amount of blocks the oracle + * module waits before recording a new historic price. + */ + historic_stamp_period?: string; /** - * Stamp Period represents the amount of blocks the historacle module - * waits before recording a set of prices from the oracle. + * Median Stamp Period represents the amount blocks the oracle module + * waits between calculating and stamping a new median and standard + * deviation of that median. */ - - stamp_period: Long; + median_stamp_period?: string; /** - * Prune Period represents the maximum amount of blocks which we want - * to keep a record of our set of exchange rates. + * Maximum Price Stamps represents the maximum amount of historic prices + * the oracle module will store before pruning via FIFO. */ - - prune_period: Long; + maximum_price_stamps?: string; /** - * Median Period represents the amount blocks we will wait between - * calculating the median and standard deviation of the median of - * historic prices in the last Prune Period. + * Maximum Median Stamps represents the maximum amount of medians the + * oracle module will store before pruning via FIFO. */ - - median_period: Long; + maximum_median_stamps?: string; +} +export interface ParamsAminoMsg { + type: "/umee.oracle.v1.Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the oracle module. */ +export interface ParamsSDKType { + vote_period: bigint; + vote_threshold: string; + reward_band: string; + reward_distribution_window: bigint; + accept_list: DenomSDKType[]; + slash_fraction: string; + slash_window: bigint; + min_valid_per_window: string; + historic_stamp_period: bigint; + median_stamp_period: bigint; + maximum_price_stamps: bigint; + maximum_median_stamps: bigint; +} +/** AvgCounterParams - Historic avg counter params */ +export interface AvgCounterParams { + /** avg_period */ + avgPeriod: Duration; + /** avg shift */ + avgShift: Duration; +} +export interface AvgCounterParamsProtoMsg { + typeUrl: "/umee.oracle.v1.AvgCounterParams"; + value: Uint8Array; +} +/** AvgCounterParams - Historic avg counter params */ +export interface AvgCounterParamsAmino { + /** avg_period */ + avg_period?: DurationAmino; + /** avg shift */ + avg_shift?: DurationAmino; +} +export interface AvgCounterParamsAminoMsg { + type: "/umee.oracle.v1.AvgCounterParams"; + value: AvgCounterParamsAmino; +} +/** AvgCounterParams - Historic avg counter params */ +export interface AvgCounterParamsSDKType { + avg_period: DurationSDKType; + avg_shift: DurationSDKType; } /** Denom - the object to hold configurations of each denom */ - export interface Denom { baseDenom: string; symbolDenom: string; exponent: number; } +export interface DenomProtoMsg { + typeUrl: "/umee.oracle.v1.Denom"; + value: Uint8Array; +} +/** Denom - the object to hold configurations of each denom */ +export interface DenomAmino { + base_denom?: string; + symbol_denom?: string; + exponent?: number; +} +export interface DenomAminoMsg { + type: "/umee.oracle.v1.Denom"; + value: DenomAmino; +} /** Denom - the object to hold configurations of each denom */ - export interface DenomSDKType { base_denom: string; symbol_denom: string; @@ -83,11 +150,30 @@ export interface DenomSDKType { * which is formatted as hex string in SHA256("{salt}:{exchange * rate}{denom},...,{exchange rate}{denom}:{voter}") */ - export interface AggregateExchangeRatePrevote { hash: string; voter: string; - submitBlock: Long; + submitBlock: bigint; +} +export interface AggregateExchangeRatePrevoteProtoMsg { + typeUrl: "/umee.oracle.v1.AggregateExchangeRatePrevote"; + value: Uint8Array; +} +/** + * AggregateExchangeRatePrevote - + * struct for aggregate prevoting on the ExchangeRateVote. + * The purpose of aggregate prevote is to hide vote exchange rates with hash + * which is formatted as hex string in SHA256("{salt}:{exchange + * rate}{denom},...,{exchange rate}{denom}:{voter}") + */ +export interface AggregateExchangeRatePrevoteAmino { + hash?: string; + voter?: string; + submit_block?: string; +} +export interface AggregateExchangeRatePrevoteAminoMsg { + type: "/umee.oracle.v1.AggregateExchangeRatePrevote"; + value: AggregateExchangeRatePrevoteAmino; } /** * AggregateExchangeRatePrevote - @@ -96,200 +182,405 @@ export interface AggregateExchangeRatePrevote { * which is formatted as hex string in SHA256("{salt}:{exchange * rate}{denom},...,{exchange rate}{denom}:{voter}") */ - export interface AggregateExchangeRatePrevoteSDKType { hash: string; voter: string; - submit_block: Long; + submit_block: bigint; } /** * AggregateExchangeRateVote - struct for voting on * the exchange rates of USD denominated in various assets. */ - export interface AggregateExchangeRateVote { exchangeRateTuples: ExchangeRateTuple[]; voter: string; } +export interface AggregateExchangeRateVoteProtoMsg { + typeUrl: "/umee.oracle.v1.AggregateExchangeRateVote"; + value: Uint8Array; +} +/** + * AggregateExchangeRateVote - struct for voting on + * the exchange rates of USD denominated in various assets. + */ +export interface AggregateExchangeRateVoteAmino { + exchange_rate_tuples?: ExchangeRateTupleAmino[]; + voter?: string; +} +export interface AggregateExchangeRateVoteAminoMsg { + type: "/umee.oracle.v1.AggregateExchangeRateVote"; + value: AggregateExchangeRateVoteAmino; +} /** * AggregateExchangeRateVote - struct for voting on * the exchange rates of USD denominated in various assets. */ - export interface AggregateExchangeRateVoteSDKType { exchange_rate_tuples: ExchangeRateTupleSDKType[]; voter: string; } /** ExchangeRateTuple - struct to store interpreted exchange rates data to store */ - export interface ExchangeRateTuple { denom: string; exchangeRate: string; } +export interface ExchangeRateTupleProtoMsg { + typeUrl: "/umee.oracle.v1.ExchangeRateTuple"; + value: Uint8Array; +} +/** ExchangeRateTuple - struct to store interpreted exchange rates data to store */ +export interface ExchangeRateTupleAmino { + denom?: string; + exchange_rate?: string; +} +export interface ExchangeRateTupleAminoMsg { + type: "/umee.oracle.v1.ExchangeRateTuple"; + value: ExchangeRateTupleAmino; +} /** ExchangeRateTuple - struct to store interpreted exchange rates data to store */ - export interface ExchangeRateTupleSDKType { denom: string; exchange_rate: string; } -/** HistoricPrice is an instance of a price "stamp" */ - -export interface HistoricPrice { - exchangeRate?: ExchangeRateTuple; - blockNum: Long; +/** + * AvgCounter is holds information about the active avg aggreator windows, used + * to quickly compute average price of an asset. + */ +export interface AvgCounter { + /** sum of prices in the counter */ + sum: string; + /** number of aggregated prices in the counter */ + num: number; + /** Unix timestamp when the first price was aggregated in the counter */ + start: Date; +} +export interface AvgCounterProtoMsg { + typeUrl: "/umee.oracle.v1.AvgCounter"; + value: Uint8Array; +} +/** + * AvgCounter is holds information about the active avg aggreator windows, used + * to quickly compute average price of an asset. + */ +export interface AvgCounterAmino { + /** sum of prices in the counter */ + sum?: string; + /** number of aggregated prices in the counter */ + num?: number; + /** Unix timestamp when the first price was aggregated in the counter */ + start?: string; +} +export interface AvgCounterAminoMsg { + type: "/umee.oracle.v1.AvgCounter"; + value: AvgCounterAmino; +} +/** + * AvgCounter is holds information about the active avg aggreator windows, used + * to quickly compute average price of an asset. + */ +export interface AvgCounterSDKType { + sum: string; + num: number; + start: Date; +} +/** DenomExchangeRate stores exchange rate with timestamp */ +export interface DenomExchangeRate { + denom: string; + rate: string; + timestamp: Date; +} +export interface DenomExchangeRateProtoMsg { + typeUrl: "/umee.oracle.v1.DenomExchangeRate"; + value: Uint8Array; +} +/** DenomExchangeRate stores exchange rate with timestamp */ +export interface DenomExchangeRateAmino { + denom?: string; + rate?: string; + timestamp?: string; } -/** HistoricPrice is an instance of a price "stamp" */ - -export interface HistoricPriceSDKType { - exchange_rate?: ExchangeRateTupleSDKType; - block_num: Long; +export interface DenomExchangeRateAminoMsg { + type: "/umee.oracle.v1.DenomExchangeRate"; + value: DenomExchangeRateAmino; +} +/** DenomExchangeRate stores exchange rate with timestamp */ +export interface DenomExchangeRateSDKType { + denom: string; + rate: string; + timestamp: Date; } - function createBaseParams(): Params { return { - votePeriod: Long.UZERO, + votePeriod: BigInt(0), voteThreshold: "", rewardBand: "", - rewardDistributionWindow: Long.UZERO, + rewardDistributionWindow: BigInt(0), acceptList: [], slashFraction: "", - slashWindow: Long.UZERO, + slashWindow: BigInt(0), minValidPerWindow: "", - stampPeriod: Long.UZERO, - prunePeriod: Long.UZERO, - medianPeriod: Long.UZERO + historicStampPeriod: BigInt(0), + medianStampPeriod: BigInt(0), + maximumPriceStamps: BigInt(0), + maximumMedianStamps: BigInt(0) }; } - export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.votePeriod.isZero()) { + typeUrl: "/umee.oracle.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votePeriod !== BigInt(0)) { writer.uint32(8).uint64(message.votePeriod); } - if (message.voteThreshold !== "") { - writer.uint32(18).string(message.voteThreshold); + writer.uint32(18).string(Decimal.fromUserInput(message.voteThreshold, 18).atomics); } - if (message.rewardBand !== "") { - writer.uint32(26).string(message.rewardBand); + writer.uint32(26).string(Decimal.fromUserInput(message.rewardBand, 18).atomics); } - - if (!message.rewardDistributionWindow.isZero()) { + if (message.rewardDistributionWindow !== BigInt(0)) { writer.uint32(32).uint64(message.rewardDistributionWindow); } - for (const v of message.acceptList) { Denom.encode(v!, writer.uint32(42).fork()).ldelim(); } - if (message.slashFraction !== "") { - writer.uint32(50).string(message.slashFraction); + writer.uint32(50).string(Decimal.fromUserInput(message.slashFraction, 18).atomics); } - - if (!message.slashWindow.isZero()) { + if (message.slashWindow !== BigInt(0)) { writer.uint32(56).uint64(message.slashWindow); } - if (message.minValidPerWindow !== "") { - writer.uint32(66).string(message.minValidPerWindow); + writer.uint32(66).string(Decimal.fromUserInput(message.minValidPerWindow, 18).atomics); } - - if (!message.stampPeriod.isZero()) { - writer.uint32(72).uint64(message.stampPeriod); + if (message.historicStampPeriod !== BigInt(0)) { + writer.uint32(72).uint64(message.historicStampPeriod); } - - if (!message.prunePeriod.isZero()) { - writer.uint32(80).uint64(message.prunePeriod); + if (message.medianStampPeriod !== BigInt(0)) { + writer.uint32(80).uint64(message.medianStampPeriod); } - - if (!message.medianPeriod.isZero()) { - writer.uint32(88).uint64(message.medianPeriod); + if (message.maximumPriceStamps !== BigInt(0)) { + writer.uint32(88).uint64(message.maximumPriceStamps); + } + if (message.maximumMedianStamps !== BigInt(0)) { + writer.uint32(96).uint64(message.maximumMedianStamps); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.votePeriod = (reader.uint64() as Long); + message.votePeriod = reader.uint64(); break; - case 2: - message.voteThreshold = reader.string(); + message.voteThreshold = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 3: - message.rewardBand = reader.string(); + message.rewardBand = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 4: - message.rewardDistributionWindow = (reader.uint64() as Long); + message.rewardDistributionWindow = reader.uint64(); break; - case 5: message.acceptList.push(Denom.decode(reader, reader.uint32())); break; - case 6: - message.slashFraction = reader.string(); + message.slashFraction = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 7: - message.slashWindow = (reader.uint64() as Long); + message.slashWindow = reader.uint64(); break; - case 8: - message.minValidPerWindow = reader.string(); + message.minValidPerWindow = Decimal.fromAtomics(reader.string(), 18).toString(); break; - case 9: - message.stampPeriod = (reader.uint64() as Long); + message.historicStampPeriod = reader.uint64(); break; - case 10: - message.prunePeriod = (reader.uint64() as Long); + message.medianStampPeriod = reader.uint64(); break; - case 11: - message.medianPeriod = (reader.uint64() as Long); + message.maximumPriceStamps = reader.uint64(); + break; + case 12: + message.maximumMedianStamps = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Params { + fromPartial(object: Partial): Params { const message = createBaseParams(); - message.votePeriod = object.votePeriod !== undefined && object.votePeriod !== null ? Long.fromValue(object.votePeriod) : Long.UZERO; + message.votePeriod = object.votePeriod !== undefined && object.votePeriod !== null ? BigInt(object.votePeriod.toString()) : BigInt(0); message.voteThreshold = object.voteThreshold ?? ""; message.rewardBand = object.rewardBand ?? ""; - message.rewardDistributionWindow = object.rewardDistributionWindow !== undefined && object.rewardDistributionWindow !== null ? Long.fromValue(object.rewardDistributionWindow) : Long.UZERO; + message.rewardDistributionWindow = object.rewardDistributionWindow !== undefined && object.rewardDistributionWindow !== null ? BigInt(object.rewardDistributionWindow.toString()) : BigInt(0); message.acceptList = object.acceptList?.map(e => Denom.fromPartial(e)) || []; message.slashFraction = object.slashFraction ?? ""; - message.slashWindow = object.slashWindow !== undefined && object.slashWindow !== null ? Long.fromValue(object.slashWindow) : Long.UZERO; + message.slashWindow = object.slashWindow !== undefined && object.slashWindow !== null ? BigInt(object.slashWindow.toString()) : BigInt(0); message.minValidPerWindow = object.minValidPerWindow ?? ""; - message.stampPeriod = object.stampPeriod !== undefined && object.stampPeriod !== null ? Long.fromValue(object.stampPeriod) : Long.UZERO; - message.prunePeriod = object.prunePeriod !== undefined && object.prunePeriod !== null ? Long.fromValue(object.prunePeriod) : Long.UZERO; - message.medianPeriod = object.medianPeriod !== undefined && object.medianPeriod !== null ? Long.fromValue(object.medianPeriod) : Long.UZERO; + message.historicStampPeriod = object.historicStampPeriod !== undefined && object.historicStampPeriod !== null ? BigInt(object.historicStampPeriod.toString()) : BigInt(0); + message.medianStampPeriod = object.medianStampPeriod !== undefined && object.medianStampPeriod !== null ? BigInt(object.medianStampPeriod.toString()) : BigInt(0); + message.maximumPriceStamps = object.maximumPriceStamps !== undefined && object.maximumPriceStamps !== null ? BigInt(object.maximumPriceStamps.toString()) : BigInt(0); + message.maximumMedianStamps = object.maximumMedianStamps !== undefined && object.maximumMedianStamps !== null ? BigInt(object.maximumMedianStamps.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.vote_period !== undefined && object.vote_period !== null) { + message.votePeriod = BigInt(object.vote_period); + } + if (object.vote_threshold !== undefined && object.vote_threshold !== null) { + message.voteThreshold = object.vote_threshold; + } + if (object.reward_band !== undefined && object.reward_band !== null) { + message.rewardBand = object.reward_band; + } + if (object.reward_distribution_window !== undefined && object.reward_distribution_window !== null) { + message.rewardDistributionWindow = BigInt(object.reward_distribution_window); + } + message.acceptList = object.accept_list?.map(e => Denom.fromAmino(e)) || []; + if (object.slash_fraction !== undefined && object.slash_fraction !== null) { + message.slashFraction = object.slash_fraction; + } + if (object.slash_window !== undefined && object.slash_window !== null) { + message.slashWindow = BigInt(object.slash_window); + } + if (object.min_valid_per_window !== undefined && object.min_valid_per_window !== null) { + message.minValidPerWindow = object.min_valid_per_window; + } + if (object.historic_stamp_period !== undefined && object.historic_stamp_period !== null) { + message.historicStampPeriod = BigInt(object.historic_stamp_period); + } + if (object.median_stamp_period !== undefined && object.median_stamp_period !== null) { + message.medianStampPeriod = BigInt(object.median_stamp_period); + } + if (object.maximum_price_stamps !== undefined && object.maximum_price_stamps !== null) { + message.maximumPriceStamps = BigInt(object.maximum_price_stamps); + } + if (object.maximum_median_stamps !== undefined && object.maximum_median_stamps !== null) { + message.maximumMedianStamps = BigInt(object.maximum_median_stamps); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.vote_period = message.votePeriod ? message.votePeriod.toString() : undefined; + obj.vote_threshold = message.voteThreshold; + obj.reward_band = message.rewardBand; + obj.reward_distribution_window = message.rewardDistributionWindow ? message.rewardDistributionWindow.toString() : undefined; + if (message.acceptList) { + obj.accept_list = message.acceptList.map(e => e ? Denom.toAmino(e) : undefined); + } else { + obj.accept_list = []; + } + obj.slash_fraction = message.slashFraction; + obj.slash_window = message.slashWindow ? message.slashWindow.toString() : undefined; + obj.min_valid_per_window = message.minValidPerWindow; + obj.historic_stamp_period = message.historicStampPeriod ? message.historicStampPeriod.toString() : undefined; + obj.median_stamp_period = message.medianStampPeriod ? message.medianStampPeriod.toString() : undefined; + obj.maximum_price_stamps = message.maximumPriceStamps ? message.maximumPriceStamps.toString() : undefined; + obj.maximum_median_stamps = message.maximumMedianStamps ? message.maximumMedianStamps.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/umee.oracle.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +function createBaseAvgCounterParams(): AvgCounterParams { + return { + avgPeriod: Duration.fromPartial({}), + avgShift: Duration.fromPartial({}) + }; +} +export const AvgCounterParams = { + typeUrl: "/umee.oracle.v1.AvgCounterParams", + encode(message: AvgCounterParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.avgPeriod !== undefined) { + Duration.encode(message.avgPeriod, writer.uint32(10).fork()).ldelim(); + } + if (message.avgShift !== undefined) { + Duration.encode(message.avgShift, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AvgCounterParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAvgCounterParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.avgPeriod = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.avgShift = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): AvgCounterParams { + const message = createBaseAvgCounterParams(); + message.avgPeriod = object.avgPeriod !== undefined && object.avgPeriod !== null ? Duration.fromPartial(object.avgPeriod) : undefined; + message.avgShift = object.avgShift !== undefined && object.avgShift !== null ? Duration.fromPartial(object.avgShift) : undefined; + return message; + }, + fromAmino(object: AvgCounterParamsAmino): AvgCounterParams { + const message = createBaseAvgCounterParams(); + if (object.avg_period !== undefined && object.avg_period !== null) { + message.avgPeriod = Duration.fromAmino(object.avg_period); + } + if (object.avg_shift !== undefined && object.avg_shift !== null) { + message.avgShift = Duration.fromAmino(object.avg_shift); + } return message; + }, + toAmino(message: AvgCounterParams): AvgCounterParamsAmino { + const obj: any = {}; + obj.avg_period = message.avgPeriod ? Duration.toAmino(message.avgPeriod) : undefined; + obj.avg_shift = message.avgShift ? Duration.toAmino(message.avgShift) : undefined; + return obj; + }, + fromAminoMsg(object: AvgCounterParamsAminoMsg): AvgCounterParams { + return AvgCounterParams.fromAmino(object.value); + }, + fromProtoMsg(message: AvgCounterParamsProtoMsg): AvgCounterParams { + return AvgCounterParams.decode(message.value); + }, + toProto(message: AvgCounterParams): Uint8Array { + return AvgCounterParams.encode(message).finish(); + }, + toProtoMsg(message: AvgCounterParams): AvgCounterParamsProtoMsg { + return { + typeUrl: "/umee.oracle.v1.AvgCounterParams", + value: AvgCounterParams.encode(message).finish() + }; } - }; - function createBaseDenom(): Denom { return { baseDenom: "", @@ -297,290 +588,496 @@ function createBaseDenom(): Denom { exponent: 0 }; } - export const Denom = { - encode(message: Denom, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.Denom", + encode(message: Denom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseDenom !== "") { writer.uint32(10).string(message.baseDenom); } - if (message.symbolDenom !== "") { writer.uint32(18).string(message.symbolDenom); } - if (message.exponent !== 0) { writer.uint32(24).uint32(message.exponent); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Denom { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): Denom { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDenom(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.baseDenom = reader.string(); break; - case 2: message.symbolDenom = reader.string(); break; - case 3: message.exponent = reader.uint32(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): Denom { + fromPartial(object: Partial): Denom { const message = createBaseDenom(); message.baseDenom = object.baseDenom ?? ""; message.symbolDenom = object.symbolDenom ?? ""; message.exponent = object.exponent ?? 0; return message; + }, + fromAmino(object: DenomAmino): Denom { + const message = createBaseDenom(); + if (object.base_denom !== undefined && object.base_denom !== null) { + message.baseDenom = object.base_denom; + } + if (object.symbol_denom !== undefined && object.symbol_denom !== null) { + message.symbolDenom = object.symbol_denom; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + return message; + }, + toAmino(message: Denom): DenomAmino { + const obj: any = {}; + obj.base_denom = message.baseDenom; + obj.symbol_denom = message.symbolDenom; + obj.exponent = message.exponent; + return obj; + }, + fromAminoMsg(object: DenomAminoMsg): Denom { + return Denom.fromAmino(object.value); + }, + fromProtoMsg(message: DenomProtoMsg): Denom { + return Denom.decode(message.value); + }, + toProto(message: Denom): Uint8Array { + return Denom.encode(message).finish(); + }, + toProtoMsg(message: Denom): DenomProtoMsg { + return { + typeUrl: "/umee.oracle.v1.Denom", + value: Denom.encode(message).finish() + }; } - }; - function createBaseAggregateExchangeRatePrevote(): AggregateExchangeRatePrevote { return { hash: "", voter: "", - submitBlock: Long.UZERO + submitBlock: BigInt(0) }; } - export const AggregateExchangeRatePrevote = { - encode(message: AggregateExchangeRatePrevote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.AggregateExchangeRatePrevote", + encode(message: AggregateExchangeRatePrevote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== "") { writer.uint32(10).string(message.hash); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - - if (!message.submitBlock.isZero()) { + if (message.submitBlock !== BigInt(0)) { writer.uint32(24).uint64(message.submitBlock); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AggregateExchangeRatePrevote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AggregateExchangeRatePrevote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAggregateExchangeRatePrevote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = reader.string(); break; - case 2: message.voter = reader.string(); break; - case 3: - message.submitBlock = (reader.uint64() as Long); + message.submitBlock = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AggregateExchangeRatePrevote { + fromPartial(object: Partial): AggregateExchangeRatePrevote { const message = createBaseAggregateExchangeRatePrevote(); message.hash = object.hash ?? ""; message.voter = object.voter ?? ""; - message.submitBlock = object.submitBlock !== undefined && object.submitBlock !== null ? Long.fromValue(object.submitBlock) : Long.UZERO; + message.submitBlock = object.submitBlock !== undefined && object.submitBlock !== null ? BigInt(object.submitBlock.toString()) : BigInt(0); return message; + }, + fromAmino(object: AggregateExchangeRatePrevoteAmino): AggregateExchangeRatePrevote { + const message = createBaseAggregateExchangeRatePrevote(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.submit_block !== undefined && object.submit_block !== null) { + message.submitBlock = BigInt(object.submit_block); + } + return message; + }, + toAmino(message: AggregateExchangeRatePrevote): AggregateExchangeRatePrevoteAmino { + const obj: any = {}; + obj.hash = message.hash; + obj.voter = message.voter; + obj.submit_block = message.submitBlock ? message.submitBlock.toString() : undefined; + return obj; + }, + fromAminoMsg(object: AggregateExchangeRatePrevoteAminoMsg): AggregateExchangeRatePrevote { + return AggregateExchangeRatePrevote.fromAmino(object.value); + }, + fromProtoMsg(message: AggregateExchangeRatePrevoteProtoMsg): AggregateExchangeRatePrevote { + return AggregateExchangeRatePrevote.decode(message.value); + }, + toProto(message: AggregateExchangeRatePrevote): Uint8Array { + return AggregateExchangeRatePrevote.encode(message).finish(); + }, + toProtoMsg(message: AggregateExchangeRatePrevote): AggregateExchangeRatePrevoteProtoMsg { + return { + typeUrl: "/umee.oracle.v1.AggregateExchangeRatePrevote", + value: AggregateExchangeRatePrevote.encode(message).finish() + }; } - }; - function createBaseAggregateExchangeRateVote(): AggregateExchangeRateVote { return { exchangeRateTuples: [], voter: "" }; } - export const AggregateExchangeRateVote = { - encode(message: AggregateExchangeRateVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.AggregateExchangeRateVote", + encode(message: AggregateExchangeRateVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.exchangeRateTuples) { ExchangeRateTuple.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.voter !== "") { writer.uint32(18).string(message.voter); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AggregateExchangeRateVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): AggregateExchangeRateVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAggregateExchangeRateVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.exchangeRateTuples.push(ExchangeRateTuple.decode(reader, reader.uint32())); break; - case 2: message.voter = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): AggregateExchangeRateVote { + fromPartial(object: Partial): AggregateExchangeRateVote { const message = createBaseAggregateExchangeRateVote(); message.exchangeRateTuples = object.exchangeRateTuples?.map(e => ExchangeRateTuple.fromPartial(e)) || []; message.voter = object.voter ?? ""; return message; + }, + fromAmino(object: AggregateExchangeRateVoteAmino): AggregateExchangeRateVote { + const message = createBaseAggregateExchangeRateVote(); + message.exchangeRateTuples = object.exchange_rate_tuples?.map(e => ExchangeRateTuple.fromAmino(e)) || []; + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + return message; + }, + toAmino(message: AggregateExchangeRateVote): AggregateExchangeRateVoteAmino { + const obj: any = {}; + if (message.exchangeRateTuples) { + obj.exchange_rate_tuples = message.exchangeRateTuples.map(e => e ? ExchangeRateTuple.toAmino(e) : undefined); + } else { + obj.exchange_rate_tuples = []; + } + obj.voter = message.voter; + return obj; + }, + fromAminoMsg(object: AggregateExchangeRateVoteAminoMsg): AggregateExchangeRateVote { + return AggregateExchangeRateVote.fromAmino(object.value); + }, + fromProtoMsg(message: AggregateExchangeRateVoteProtoMsg): AggregateExchangeRateVote { + return AggregateExchangeRateVote.decode(message.value); + }, + toProto(message: AggregateExchangeRateVote): Uint8Array { + return AggregateExchangeRateVote.encode(message).finish(); + }, + toProtoMsg(message: AggregateExchangeRateVote): AggregateExchangeRateVoteProtoMsg { + return { + typeUrl: "/umee.oracle.v1.AggregateExchangeRateVote", + value: AggregateExchangeRateVote.encode(message).finish() + }; } - }; - function createBaseExchangeRateTuple(): ExchangeRateTuple { return { denom: "", exchangeRate: "" }; } - export const ExchangeRateTuple = { - encode(message: ExchangeRateTuple, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.ExchangeRateTuple", + encode(message: ExchangeRateTuple, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.exchangeRate !== "") { - writer.uint32(18).string(message.exchangeRate); + writer.uint32(18).string(Decimal.fromUserInput(message.exchangeRate, 18).atomics); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ExchangeRateTuple { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ExchangeRateTuple { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseExchangeRateTuple(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - case 2: - message.exchangeRate = reader.string(); + message.exchangeRate = Decimal.fromAtomics(reader.string(), 18).toString(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): ExchangeRateTuple { + fromPartial(object: Partial): ExchangeRateTuple { const message = createBaseExchangeRateTuple(); message.denom = object.denom ?? ""; message.exchangeRate = object.exchangeRate ?? ""; return message; + }, + fromAmino(object: ExchangeRateTupleAmino): ExchangeRateTuple { + const message = createBaseExchangeRateTuple(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.exchange_rate !== undefined && object.exchange_rate !== null) { + message.exchangeRate = object.exchange_rate; + } + return message; + }, + toAmino(message: ExchangeRateTuple): ExchangeRateTupleAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.exchange_rate = message.exchangeRate; + return obj; + }, + fromAminoMsg(object: ExchangeRateTupleAminoMsg): ExchangeRateTuple { + return ExchangeRateTuple.fromAmino(object.value); + }, + fromProtoMsg(message: ExchangeRateTupleProtoMsg): ExchangeRateTuple { + return ExchangeRateTuple.decode(message.value); + }, + toProto(message: ExchangeRateTuple): Uint8Array { + return ExchangeRateTuple.encode(message).finish(); + }, + toProtoMsg(message: ExchangeRateTuple): ExchangeRateTupleProtoMsg { + return { + typeUrl: "/umee.oracle.v1.ExchangeRateTuple", + value: ExchangeRateTuple.encode(message).finish() + }; + } +}; +function createBaseAvgCounter(): AvgCounter { + return { + sum: "", + num: 0, + start: new Date() + }; +} +export const AvgCounter = { + typeUrl: "/umee.oracle.v1.AvgCounter", + encode(message: AvgCounter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sum !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.sum, 18).atomics); + } + if (message.num !== 0) { + writer.uint32(16).uint32(message.num); + } + if (message.start !== undefined) { + Timestamp.encode(toTimestamp(message.start), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AvgCounter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAvgCounter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sum = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 2: + message.num = reader.uint32(); + break; + case 3: + message.start = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): AvgCounter { + const message = createBaseAvgCounter(); + message.sum = object.sum ?? ""; + message.num = object.num ?? 0; + message.start = object.start ?? undefined; + return message; + }, + fromAmino(object: AvgCounterAmino): AvgCounter { + const message = createBaseAvgCounter(); + if (object.sum !== undefined && object.sum !== null) { + message.sum = object.sum; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.start !== undefined && object.start !== null) { + message.start = fromTimestamp(Timestamp.fromAmino(object.start)); + } + return message; + }, + toAmino(message: AvgCounter): AvgCounterAmino { + const obj: any = {}; + obj.sum = message.sum; + obj.num = message.num; + obj.start = message.start ? Timestamp.toAmino(toTimestamp(message.start)) : undefined; + return obj; + }, + fromAminoMsg(object: AvgCounterAminoMsg): AvgCounter { + return AvgCounter.fromAmino(object.value); + }, + fromProtoMsg(message: AvgCounterProtoMsg): AvgCounter { + return AvgCounter.decode(message.value); + }, + toProto(message: AvgCounter): Uint8Array { + return AvgCounter.encode(message).finish(); + }, + toProtoMsg(message: AvgCounter): AvgCounterProtoMsg { + return { + typeUrl: "/umee.oracle.v1.AvgCounter", + value: AvgCounter.encode(message).finish() + }; } - }; - -function createBaseHistoricPrice(): HistoricPrice { +function createBaseDenomExchangeRate(): DenomExchangeRate { return { - exchangeRate: undefined, - blockNum: Long.UZERO + denom: "", + rate: "", + timestamp: new Date() }; } - -export const HistoricPrice = { - encode(message: HistoricPrice, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.exchangeRate !== undefined) { - ExchangeRateTuple.encode(message.exchangeRate, writer.uint32(10).fork()).ldelim(); +export const DenomExchangeRate = { + typeUrl: "/umee.oracle.v1.DenomExchangeRate", + encode(message: DenomExchangeRate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.rate !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.rate, 18).atomics); } - - if (!message.blockNum.isZero()) { - writer.uint32(16).uint64(message.blockNum); + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): HistoricPrice { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): DenomExchangeRate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHistoricPrice(); - + const message = createBaseDenomExchangeRate(); while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.exchangeRate = ExchangeRateTuple.decode(reader, reader.uint32()); + message.denom = reader.string(); break; - case 2: - message.blockNum = (reader.uint64() as Long); + message.rate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): HistoricPrice { - const message = createBaseHistoricPrice(); - message.exchangeRate = object.exchangeRate !== undefined && object.exchangeRate !== null ? ExchangeRateTuple.fromPartial(object.exchangeRate) : undefined; - message.blockNum = object.blockNum !== undefined && object.blockNum !== null ? Long.fromValue(object.blockNum) : Long.UZERO; + fromPartial(object: Partial): DenomExchangeRate { + const message = createBaseDenomExchangeRate(); + message.denom = object.denom ?? ""; + message.rate = object.rate ?? ""; + message.timestamp = object.timestamp ?? undefined; return message; + }, + fromAmino(object: DenomExchangeRateAmino): DenomExchangeRate { + const message = createBaseDenomExchangeRate(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.rate !== undefined && object.rate !== null) { + message.rate = object.rate; + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + return message; + }, + toAmino(message: DenomExchangeRate): DenomExchangeRateAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.rate = message.rate; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + return obj; + }, + fromAminoMsg(object: DenomExchangeRateAminoMsg): DenomExchangeRate { + return DenomExchangeRate.fromAmino(object.value); + }, + fromProtoMsg(message: DenomExchangeRateProtoMsg): DenomExchangeRate { + return DenomExchangeRate.decode(message.value); + }, + toProto(message: DenomExchangeRate): Uint8Array { + return DenomExchangeRate.encode(message).finish(); + }, + toProtoMsg(message: DenomExchangeRate): DenomExchangeRateProtoMsg { + return { + typeUrl: "/umee.oracle.v1.DenomExchangeRate", + value: DenomExchangeRate.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/query.lcd.ts b/src/codegen/umee/oracle/v1/query.lcd.ts index 5ec2986..1c02626 100644 --- a/src/codegen/umee/oracle/v1/query.lcd.ts +++ b/src/codegen/umee/oracle/v1/query.lcd.ts @@ -1,8 +1,7 @@ -import { LCDClient } from "@osmonauts/lcd"; -import { QueryExchangeRates, QueryExchangeRatesResponseSDKType, QueryActiveExchangeRates, QueryActiveExchangeRatesResponseSDKType, QueryFeederDelegation, QueryFeederDelegationResponseSDKType, QueryMissCounter, QueryMissCounterResponseSDKType, QuerySlashWindow, QuerySlashWindowResponseSDKType, QueryAggregatePrevote, QueryAggregatePrevoteResponseSDKType, QueryAggregatePrevotes, QueryAggregatePrevotesResponseSDKType, QueryAggregateVote, QueryAggregateVoteResponseSDKType, QueryAggregateVotes, QueryAggregateVotesResponseSDKType, QueryParams, QueryParamsResponseSDKType, QueryMedians, QueryMediansResponseSDKType } from "./query"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryExchangeRates, QueryExchangeRatesResponseSDKType, QueryActiveExchangeRates, QueryActiveExchangeRatesResponseSDKType, QueryFeederDelegation, QueryFeederDelegationResponseSDKType, QueryMissCounter, QueryMissCounterResponseSDKType, QuerySlashWindow, QuerySlashWindowResponseSDKType, QueryAggregatePrevote, QueryAggregatePrevoteResponseSDKType, QueryAggregatePrevotes, QueryAggregatePrevotesResponseSDKType, QueryAggregateVote, QueryAggregateVoteResponseSDKType, QueryAggregateVotes, QueryAggregateVotesResponseSDKType, QueryParams, QueryParamsResponseSDKType, QueryMedians, QueryMediansResponseSDKType, QueryMedianDeviations, QueryMedianDeviationsResponseSDKType, QueryAvgPrice, QueryAvgPriceResponseSDKType, QueryExgRatesWithTimestamp, QueryExgRatesWithTimestampResponseSDKType, QueryMissCounters, QueryMissCountersResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; - constructor({ requestClient }: { @@ -20,92 +19,115 @@ export class LCDQueryClient { this.aggregateVotes = this.aggregateVotes.bind(this); this.params = this.params.bind(this); this.medians = this.medians.bind(this); + this.medianDeviations = this.medianDeviations.bind(this); + this.avgPrice = this.avgPrice.bind(this); + this.exgRatesWithTimestamp = this.exgRatesWithTimestamp.bind(this); + this.missCounters = this.missCounters.bind(this); } /* ExchangeRates returns exchange rates of all denoms, or, if specified, returns a single denom */ - - async exchangeRates(params: QueryExchangeRates): Promise { const endpoint = `umee/oracle/v1/denoms/exchange_rates/${params.denom}`; return await this.req.get(endpoint); } /* ActiveExchangeRates returns all active denoms */ - - async activeExchangeRates(_params: QueryActiveExchangeRates = {}): Promise { const endpoint = `umee/oracle/v1/denoms/active_exchange_rates`; return await this.req.get(endpoint); } /* FeederDelegation returns feeder delegation of a validator */ - - async feederDelegation(params: QueryFeederDelegation): Promise { const endpoint = `umee/oracle/v1/validators/${params.validatorAddr}/feeder`; return await this.req.get(endpoint); } /* MissCounter returns oracle miss counter of a validator */ - - async missCounter(params: QueryMissCounter): Promise { const endpoint = `umee/oracle/v1/validators/${params.validatorAddr}/miss`; return await this.req.get(endpoint); } /* SlashWindow returns slash window information */ - - async slashWindow(_params: QuerySlashWindow = {}): Promise { const endpoint = `umee/oracle/v1/slash_window`; return await this.req.get(endpoint); } /* AggregatePrevote returns an aggregate prevote of a validator */ - - async aggregatePrevote(params: QueryAggregatePrevote): Promise { const endpoint = `umee/oracle/v1/validators/${params.validatorAddr}/aggregate_prevote`; return await this.req.get(endpoint); } /* AggregatePrevotes returns aggregate prevotes of all validators */ - - async aggregatePrevotes(_params: QueryAggregatePrevotes = {}): Promise { const endpoint = `umee/oracle/v1/validators/aggregate_prevotes`; return await this.req.get(endpoint); } /* AggregateVote returns an aggregate vote of a validator */ - - async aggregateVote(params: QueryAggregateVote): Promise { - const endpoint = `umee/oracle/v1/valdiators/${params.validatorAddr}/aggregate_vote`; + const endpoint = `umee/oracle/v1/validators/${params.validatorAddr}/aggregate_vote`; return await this.req.get(endpoint); } /* AggregateVotes returns aggregate votes of all validators */ - - async aggregateVotes(_params: QueryAggregateVotes = {}): Promise { const endpoint = `umee/oracle/v1/validators/aggregate_votes`; return await this.req.get(endpoint); } /* Params queries all parameters. */ - - async params(_params: QueryParams = {}): Promise { const endpoint = `umee/oracle/v1/params`; return await this.req.get(endpoint); } - /* Medians returns medians of all denoms */ - - + /* Medians returns medians of all denoms, + or, if specified, returns a single median */ async medians(params: QueryMedians): Promise { const options: any = { params: {} }; - if (typeof params?.denom !== "undefined") { options.params.denom = params.denom; } - + if (typeof params?.numStamps !== "undefined") { + options.params.numStamps = params.numStamps; + } const endpoint = `umee/historacle/v1/denoms/medians`; return await this.req.get(endpoint, options); } - + /* MedianDeviations returns median deviations of all denoms, + or, if specified, returns a single median deviation */ + async medianDeviations(params: QueryMedianDeviations): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/historacle/v1/denoms/median_deviations`; + return await this.req.get(endpoint, options); + } + /* QueryAvgPrice returns avg price of a given denom (required). */ + async avgPrice(params: QueryAvgPrice): Promise { + const endpoint = `umee/historacle/v1/avg_price/${params.denom}`; + return await this.req.get(endpoint); + } + /* ExgRatesWithTimestamp returns exchange rates of all denoms with timestamp, + or, if specified, returns a single denom */ + async exgRatesWithTimestamp(params: QueryExgRatesWithTimestamp): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/oracle/v1/denoms/exg_rates_timestamp`; + return await this.req.get(endpoint, options); + } + /* MissCounters returns oracle missing votes count of validators. */ + async missCounters(params: QueryMissCounters): Promise { + const options: any = { + params: {} + }; + if (typeof params?.validator !== "undefined") { + options.params.validator = params.validator; + } + const endpoint = `umee/oracle/v1/miss_counters`; + return await this.req.get(endpoint, options); + } } \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/query.rpc.Query.ts b/src/codegen/umee/oracle/v1/query.rpc.Query.ts index 83a4e86..2398772 100644 --- a/src/codegen/umee/oracle/v1/query.rpc.Query.ts +++ b/src/codegen/umee/oracle/v1/query.rpc.Query.ts @@ -1,9 +1,8 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryExchangeRates, QueryExchangeRatesResponse, QueryActiveExchangeRates, QueryActiveExchangeRatesResponse, QueryFeederDelegation, QueryFeederDelegationResponse, QueryMissCounter, QueryMissCounterResponse, QuerySlashWindow, QuerySlashWindowResponse, QueryAggregatePrevote, QueryAggregatePrevoteResponse, QueryAggregatePrevotes, QueryAggregatePrevotesResponse, QueryAggregateVote, QueryAggregateVoteResponse, QueryAggregateVotes, QueryAggregateVotesResponse, QueryParams, QueryParamsResponse, QueryMedians, QueryMediansResponse } from "./query"; +import { QueryExchangeRates, QueryExchangeRatesResponse, QueryActiveExchangeRates, QueryActiveExchangeRatesResponse, QueryFeederDelegation, QueryFeederDelegationResponse, QueryMissCounter, QueryMissCounterResponse, QuerySlashWindow, QuerySlashWindowResponse, QueryAggregatePrevote, QueryAggregatePrevoteResponse, QueryAggregatePrevotes, QueryAggregatePrevotesResponse, QueryAggregateVote, QueryAggregateVoteResponse, QueryAggregateVotes, QueryAggregateVotesResponse, QueryParams, QueryParamsResponse, QueryMedians, QueryMediansResponse, QueryMedianDeviations, QueryMedianDeviationsResponse, QueryAvgPrice, QueryAvgPriceResponse, QueryExgRatesWithTimestamp, QueryExgRatesWithTimestampResponse, QueryMissCounters, QueryMissCountersResponse } from "./query"; /** Query defines the gRPC querier service. */ - export interface Query { /** * ExchangeRates returns exchange rates of all denoms, @@ -11,39 +10,45 @@ export interface Query { */ exchangeRates(request: QueryExchangeRates): Promise; /** ActiveExchangeRates returns all active denoms */ - activeExchangeRates(request?: QueryActiveExchangeRates): Promise; /** FeederDelegation returns feeder delegation of a validator */ - feederDelegation(request: QueryFeederDelegation): Promise; /** MissCounter returns oracle miss counter of a validator */ - missCounter(request: QueryMissCounter): Promise; /** SlashWindow returns slash window information */ - slashWindow(request?: QuerySlashWindow): Promise; /** AggregatePrevote returns an aggregate prevote of a validator */ - aggregatePrevote(request: QueryAggregatePrevote): Promise; /** AggregatePrevotes returns aggregate prevotes of all validators */ - aggregatePrevotes(request?: QueryAggregatePrevotes): Promise; /** AggregateVote returns an aggregate vote of a validator */ - aggregateVote(request: QueryAggregateVote): Promise; /** AggregateVotes returns aggregate votes of all validators */ - aggregateVotes(request?: QueryAggregateVotes): Promise; /** Params queries all parameters. */ - params(request?: QueryParams): Promise; - /** Medians returns medians of all denoms */ - + /** + * Medians returns medians of all denoms, + * or, if specified, returns a single median + */ medians(request: QueryMedians): Promise; + /** + * MedianDeviations returns median deviations of all denoms, + * or, if specified, returns a single median deviation + */ + medianDeviations(request: QueryMedianDeviations): Promise; + /** QueryAvgPrice returns avg price of a given denom (required). */ + avgPrice(request: QueryAvgPrice): Promise; + /** + * ExgRatesWithTimestamp returns exchange rates of all denoms with timestamp, + * or, if specified, returns a single denom + */ + exgRatesWithTimestamp(request: QueryExgRatesWithTimestamp): Promise; + /** MissCounters returns oracle missing votes count of validators. */ + missCounters(request: QueryMissCounters): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.exchangeRates = this.exchangeRates.bind(this); @@ -57,74 +62,86 @@ export class QueryClientImpl implements Query { this.aggregateVotes = this.aggregateVotes.bind(this); this.params = this.params.bind(this); this.medians = this.medians.bind(this); + this.medianDeviations = this.medianDeviations.bind(this); + this.avgPrice = this.avgPrice.bind(this); + this.exgRatesWithTimestamp = this.exgRatesWithTimestamp.bind(this); + this.missCounters = this.missCounters.bind(this); } - exchangeRates(request: QueryExchangeRates): Promise { const data = QueryExchangeRates.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "ExchangeRates", data); - return promise.then(data => QueryExchangeRatesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryExchangeRatesResponse.decode(new BinaryReader(data))); } - activeExchangeRates(request: QueryActiveExchangeRates = {}): Promise { const data = QueryActiveExchangeRates.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "ActiveExchangeRates", data); - return promise.then(data => QueryActiveExchangeRatesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryActiveExchangeRatesResponse.decode(new BinaryReader(data))); } - feederDelegation(request: QueryFeederDelegation): Promise { const data = QueryFeederDelegation.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "FeederDelegation", data); - return promise.then(data => QueryFeederDelegationResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryFeederDelegationResponse.decode(new BinaryReader(data))); } - missCounter(request: QueryMissCounter): Promise { const data = QueryMissCounter.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "MissCounter", data); - return promise.then(data => QueryMissCounterResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryMissCounterResponse.decode(new BinaryReader(data))); } - slashWindow(request: QuerySlashWindow = {}): Promise { const data = QuerySlashWindow.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "SlashWindow", data); - return promise.then(data => QuerySlashWindowResponse.decode(new _m0.Reader(data))); + return promise.then(data => QuerySlashWindowResponse.decode(new BinaryReader(data))); } - aggregatePrevote(request: QueryAggregatePrevote): Promise { const data = QueryAggregatePrevote.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "AggregatePrevote", data); - return promise.then(data => QueryAggregatePrevoteResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAggregatePrevoteResponse.decode(new BinaryReader(data))); } - aggregatePrevotes(request: QueryAggregatePrevotes = {}): Promise { const data = QueryAggregatePrevotes.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "AggregatePrevotes", data); - return promise.then(data => QueryAggregatePrevotesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAggregatePrevotesResponse.decode(new BinaryReader(data))); } - aggregateVote(request: QueryAggregateVote): Promise { const data = QueryAggregateVote.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "AggregateVote", data); - return promise.then(data => QueryAggregateVoteResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAggregateVoteResponse.decode(new BinaryReader(data))); } - aggregateVotes(request: QueryAggregateVotes = {}): Promise { const data = QueryAggregateVotes.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "AggregateVotes", data); - return promise.then(data => QueryAggregateVotesResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryAggregateVotesResponse.decode(new BinaryReader(data))); } - params(request: QueryParams = {}): Promise { const data = QueryParams.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "Params", data); - return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } - medians(request: QueryMedians): Promise { const data = QueryMedians.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Query", "Medians", data); - return promise.then(data => QueryMediansResponse.decode(new _m0.Reader(data))); + return promise.then(data => QueryMediansResponse.decode(new BinaryReader(data))); + } + medianDeviations(request: QueryMedianDeviations): Promise { + const data = QueryMedianDeviations.encode(request).finish(); + const promise = this.rpc.request("umee.oracle.v1.Query", "MedianDeviations", data); + return promise.then(data => QueryMedianDeviationsResponse.decode(new BinaryReader(data))); + } + avgPrice(request: QueryAvgPrice): Promise { + const data = QueryAvgPrice.encode(request).finish(); + const promise = this.rpc.request("umee.oracle.v1.Query", "AvgPrice", data); + return promise.then(data => QueryAvgPriceResponse.decode(new BinaryReader(data))); + } + exgRatesWithTimestamp(request: QueryExgRatesWithTimestamp): Promise { + const data = QueryExgRatesWithTimestamp.encode(request).finish(); + const promise = this.rpc.request("umee.oracle.v1.Query", "ExgRatesWithTimestamp", data); + return promise.then(data => QueryExgRatesWithTimestampResponse.decode(new BinaryReader(data))); + } + missCounters(request: QueryMissCounters): Promise { + const data = QueryMissCounters.encode(request).finish(); + const promise = this.rpc.request("umee.oracle.v1.Query", "MissCounters", data); + return promise.then(data => QueryMissCountersResponse.decode(new BinaryReader(data))); } - } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -133,46 +150,47 @@ export const createRpcQueryExtension = (base: QueryClient) => { exchangeRates(request: QueryExchangeRates): Promise { return queryService.exchangeRates(request); }, - activeExchangeRates(request?: QueryActiveExchangeRates): Promise { return queryService.activeExchangeRates(request); }, - feederDelegation(request: QueryFeederDelegation): Promise { return queryService.feederDelegation(request); }, - missCounter(request: QueryMissCounter): Promise { return queryService.missCounter(request); }, - slashWindow(request?: QuerySlashWindow): Promise { return queryService.slashWindow(request); }, - aggregatePrevote(request: QueryAggregatePrevote): Promise { return queryService.aggregatePrevote(request); }, - aggregatePrevotes(request?: QueryAggregatePrevotes): Promise { return queryService.aggregatePrevotes(request); }, - aggregateVote(request: QueryAggregateVote): Promise { return queryService.aggregateVote(request); }, - aggregateVotes(request?: QueryAggregateVotes): Promise { return queryService.aggregateVotes(request); }, - params(request?: QueryParams): Promise { return queryService.params(request); }, - medians(request: QueryMedians): Promise { return queryService.medians(request); + }, + medianDeviations(request: QueryMedianDeviations): Promise { + return queryService.medianDeviations(request); + }, + avgPrice(request: QueryAvgPrice): Promise { + return queryService.avgPrice(request); + }, + exgRatesWithTimestamp(request: QueryExgRatesWithTimestamp): Promise { + return queryService.exgRatesWithTimestamp(request); + }, + missCounters(request: QueryMissCounters): Promise { + return queryService.missCounters(request); } - }; }; \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/query.ts b/src/codegen/umee/oracle/v1/query.ts index 7eb69b8..6ae20ec 100644 --- a/src/codegen/umee/oracle/v1/query.ts +++ b/src/codegen/umee/oracle/v1/query.ts @@ -1,30 +1,185 @@ -import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { AggregateExchangeRatePrevote, AggregateExchangeRatePrevoteSDKType, AggregateExchangeRateVote, AggregateExchangeRateVoteSDKType, Params, ParamsSDKType } from "./oracle"; -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial, Long } from "../../../helpers"; +import { DenomExchangeRate, DenomExchangeRateAmino, DenomExchangeRateSDKType, AggregateExchangeRatePrevote, AggregateExchangeRatePrevoteAmino, AggregateExchangeRatePrevoteSDKType, AggregateExchangeRateVote, AggregateExchangeRateVoteAmino, AggregateExchangeRateVoteSDKType, Params, ParamsAmino, ParamsSDKType } from "./oracle"; +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Price, PriceAmino, PriceSDKType } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +/** + * QueryMissCounters is the request type for the Query/MissCounters RPC + * method. + */ +export interface QueryMissCounters { + validator: string; +} +export interface QueryMissCountersProtoMsg { + typeUrl: "/umee.oracle.v1.QueryMissCounters"; + value: Uint8Array; +} +/** + * QueryMissCounters is the request type for the Query/MissCounters RPC + * method. + */ +export interface QueryMissCountersAmino { + validator?: string; +} +export interface QueryMissCountersAminoMsg { + type: "/umee.oracle.v1.QueryMissCounters"; + value: QueryMissCountersAmino; +} +/** + * QueryMissCounters is the request type for the Query/MissCounters RPC + * method. + */ +export interface QueryMissCountersSDKType { + validator: string; +} +/** QueryMissCountersResponse is response type for the Query/MissCounters RPC method. */ +export interface QueryMissCountersResponse { + missCounters: PriceMissCounter[]; +} +export interface QueryMissCountersResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryMissCountersResponse"; + value: Uint8Array; +} +/** QueryMissCountersResponse is response type for the Query/MissCounters RPC method. */ +export interface QueryMissCountersResponseAmino { + miss_counters?: PriceMissCounterAmino[]; +} +export interface QueryMissCountersResponseAminoMsg { + type: "/umee.oracle.v1.QueryMissCountersResponse"; + value: QueryMissCountersResponseAmino; +} +/** QueryMissCountersResponse is response type for the Query/MissCounters RPC method. */ +export interface QueryMissCountersResponseSDKType { + miss_counters: PriceMissCounterSDKType[]; +} +/** PriceMissCounter is the validator's oracle price votes missing count. */ +export interface PriceMissCounter { + validator: string; + /** miss_counter defines the oracle miss counter of a validator */ + missCounter: bigint; +} +export interface PriceMissCounterProtoMsg { + typeUrl: "/umee.oracle.v1.PriceMissCounter"; + value: Uint8Array; +} +/** PriceMissCounter is the validator's oracle price votes missing count. */ +export interface PriceMissCounterAmino { + validator?: string; + /** miss_counter defines the oracle miss counter of a validator */ + miss_counter?: string; +} +export interface PriceMissCounterAminoMsg { + type: "/umee.oracle.v1.PriceMissCounter"; + value: PriceMissCounterAmino; +} +/** PriceMissCounter is the validator's oracle price votes missing count. */ +export interface PriceMissCounterSDKType { + validator: string; + miss_counter: bigint; +} +/** + * QueryExgRatesWithTimestamp is the request type for the Query/ExchangeRatesWithTimestamp RPC + * method. + */ +export interface QueryExgRatesWithTimestamp { + /** denom defines the denomination to query for. */ + denom: string; +} +export interface QueryExgRatesWithTimestampProtoMsg { + typeUrl: "/umee.oracle.v1.QueryExgRatesWithTimestamp"; + value: Uint8Array; +} +/** + * QueryExgRatesWithTimestamp is the request type for the Query/ExchangeRatesWithTimestamp RPC + * method. + */ +export interface QueryExgRatesWithTimestampAmino { + /** denom defines the denomination to query for. */ + denom?: string; +} +export interface QueryExgRatesWithTimestampAminoMsg { + type: "/umee.oracle.v1.QueryExgRatesWithTimestamp"; + value: QueryExgRatesWithTimestampAmino; +} +/** + * QueryExgRatesWithTimestamp is the request type for the Query/ExchangeRatesWithTimestamp RPC + * method. + */ +export interface QueryExgRatesWithTimestampSDKType { + denom: string; +} +/** + * QueryExgRatesWithTimestampResponse is response type for the + * Query/ExchangeRatesWithTimestamp RPC method. + */ +export interface QueryExgRatesWithTimestampResponse { + /** + * exchange_rates defines a list of the exchange rate for all whitelisted + * denoms with timestamp + */ + exgRates: DenomExchangeRate[]; +} +export interface QueryExgRatesWithTimestampResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryExgRatesWithTimestampResponse"; + value: Uint8Array; +} +/** + * QueryExgRatesWithTimestampResponse is response type for the + * Query/ExchangeRatesWithTimestamp RPC method. + */ +export interface QueryExgRatesWithTimestampResponseAmino { + /** + * exchange_rates defines a list of the exchange rate for all whitelisted + * denoms with timestamp + */ + exg_rates?: DenomExchangeRateAmino[]; +} +export interface QueryExgRatesWithTimestampResponseAminoMsg { + type: "/umee.oracle.v1.QueryExgRatesWithTimestampResponse"; + value: QueryExgRatesWithTimestampResponseAmino; +} +/** + * QueryExgRatesWithTimestampResponse is response type for the + * Query/ExchangeRatesWithTimestamp RPC method. + */ +export interface QueryExgRatesWithTimestampResponseSDKType { + exg_rates: DenomExchangeRateSDKType[]; +} /** * QueryExchangeRates is the request type for the Query/ExchangeRate RPC * method. */ - export interface QueryExchangeRates { /** denom defines the denomination to query for. */ denom: string; } +export interface QueryExchangeRatesProtoMsg { + typeUrl: "/umee.oracle.v1.QueryExchangeRates"; + value: Uint8Array; +} /** * QueryExchangeRates is the request type for the Query/ExchangeRate RPC * method. */ - -export interface QueryExchangeRatesSDKType { +export interface QueryExchangeRatesAmino { /** denom defines the denomination to query for. */ + denom?: string; +} +export interface QueryExchangeRatesAminoMsg { + type: "/umee.oracle.v1.QueryExchangeRates"; + value: QueryExchangeRatesAmino; +} +/** + * QueryExchangeRates is the request type for the Query/ExchangeRate RPC + * method. + */ +export interface QueryExchangeRatesSDKType { denom: string; } /** * QueryExchangeRatesResponse is response type for the * Query/ExchangeRates RPC method. */ - export interface QueryExchangeRatesResponse { /** * exchange_rates defines a list of the exchange rate for all whitelisted @@ -32,221 +187,371 @@ export interface QueryExchangeRatesResponse { */ exchangeRates: DecCoin[]; } +export interface QueryExchangeRatesResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryExchangeRatesResponse"; + value: Uint8Array; +} /** * QueryExchangeRatesResponse is response type for the * Query/ExchangeRates RPC method. */ - -export interface QueryExchangeRatesResponseSDKType { +export interface QueryExchangeRatesResponseAmino { /** * exchange_rates defines a list of the exchange rate for all whitelisted * denoms. */ + exchange_rates?: DecCoinAmino[]; +} +export interface QueryExchangeRatesResponseAminoMsg { + type: "/umee.oracle.v1.QueryExchangeRatesResponse"; + value: QueryExchangeRatesResponseAmino; +} +/** + * QueryExchangeRatesResponse is response type for the + * Query/ExchangeRates RPC method. + */ +export interface QueryExchangeRatesResponseSDKType { exchange_rates: DecCoinSDKType[]; } /** * QueryActiveExchangeRates is the request type for the * Query/ActiveExchangeRates RPC method. */ - export interface QueryActiveExchangeRates {} +export interface QueryActiveExchangeRatesProtoMsg { + typeUrl: "/umee.oracle.v1.QueryActiveExchangeRates"; + value: Uint8Array; +} +/** + * QueryActiveExchangeRates is the request type for the + * Query/ActiveExchangeRates RPC method. + */ +export interface QueryActiveExchangeRatesAmino {} +export interface QueryActiveExchangeRatesAminoMsg { + type: "/umee.oracle.v1.QueryActiveExchangeRates"; + value: QueryActiveExchangeRatesAmino; +} /** * QueryActiveExchangeRates is the request type for the * Query/ActiveExchangeRates RPC method. */ - export interface QueryActiveExchangeRatesSDKType {} /** * QueryActiveExchangeRatesResponse is response type for the * Query/ActiveExchangeRates RPC method. */ - export interface QueryActiveExchangeRatesResponse { /** - * activeRates defines a list of the denomination which oracle prices aggreed + * activeRates defines a list of the denomination which oracle prices agreed * upon. */ activeRates: string[]; } +export interface QueryActiveExchangeRatesResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryActiveExchangeRatesResponse"; + value: Uint8Array; +} /** * QueryActiveExchangeRatesResponse is response type for the * Query/ActiveExchangeRates RPC method. */ - -export interface QueryActiveExchangeRatesResponseSDKType { +export interface QueryActiveExchangeRatesResponseAmino { /** - * activeRates defines a list of the denomination which oracle prices aggreed + * activeRates defines a list of the denomination which oracle prices agreed * upon. */ + active_rates?: string[]; +} +export interface QueryActiveExchangeRatesResponseAminoMsg { + type: "/umee.oracle.v1.QueryActiveExchangeRatesResponse"; + value: QueryActiveExchangeRatesResponseAmino; +} +/** + * QueryActiveExchangeRatesResponse is response type for the + * Query/ActiveExchangeRates RPC method. + */ +export interface QueryActiveExchangeRatesResponseSDKType { active_rates: string[]; } /** * QueryFeederDelegation is the request type for the * Query/FeederDelegation RPC method. */ - export interface QueryFeederDelegation { /** validator defines the validator address to query for. */ validatorAddr: string; } +export interface QueryFeederDelegationProtoMsg { + typeUrl: "/umee.oracle.v1.QueryFeederDelegation"; + value: Uint8Array; +} /** * QueryFeederDelegation is the request type for the * Query/FeederDelegation RPC method. */ - -export interface QueryFeederDelegationSDKType { +export interface QueryFeederDelegationAmino { /** validator defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryFeederDelegationAminoMsg { + type: "/umee.oracle.v1.QueryFeederDelegation"; + value: QueryFeederDelegationAmino; +} +/** + * QueryFeederDelegation is the request type for the + * Query/FeederDelegation RPC method. + */ +export interface QueryFeederDelegationSDKType { validator_addr: string; } /** * QueryFeederDelegationResponse is response type for the * Query/FeederDelegation RPC method. */ - export interface QueryFeederDelegationResponse { /** feeder_addr defines the feeder delegation of a validator */ feederAddr: string; } +export interface QueryFeederDelegationResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryFeederDelegationResponse"; + value: Uint8Array; +} /** * QueryFeederDelegationResponse is response type for the * Query/FeederDelegation RPC method. */ - -export interface QueryFeederDelegationResponseSDKType { +export interface QueryFeederDelegationResponseAmino { /** feeder_addr defines the feeder delegation of a validator */ + feeder_addr?: string; +} +export interface QueryFeederDelegationResponseAminoMsg { + type: "/umee.oracle.v1.QueryFeederDelegationResponse"; + value: QueryFeederDelegationResponseAmino; +} +/** + * QueryFeederDelegationResponse is response type for the + * Query/FeederDelegation RPC method. + */ +export interface QueryFeederDelegationResponseSDKType { feeder_addr: string; } /** * QueryMissCounter is the request type for the Query/MissCounter RPC * method. */ - export interface QueryMissCounter { /** validator defines the validator address to query for. */ validatorAddr: string; } +export interface QueryMissCounterProtoMsg { + typeUrl: "/umee.oracle.v1.QueryMissCounter"; + value: Uint8Array; +} /** * QueryMissCounter is the request type for the Query/MissCounter RPC * method. */ - -export interface QueryMissCounterSDKType { +export interface QueryMissCounterAmino { /** validator defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryMissCounterAminoMsg { + type: "/umee.oracle.v1.QueryMissCounter"; + value: QueryMissCounterAmino; +} +/** + * QueryMissCounter is the request type for the Query/MissCounter RPC + * method. + */ +export interface QueryMissCounterSDKType { validator_addr: string; } /** * QueryMissCounterResponse is response type for the * Query/MissCounter RPC method. */ - export interface QueryMissCounterResponse { /** miss_counter defines the oracle miss counter of a validator */ - missCounter: Long; + missCounter: bigint; +} +export interface QueryMissCounterResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryMissCounterResponse"; + value: Uint8Array; } /** * QueryMissCounterResponse is response type for the * Query/MissCounter RPC method. */ - -export interface QueryMissCounterResponseSDKType { +export interface QueryMissCounterResponseAmino { /** miss_counter defines the oracle miss counter of a validator */ - miss_counter: Long; + miss_counter?: string; +} +export interface QueryMissCounterResponseAminoMsg { + type: "/umee.oracle.v1.QueryMissCounterResponse"; + value: QueryMissCounterResponseAmino; +} +/** + * QueryMissCounterResponse is response type for the + * Query/MissCounter RPC method. + */ +export interface QueryMissCounterResponseSDKType { + miss_counter: bigint; } /** * QuerySlashWindow is the request type for the * Query/SlashWindow RPC method. */ - export interface QuerySlashWindow {} +export interface QuerySlashWindowProtoMsg { + typeUrl: "/umee.oracle.v1.QuerySlashWindow"; + value: Uint8Array; +} +/** + * QuerySlashWindow is the request type for the + * Query/SlashWindow RPC method. + */ +export interface QuerySlashWindowAmino {} +export interface QuerySlashWindowAminoMsg { + type: "/umee.oracle.v1.QuerySlashWindow"; + value: QuerySlashWindowAmino; +} /** * QuerySlashWindow is the request type for the * Query/SlashWindow RPC method. */ - export interface QuerySlashWindowSDKType {} /** * QuerySlashWindowResponse is response type for the * Query/SlashWindow RPC method. */ - export interface QuerySlashWindowResponse { /** * window_progress defines the number of voting periods * since the last slashing event would have taken place. */ - windowProgress: Long; + windowProgress: bigint; +} +export interface QuerySlashWindowResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QuerySlashWindowResponse"; + value: Uint8Array; } /** * QuerySlashWindowResponse is response type for the * Query/SlashWindow RPC method. */ - -export interface QuerySlashWindowResponseSDKType { +export interface QuerySlashWindowResponseAmino { /** * window_progress defines the number of voting periods * since the last slashing event would have taken place. */ - window_progress: Long; + window_progress?: string; +} +export interface QuerySlashWindowResponseAminoMsg { + type: "/umee.oracle.v1.QuerySlashWindowResponse"; + value: QuerySlashWindowResponseAmino; +} +/** + * QuerySlashWindowResponse is response type for the + * Query/SlashWindow RPC method. + */ +export interface QuerySlashWindowResponseSDKType { + window_progress: bigint; } /** * QueryAggregatePrevote is the request type for the * Query/AggregatePrevote RPC method. */ - export interface QueryAggregatePrevote { /** validator defines the validator address to query for. */ validatorAddr: string; } +export interface QueryAggregatePrevoteProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevote"; + value: Uint8Array; +} /** * QueryAggregatePrevote is the request type for the * Query/AggregatePrevote RPC method. */ - -export interface QueryAggregatePrevoteSDKType { +export interface QueryAggregatePrevoteAmino { /** validator defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryAggregatePrevoteAminoMsg { + type: "/umee.oracle.v1.QueryAggregatePrevote"; + value: QueryAggregatePrevoteAmino; +} +/** + * QueryAggregatePrevote is the request type for the + * Query/AggregatePrevote RPC method. + */ +export interface QueryAggregatePrevoteSDKType { validator_addr: string; } /** * QueryAggregatePrevoteResponse is response type for the * Query/AggregatePrevote RPC method. */ - export interface QueryAggregatePrevoteResponse { /** * aggregate_prevote defines oracle aggregate prevote submitted by a validator * in the current vote period */ - aggregatePrevote?: AggregateExchangeRatePrevote; + aggregatePrevote: AggregateExchangeRatePrevote; +} +export interface QueryAggregatePrevoteResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevoteResponse"; + value: Uint8Array; } /** * QueryAggregatePrevoteResponse is response type for the * Query/AggregatePrevote RPC method. */ - -export interface QueryAggregatePrevoteResponseSDKType { +export interface QueryAggregatePrevoteResponseAmino { /** * aggregate_prevote defines oracle aggregate prevote submitted by a validator * in the current vote period */ - aggregate_prevote?: AggregateExchangeRatePrevoteSDKType; + aggregate_prevote?: AggregateExchangeRatePrevoteAmino; +} +export interface QueryAggregatePrevoteResponseAminoMsg { + type: "/umee.oracle.v1.QueryAggregatePrevoteResponse"; + value: QueryAggregatePrevoteResponseAmino; +} +/** + * QueryAggregatePrevoteResponse is response type for the + * Query/AggregatePrevote RPC method. + */ +export interface QueryAggregatePrevoteResponseSDKType { + aggregate_prevote: AggregateExchangeRatePrevoteSDKType; } /** * QueryAggregatePrevotes is the request type for the * Query/AggregatePrevotes RPC method. */ - export interface QueryAggregatePrevotes {} +export interface QueryAggregatePrevotesProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevotes"; + value: Uint8Array; +} +/** + * QueryAggregatePrevotes is the request type for the + * Query/AggregatePrevotes RPC method. + */ +export interface QueryAggregatePrevotesAmino {} +export interface QueryAggregatePrevotesAminoMsg { + type: "/umee.oracle.v1.QueryAggregatePrevotes"; + value: QueryAggregatePrevotesAmino; +} /** * QueryAggregatePrevotes is the request type for the * Query/AggregatePrevotes RPC method. */ - export interface QueryAggregatePrevotesSDKType {} /** * QueryAggregatePrevotesResponse is response type for the * Query/AggregatePrevotes RPC method. */ - export interface QueryAggregatePrevotesResponse { /** * aggregate_prevotes defines all oracle aggregate prevotes submitted in the @@ -254,77 +559,127 @@ export interface QueryAggregatePrevotesResponse { */ aggregatePrevotes: AggregateExchangeRatePrevote[]; } +export interface QueryAggregatePrevotesResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevotesResponse"; + value: Uint8Array; +} /** * QueryAggregatePrevotesResponse is response type for the * Query/AggregatePrevotes RPC method. */ - -export interface QueryAggregatePrevotesResponseSDKType { +export interface QueryAggregatePrevotesResponseAmino { /** * aggregate_prevotes defines all oracle aggregate prevotes submitted in the * current vote period */ + aggregate_prevotes?: AggregateExchangeRatePrevoteAmino[]; +} +export interface QueryAggregatePrevotesResponseAminoMsg { + type: "/umee.oracle.v1.QueryAggregatePrevotesResponse"; + value: QueryAggregatePrevotesResponseAmino; +} +/** + * QueryAggregatePrevotesResponse is response type for the + * Query/AggregatePrevotes RPC method. + */ +export interface QueryAggregatePrevotesResponseSDKType { aggregate_prevotes: AggregateExchangeRatePrevoteSDKType[]; } /** * QueryAggregateVote is the request type for the Query/AggregateVote RPC * method. */ - export interface QueryAggregateVote { /** validator defines the validator address to query for. */ validatorAddr: string; } +export interface QueryAggregateVoteProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAggregateVote"; + value: Uint8Array; +} /** * QueryAggregateVote is the request type for the Query/AggregateVote RPC * method. */ - -export interface QueryAggregateVoteSDKType { +export interface QueryAggregateVoteAmino { /** validator defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryAggregateVoteAminoMsg { + type: "/umee.oracle.v1.QueryAggregateVote"; + value: QueryAggregateVoteAmino; +} +/** + * QueryAggregateVote is the request type for the Query/AggregateVote RPC + * method. + */ +export interface QueryAggregateVoteSDKType { validator_addr: string; } /** * QueryAggregateVoteResponse is response type for the * Query/AggregateVote RPC method. */ - export interface QueryAggregateVoteResponse { /** * aggregate_vote defines oracle aggregate vote submitted by a validator in * the current vote period */ - aggregateVote?: AggregateExchangeRateVote; + aggregateVote: AggregateExchangeRateVote; +} +export interface QueryAggregateVoteResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAggregateVoteResponse"; + value: Uint8Array; } /** * QueryAggregateVoteResponse is response type for the * Query/AggregateVote RPC method. */ - -export interface QueryAggregateVoteResponseSDKType { +export interface QueryAggregateVoteResponseAmino { /** * aggregate_vote defines oracle aggregate vote submitted by a validator in * the current vote period */ - aggregate_vote?: AggregateExchangeRateVoteSDKType; + aggregate_vote?: AggregateExchangeRateVoteAmino; +} +export interface QueryAggregateVoteResponseAminoMsg { + type: "/umee.oracle.v1.QueryAggregateVoteResponse"; + value: QueryAggregateVoteResponseAmino; +} +/** + * QueryAggregateVoteResponse is response type for the + * Query/AggregateVote RPC method. + */ +export interface QueryAggregateVoteResponseSDKType { + aggregate_vote: AggregateExchangeRateVoteSDKType; } /** * QueryAggregateVotes is the request type for the Query/AggregateVotes * RPC method. */ - export interface QueryAggregateVotes {} +export interface QueryAggregateVotesProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAggregateVotes"; + value: Uint8Array; +} +/** + * QueryAggregateVotes is the request type for the Query/AggregateVotes + * RPC method. + */ +export interface QueryAggregateVotesAmino {} +export interface QueryAggregateVotesAminoMsg { + type: "/umee.oracle.v1.QueryAggregateVotes"; + value: QueryAggregateVotesAmino; +} /** * QueryAggregateVotes is the request type for the Query/AggregateVotes * RPC method. */ - export interface QueryAggregateVotesSDKType {} /** * QueryAggregateVotesResponse is response type for the * Query/AggregateVotes RPC method. */ - export interface QueryAggregateVotesResponse { /** * aggregate_votes defines all oracle aggregate votes submitted in the current @@ -332,998 +687,2150 @@ export interface QueryAggregateVotesResponse { */ aggregateVotes: AggregateExchangeRateVote[]; } +export interface QueryAggregateVotesResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAggregateVotesResponse"; + value: Uint8Array; +} /** * QueryAggregateVotesResponse is response type for the * Query/AggregateVotes RPC method. */ - -export interface QueryAggregateVotesResponseSDKType { +export interface QueryAggregateVotesResponseAmino { /** * aggregate_votes defines all oracle aggregate votes submitted in the current * vote period */ + aggregate_votes?: AggregateExchangeRateVoteAmino[]; +} +export interface QueryAggregateVotesResponseAminoMsg { + type: "/umee.oracle.v1.QueryAggregateVotesResponse"; + value: QueryAggregateVotesResponseAmino; +} +/** + * QueryAggregateVotesResponse is response type for the + * Query/AggregateVotes RPC method. + */ +export interface QueryAggregateVotesResponseSDKType { aggregate_votes: AggregateExchangeRateVoteSDKType[]; } /** QueryParams is the request type for the Query/Params RPC method. */ - export interface QueryParams {} +export interface QueryParamsProtoMsg { + typeUrl: "/umee.oracle.v1.QueryParams"; + value: Uint8Array; +} +/** QueryParams is the request type for the Query/Params RPC method. */ +export interface QueryParamsAmino {} +export interface QueryParamsAminoMsg { + type: "/umee.oracle.v1.QueryParams"; + value: QueryParamsAmino; +} /** QueryParams is the request type for the Query/Params RPC method. */ - export interface QueryParamsSDKType {} /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - export interface QueryParamsResponse { /** params defines the parameters of the module. */ - params?: Params; + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryParamsResponse"; + value: Uint8Array; } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ - -export interface QueryParamsResponseSDKType { +export interface QueryParamsResponseAmino { /** params defines the parameters of the module. */ - params?: ParamsSDKType; + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "/umee.oracle.v1.QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; } /** QueryMedians is the request type for the Query/Medians RPC Response. */ - export interface QueryMedians { /** denom defines the denomination to query for. */ denom: string; + /** + * numStamps defines the number of median stamps to query for. numStamps + * must be greater than 0. + */ + numStamps: number; +} +export interface QueryMediansProtoMsg { + typeUrl: "/umee.oracle.v1.QueryMedians"; + value: Uint8Array; } /** QueryMedians is the request type for the Query/Medians RPC Response. */ - -export interface QueryMediansSDKType { +export interface QueryMediansAmino { /** denom defines the denomination to query for. */ + denom?: string; + /** + * numStamps defines the number of median stamps to query for. numStamps + * must be greater than 0. + */ + numStamps?: number; +} +export interface QueryMediansAminoMsg { + type: "/umee.oracle.v1.QueryMedians"; + value: QueryMediansAmino; +} +/** QueryMedians is the request type for the Query/Medians RPC Response. */ +export interface QueryMediansSDKType { denom: string; + numStamps: number; } /** * QueryMediansResponse is response type for the * Query/Medians RPC method. */ - export interface QueryMediansResponse { /** medians defines a list of the medians for all stamped denoms. */ - medians: DecCoin[]; + medians: Price[]; +} +export interface QueryMediansResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryMediansResponse"; + value: Uint8Array; } /** * QueryMediansResponse is response type for the * Query/Medians RPC method. */ - -export interface QueryMediansResponseSDKType { +export interface QueryMediansResponseAmino { /** medians defines a list of the medians for all stamped denoms. */ - medians: DecCoinSDKType[]; + medians?: PriceAmino[]; +} +export interface QueryMediansResponseAminoMsg { + type: "/umee.oracle.v1.QueryMediansResponse"; + value: QueryMediansResponseAmino; +} +/** + * QueryMediansResponse is response type for the + * Query/Medians RPC method. + */ +export interface QueryMediansResponseSDKType { + medians: PriceSDKType[]; +} +/** QueryMedianDeviations is the request type for the Query/MedianDeviations RPC Response. */ +export interface QueryMedianDeviations { + /** denom defines the denomination to query for. */ + denom: string; +} +export interface QueryMedianDeviationsProtoMsg { + typeUrl: "/umee.oracle.v1.QueryMedianDeviations"; + value: Uint8Array; +} +/** QueryMedianDeviations is the request type for the Query/MedianDeviations RPC Response. */ +export interface QueryMedianDeviationsAmino { + /** denom defines the denomination to query for. */ + denom?: string; +} +export interface QueryMedianDeviationsAminoMsg { + type: "/umee.oracle.v1.QueryMedianDeviations"; + value: QueryMedianDeviationsAmino; +} +/** QueryMedianDeviations is the request type for the Query/MedianDeviations RPC Response. */ +export interface QueryMedianDeviationsSDKType { + denom: string; +} +/** + * QueryMedianDeviationsResponse is response type for the + * Query/MedianDeviations RPC method. + */ +export interface QueryMedianDeviationsResponse { + /** medians defines a list of the median deviations for all stamped denoms. */ + medianDeviations: Price[]; } - +export interface QueryMedianDeviationsResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryMedianDeviationsResponse"; + value: Uint8Array; +} +/** + * QueryMedianDeviationsResponse is response type for the + * Query/MedianDeviations RPC method. + */ +export interface QueryMedianDeviationsResponseAmino { + /** medians defines a list of the median deviations for all stamped denoms. */ + medianDeviations?: PriceAmino[]; +} +export interface QueryMedianDeviationsResponseAminoMsg { + type: "/umee.oracle.v1.QueryMedianDeviationsResponse"; + value: QueryMedianDeviationsResponseAmino; +} +/** + * QueryMedianDeviationsResponse is response type for the + * Query/MedianDeviations RPC method. + */ +export interface QueryMedianDeviationsResponseSDKType { + medianDeviations: PriceSDKType[]; +} +/** QueryAvgPrice is a request type for AvgPrice method */ +export interface QueryAvgPrice { + denom: string; +} +export interface QueryAvgPriceProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAvgPrice"; + value: Uint8Array; +} +/** QueryAvgPrice is a request type for AvgPrice method */ +export interface QueryAvgPriceAmino { + denom?: string; +} +export interface QueryAvgPriceAminoMsg { + type: "/umee.oracle.v1.QueryAvgPrice"; + value: QueryAvgPriceAmino; +} +/** QueryAvgPrice is a request type for AvgPrice method */ +export interface QueryAvgPriceSDKType { + denom: string; +} +/** QueryAvgPriceResponse is a response type for AvgPrice method */ +export interface QueryAvgPriceResponse { + price: string; +} +export interface QueryAvgPriceResponseProtoMsg { + typeUrl: "/umee.oracle.v1.QueryAvgPriceResponse"; + value: Uint8Array; +} +/** QueryAvgPriceResponse is a response type for AvgPrice method */ +export interface QueryAvgPriceResponseAmino { + price?: string; +} +export interface QueryAvgPriceResponseAminoMsg { + type: "/umee.oracle.v1.QueryAvgPriceResponse"; + value: QueryAvgPriceResponseAmino; +} +/** QueryAvgPriceResponse is a response type for AvgPrice method */ +export interface QueryAvgPriceResponseSDKType { + price: string; +} +function createBaseQueryMissCounters(): QueryMissCounters { + return { + validator: "" + }; +} +export const QueryMissCounters = { + typeUrl: "/umee.oracle.v1.QueryMissCounters", + encode(message: QueryMissCounters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMissCounters { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMissCounters(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMissCounters { + const message = createBaseQueryMissCounters(); + message.validator = object.validator ?? ""; + return message; + }, + fromAmino(object: QueryMissCountersAmino): QueryMissCounters { + const message = createBaseQueryMissCounters(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = object.validator; + } + return message; + }, + toAmino(message: QueryMissCounters): QueryMissCountersAmino { + const obj: any = {}; + obj.validator = message.validator; + return obj; + }, + fromAminoMsg(object: QueryMissCountersAminoMsg): QueryMissCounters { + return QueryMissCounters.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMissCountersProtoMsg): QueryMissCounters { + return QueryMissCounters.decode(message.value); + }, + toProto(message: QueryMissCounters): Uint8Array { + return QueryMissCounters.encode(message).finish(); + }, + toProtoMsg(message: QueryMissCounters): QueryMissCountersProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryMissCounters", + value: QueryMissCounters.encode(message).finish() + }; + } +}; +function createBaseQueryMissCountersResponse(): QueryMissCountersResponse { + return { + missCounters: [] + }; +} +export const QueryMissCountersResponse = { + typeUrl: "/umee.oracle.v1.QueryMissCountersResponse", + encode(message: QueryMissCountersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.missCounters) { + PriceMissCounter.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMissCountersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMissCountersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.missCounters.push(PriceMissCounter.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMissCountersResponse { + const message = createBaseQueryMissCountersResponse(); + message.missCounters = object.missCounters?.map(e => PriceMissCounter.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryMissCountersResponseAmino): QueryMissCountersResponse { + const message = createBaseQueryMissCountersResponse(); + message.missCounters = object.miss_counters?.map(e => PriceMissCounter.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryMissCountersResponse): QueryMissCountersResponseAmino { + const obj: any = {}; + if (message.missCounters) { + obj.miss_counters = message.missCounters.map(e => e ? PriceMissCounter.toAmino(e) : undefined); + } else { + obj.miss_counters = []; + } + return obj; + }, + fromAminoMsg(object: QueryMissCountersResponseAminoMsg): QueryMissCountersResponse { + return QueryMissCountersResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMissCountersResponseProtoMsg): QueryMissCountersResponse { + return QueryMissCountersResponse.decode(message.value); + }, + toProto(message: QueryMissCountersResponse): Uint8Array { + return QueryMissCountersResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryMissCountersResponse): QueryMissCountersResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryMissCountersResponse", + value: QueryMissCountersResponse.encode(message).finish() + }; + } +}; +function createBasePriceMissCounter(): PriceMissCounter { + return { + validator: "", + missCounter: BigInt(0) + }; +} +export const PriceMissCounter = { + typeUrl: "/umee.oracle.v1.PriceMissCounter", + encode(message: PriceMissCounter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== "") { + writer.uint32(10).string(message.validator); + } + if (message.missCounter !== BigInt(0)) { + writer.uint32(16).uint64(message.missCounter); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PriceMissCounter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriceMissCounter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = reader.string(); + break; + case 2: + message.missCounter = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): PriceMissCounter { + const message = createBasePriceMissCounter(); + message.validator = object.validator ?? ""; + message.missCounter = object.missCounter !== undefined && object.missCounter !== null ? BigInt(object.missCounter.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PriceMissCounterAmino): PriceMissCounter { + const message = createBasePriceMissCounter(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = object.validator; + } + if (object.miss_counter !== undefined && object.miss_counter !== null) { + message.missCounter = BigInt(object.miss_counter); + } + return message; + }, + toAmino(message: PriceMissCounter): PriceMissCounterAmino { + const obj: any = {}; + obj.validator = message.validator; + obj.miss_counter = message.missCounter ? message.missCounter.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PriceMissCounterAminoMsg): PriceMissCounter { + return PriceMissCounter.fromAmino(object.value); + }, + fromProtoMsg(message: PriceMissCounterProtoMsg): PriceMissCounter { + return PriceMissCounter.decode(message.value); + }, + toProto(message: PriceMissCounter): Uint8Array { + return PriceMissCounter.encode(message).finish(); + }, + toProtoMsg(message: PriceMissCounter): PriceMissCounterProtoMsg { + return { + typeUrl: "/umee.oracle.v1.PriceMissCounter", + value: PriceMissCounter.encode(message).finish() + }; + } +}; +function createBaseQueryExgRatesWithTimestamp(): QueryExgRatesWithTimestamp { + return { + denom: "" + }; +} +export const QueryExgRatesWithTimestamp = { + typeUrl: "/umee.oracle.v1.QueryExgRatesWithTimestamp", + encode(message: QueryExgRatesWithTimestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryExgRatesWithTimestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExgRatesWithTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryExgRatesWithTimestamp { + const message = createBaseQueryExgRatesWithTimestamp(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryExgRatesWithTimestampAmino): QueryExgRatesWithTimestamp { + const message = createBaseQueryExgRatesWithTimestamp(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryExgRatesWithTimestamp): QueryExgRatesWithTimestampAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryExgRatesWithTimestampAminoMsg): QueryExgRatesWithTimestamp { + return QueryExgRatesWithTimestamp.fromAmino(object.value); + }, + fromProtoMsg(message: QueryExgRatesWithTimestampProtoMsg): QueryExgRatesWithTimestamp { + return QueryExgRatesWithTimestamp.decode(message.value); + }, + toProto(message: QueryExgRatesWithTimestamp): Uint8Array { + return QueryExgRatesWithTimestamp.encode(message).finish(); + }, + toProtoMsg(message: QueryExgRatesWithTimestamp): QueryExgRatesWithTimestampProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryExgRatesWithTimestamp", + value: QueryExgRatesWithTimestamp.encode(message).finish() + }; + } +}; +function createBaseQueryExgRatesWithTimestampResponse(): QueryExgRatesWithTimestampResponse { + return { + exgRates: [] + }; +} +export const QueryExgRatesWithTimestampResponse = { + typeUrl: "/umee.oracle.v1.QueryExgRatesWithTimestampResponse", + encode(message: QueryExgRatesWithTimestampResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.exgRates) { + DenomExchangeRate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryExgRatesWithTimestampResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExgRatesWithTimestampResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exgRates.push(DenomExchangeRate.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryExgRatesWithTimestampResponse { + const message = createBaseQueryExgRatesWithTimestampResponse(); + message.exgRates = object.exgRates?.map(e => DenomExchangeRate.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryExgRatesWithTimestampResponseAmino): QueryExgRatesWithTimestampResponse { + const message = createBaseQueryExgRatesWithTimestampResponse(); + message.exgRates = object.exg_rates?.map(e => DenomExchangeRate.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryExgRatesWithTimestampResponse): QueryExgRatesWithTimestampResponseAmino { + const obj: any = {}; + if (message.exgRates) { + obj.exg_rates = message.exgRates.map(e => e ? DenomExchangeRate.toAmino(e) : undefined); + } else { + obj.exg_rates = []; + } + return obj; + }, + fromAminoMsg(object: QueryExgRatesWithTimestampResponseAminoMsg): QueryExgRatesWithTimestampResponse { + return QueryExgRatesWithTimestampResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryExgRatesWithTimestampResponseProtoMsg): QueryExgRatesWithTimestampResponse { + return QueryExgRatesWithTimestampResponse.decode(message.value); + }, + toProto(message: QueryExgRatesWithTimestampResponse): Uint8Array { + return QueryExgRatesWithTimestampResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryExgRatesWithTimestampResponse): QueryExgRatesWithTimestampResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryExgRatesWithTimestampResponse", + value: QueryExgRatesWithTimestampResponse.encode(message).finish() + }; + } +}; function createBaseQueryExchangeRates(): QueryExchangeRates { return { denom: "" }; } - export const QueryExchangeRates = { - encode(message: QueryExchangeRates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryExchangeRates", + encode(message: QueryExchangeRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryExchangeRates { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryExchangeRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryExchangeRates(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryExchangeRates { + fromPartial(object: Partial): QueryExchangeRates { const message = createBaseQueryExchangeRates(); message.denom = object.denom ?? ""; return message; + }, + fromAmino(object: QueryExchangeRatesAmino): QueryExchangeRates { + const message = createBaseQueryExchangeRates(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryExchangeRates): QueryExchangeRatesAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryExchangeRatesAminoMsg): QueryExchangeRates { + return QueryExchangeRates.fromAmino(object.value); + }, + fromProtoMsg(message: QueryExchangeRatesProtoMsg): QueryExchangeRates { + return QueryExchangeRates.decode(message.value); + }, + toProto(message: QueryExchangeRates): Uint8Array { + return QueryExchangeRates.encode(message).finish(); + }, + toProtoMsg(message: QueryExchangeRates): QueryExchangeRatesProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryExchangeRates", + value: QueryExchangeRates.encode(message).finish() + }; } - }; - function createBaseQueryExchangeRatesResponse(): QueryExchangeRatesResponse { return { exchangeRates: [] }; } - export const QueryExchangeRatesResponse = { - encode(message: QueryExchangeRatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryExchangeRatesResponse", + encode(message: QueryExchangeRatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.exchangeRates) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryExchangeRatesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryExchangeRatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryExchangeRatesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.exchangeRates.push(DecCoin.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryExchangeRatesResponse { + fromPartial(object: Partial): QueryExchangeRatesResponse { const message = createBaseQueryExchangeRatesResponse(); message.exchangeRates = object.exchangeRates?.map(e => DecCoin.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryExchangeRatesResponseAmino): QueryExchangeRatesResponse { + const message = createBaseQueryExchangeRatesResponse(); + message.exchangeRates = object.exchange_rates?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryExchangeRatesResponse): QueryExchangeRatesResponseAmino { + const obj: any = {}; + if (message.exchangeRates) { + obj.exchange_rates = message.exchangeRates.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.exchange_rates = []; + } + return obj; + }, + fromAminoMsg(object: QueryExchangeRatesResponseAminoMsg): QueryExchangeRatesResponse { + return QueryExchangeRatesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryExchangeRatesResponseProtoMsg): QueryExchangeRatesResponse { + return QueryExchangeRatesResponse.decode(message.value); + }, + toProto(message: QueryExchangeRatesResponse): Uint8Array { + return QueryExchangeRatesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryExchangeRatesResponse): QueryExchangeRatesResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryExchangeRatesResponse", + value: QueryExchangeRatesResponse.encode(message).finish() + }; } - }; - function createBaseQueryActiveExchangeRates(): QueryActiveExchangeRates { return {}; } - export const QueryActiveExchangeRates = { - encode(_: QueryActiveExchangeRates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryActiveExchangeRates", + encode(_: QueryActiveExchangeRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryActiveExchangeRates { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryActiveExchangeRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryActiveExchangeRates(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryActiveExchangeRates { + fromPartial(_: Partial): QueryActiveExchangeRates { const message = createBaseQueryActiveExchangeRates(); return message; + }, + fromAmino(_: QueryActiveExchangeRatesAmino): QueryActiveExchangeRates { + const message = createBaseQueryActiveExchangeRates(); + return message; + }, + toAmino(_: QueryActiveExchangeRates): QueryActiveExchangeRatesAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryActiveExchangeRatesAminoMsg): QueryActiveExchangeRates { + return QueryActiveExchangeRates.fromAmino(object.value); + }, + fromProtoMsg(message: QueryActiveExchangeRatesProtoMsg): QueryActiveExchangeRates { + return QueryActiveExchangeRates.decode(message.value); + }, + toProto(message: QueryActiveExchangeRates): Uint8Array { + return QueryActiveExchangeRates.encode(message).finish(); + }, + toProtoMsg(message: QueryActiveExchangeRates): QueryActiveExchangeRatesProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryActiveExchangeRates", + value: QueryActiveExchangeRates.encode(message).finish() + }; } - }; - function createBaseQueryActiveExchangeRatesResponse(): QueryActiveExchangeRatesResponse { return { activeRates: [] }; } - export const QueryActiveExchangeRatesResponse = { - encode(message: QueryActiveExchangeRatesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryActiveExchangeRatesResponse", + encode(message: QueryActiveExchangeRatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.activeRates) { writer.uint32(10).string(v!); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryActiveExchangeRatesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryActiveExchangeRatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryActiveExchangeRatesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.activeRates.push(reader.string()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryActiveExchangeRatesResponse { + fromPartial(object: Partial): QueryActiveExchangeRatesResponse { const message = createBaseQueryActiveExchangeRatesResponse(); message.activeRates = object.activeRates?.map(e => e) || []; return message; + }, + fromAmino(object: QueryActiveExchangeRatesResponseAmino): QueryActiveExchangeRatesResponse { + const message = createBaseQueryActiveExchangeRatesResponse(); + message.activeRates = object.active_rates?.map(e => e) || []; + return message; + }, + toAmino(message: QueryActiveExchangeRatesResponse): QueryActiveExchangeRatesResponseAmino { + const obj: any = {}; + if (message.activeRates) { + obj.active_rates = message.activeRates.map(e => e); + } else { + obj.active_rates = []; + } + return obj; + }, + fromAminoMsg(object: QueryActiveExchangeRatesResponseAminoMsg): QueryActiveExchangeRatesResponse { + return QueryActiveExchangeRatesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryActiveExchangeRatesResponseProtoMsg): QueryActiveExchangeRatesResponse { + return QueryActiveExchangeRatesResponse.decode(message.value); + }, + toProto(message: QueryActiveExchangeRatesResponse): Uint8Array { + return QueryActiveExchangeRatesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryActiveExchangeRatesResponse): QueryActiveExchangeRatesResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryActiveExchangeRatesResponse", + value: QueryActiveExchangeRatesResponse.encode(message).finish() + }; } - }; - function createBaseQueryFeederDelegation(): QueryFeederDelegation { return { validatorAddr: "" }; } - export const QueryFeederDelegation = { - encode(message: QueryFeederDelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryFeederDelegation", + encode(message: QueryFeederDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeederDelegation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryFeederDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryFeederDelegation(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryFeederDelegation { + fromPartial(object: Partial): QueryFeederDelegation { const message = createBaseQueryFeederDelegation(); message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: QueryFeederDelegationAmino): QueryFeederDelegation { + const message = createBaseQueryFeederDelegation(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryFeederDelegation): QueryFeederDelegationAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryFeederDelegationAminoMsg): QueryFeederDelegation { + return QueryFeederDelegation.fromAmino(object.value); + }, + fromProtoMsg(message: QueryFeederDelegationProtoMsg): QueryFeederDelegation { + return QueryFeederDelegation.decode(message.value); + }, + toProto(message: QueryFeederDelegation): Uint8Array { + return QueryFeederDelegation.encode(message).finish(); + }, + toProtoMsg(message: QueryFeederDelegation): QueryFeederDelegationProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryFeederDelegation", + value: QueryFeederDelegation.encode(message).finish() + }; } - }; - function createBaseQueryFeederDelegationResponse(): QueryFeederDelegationResponse { return { feederAddr: "" }; } - export const QueryFeederDelegationResponse = { - encode(message: QueryFeederDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryFeederDelegationResponse", + encode(message: QueryFeederDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.feederAddr !== "") { writer.uint32(10).string(message.feederAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryFeederDelegationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryFeederDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryFeederDelegationResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.feederAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryFeederDelegationResponse { + fromPartial(object: Partial): QueryFeederDelegationResponse { const message = createBaseQueryFeederDelegationResponse(); message.feederAddr = object.feederAddr ?? ""; return message; + }, + fromAmino(object: QueryFeederDelegationResponseAmino): QueryFeederDelegationResponse { + const message = createBaseQueryFeederDelegationResponse(); + if (object.feeder_addr !== undefined && object.feeder_addr !== null) { + message.feederAddr = object.feeder_addr; + } + return message; + }, + toAmino(message: QueryFeederDelegationResponse): QueryFeederDelegationResponseAmino { + const obj: any = {}; + obj.feeder_addr = message.feederAddr; + return obj; + }, + fromAminoMsg(object: QueryFeederDelegationResponseAminoMsg): QueryFeederDelegationResponse { + return QueryFeederDelegationResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryFeederDelegationResponseProtoMsg): QueryFeederDelegationResponse { + return QueryFeederDelegationResponse.decode(message.value); + }, + toProto(message: QueryFeederDelegationResponse): Uint8Array { + return QueryFeederDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryFeederDelegationResponse): QueryFeederDelegationResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryFeederDelegationResponse", + value: QueryFeederDelegationResponse.encode(message).finish() + }; } - }; - function createBaseQueryMissCounter(): QueryMissCounter { return { validatorAddr: "" }; } - export const QueryMissCounter = { - encode(message: QueryMissCounter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryMissCounter", + encode(message: QueryMissCounter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryMissCounter { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryMissCounter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMissCounter(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryMissCounter { + fromPartial(object: Partial): QueryMissCounter { const message = createBaseQueryMissCounter(); message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: QueryMissCounterAmino): QueryMissCounter { + const message = createBaseQueryMissCounter(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryMissCounter): QueryMissCounterAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryMissCounterAminoMsg): QueryMissCounter { + return QueryMissCounter.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMissCounterProtoMsg): QueryMissCounter { + return QueryMissCounter.decode(message.value); + }, + toProto(message: QueryMissCounter): Uint8Array { + return QueryMissCounter.encode(message).finish(); + }, + toProtoMsg(message: QueryMissCounter): QueryMissCounterProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryMissCounter", + value: QueryMissCounter.encode(message).finish() + }; } - }; - function createBaseQueryMissCounterResponse(): QueryMissCounterResponse { return { - missCounter: Long.UZERO + missCounter: BigInt(0) }; } - export const QueryMissCounterResponse = { - encode(message: QueryMissCounterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.missCounter.isZero()) { + typeUrl: "/umee.oracle.v1.QueryMissCounterResponse", + encode(message: QueryMissCounterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.missCounter !== BigInt(0)) { writer.uint32(8).uint64(message.missCounter); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryMissCounterResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryMissCounterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMissCounterResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.missCounter = (reader.uint64() as Long); + message.missCounter = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryMissCounterResponse { + fromPartial(object: Partial): QueryMissCounterResponse { const message = createBaseQueryMissCounterResponse(); - message.missCounter = object.missCounter !== undefined && object.missCounter !== null ? Long.fromValue(object.missCounter) : Long.UZERO; + message.missCounter = object.missCounter !== undefined && object.missCounter !== null ? BigInt(object.missCounter.toString()) : BigInt(0); return message; + }, + fromAmino(object: QueryMissCounterResponseAmino): QueryMissCounterResponse { + const message = createBaseQueryMissCounterResponse(); + if (object.miss_counter !== undefined && object.miss_counter !== null) { + message.missCounter = BigInt(object.miss_counter); + } + return message; + }, + toAmino(message: QueryMissCounterResponse): QueryMissCounterResponseAmino { + const obj: any = {}; + obj.miss_counter = message.missCounter ? message.missCounter.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryMissCounterResponseAminoMsg): QueryMissCounterResponse { + return QueryMissCounterResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMissCounterResponseProtoMsg): QueryMissCounterResponse { + return QueryMissCounterResponse.decode(message.value); + }, + toProto(message: QueryMissCounterResponse): Uint8Array { + return QueryMissCounterResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryMissCounterResponse): QueryMissCounterResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryMissCounterResponse", + value: QueryMissCounterResponse.encode(message).finish() + }; } - }; - function createBaseQuerySlashWindow(): QuerySlashWindow { return {}; } - export const QuerySlashWindow = { - encode(_: QuerySlashWindow, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QuerySlashWindow", + encode(_: QuerySlashWindow, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySlashWindow { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySlashWindow { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySlashWindow(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QuerySlashWindow { + fromPartial(_: Partial): QuerySlashWindow { + const message = createBaseQuerySlashWindow(); + return message; + }, + fromAmino(_: QuerySlashWindowAmino): QuerySlashWindow { const message = createBaseQuerySlashWindow(); return message; + }, + toAmino(_: QuerySlashWindow): QuerySlashWindowAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QuerySlashWindowAminoMsg): QuerySlashWindow { + return QuerySlashWindow.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySlashWindowProtoMsg): QuerySlashWindow { + return QuerySlashWindow.decode(message.value); + }, + toProto(message: QuerySlashWindow): Uint8Array { + return QuerySlashWindow.encode(message).finish(); + }, + toProtoMsg(message: QuerySlashWindow): QuerySlashWindowProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QuerySlashWindow", + value: QuerySlashWindow.encode(message).finish() + }; } - }; - function createBaseQuerySlashWindowResponse(): QuerySlashWindowResponse { return { - windowProgress: Long.UZERO + windowProgress: BigInt(0) }; } - export const QuerySlashWindowResponse = { - encode(message: QuerySlashWindowResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (!message.windowProgress.isZero()) { + typeUrl: "/umee.oracle.v1.QuerySlashWindowResponse", + encode(message: QuerySlashWindowResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.windowProgress !== BigInt(0)) { writer.uint32(8).uint64(message.windowProgress); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QuerySlashWindowResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QuerySlashWindowResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySlashWindowResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.windowProgress = (reader.uint64() as Long); + message.windowProgress = reader.uint64(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QuerySlashWindowResponse { + fromPartial(object: Partial): QuerySlashWindowResponse { + const message = createBaseQuerySlashWindowResponse(); + message.windowProgress = object.windowProgress !== undefined && object.windowProgress !== null ? BigInt(object.windowProgress.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QuerySlashWindowResponseAmino): QuerySlashWindowResponse { const message = createBaseQuerySlashWindowResponse(); - message.windowProgress = object.windowProgress !== undefined && object.windowProgress !== null ? Long.fromValue(object.windowProgress) : Long.UZERO; + if (object.window_progress !== undefined && object.window_progress !== null) { + message.windowProgress = BigInt(object.window_progress); + } return message; + }, + toAmino(message: QuerySlashWindowResponse): QuerySlashWindowResponseAmino { + const obj: any = {}; + obj.window_progress = message.windowProgress ? message.windowProgress.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QuerySlashWindowResponseAminoMsg): QuerySlashWindowResponse { + return QuerySlashWindowResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySlashWindowResponseProtoMsg): QuerySlashWindowResponse { + return QuerySlashWindowResponse.decode(message.value); + }, + toProto(message: QuerySlashWindowResponse): Uint8Array { + return QuerySlashWindowResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySlashWindowResponse): QuerySlashWindowResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QuerySlashWindowResponse", + value: QuerySlashWindowResponse.encode(message).finish() + }; } - }; - function createBaseQueryAggregatePrevote(): QueryAggregatePrevote { return { validatorAddr: "" }; } - export const QueryAggregatePrevote = { - encode(message: QueryAggregatePrevote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevote", + encode(message: QueryAggregatePrevote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregatePrevote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregatePrevote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregatePrevote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAggregatePrevote { + fromPartial(object: Partial): QueryAggregatePrevote { const message = createBaseQueryAggregatePrevote(); message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: QueryAggregatePrevoteAmino): QueryAggregatePrevote { + const message = createBaseQueryAggregatePrevote(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryAggregatePrevote): QueryAggregatePrevoteAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryAggregatePrevoteAminoMsg): QueryAggregatePrevote { + return QueryAggregatePrevote.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAggregatePrevoteProtoMsg): QueryAggregatePrevote { + return QueryAggregatePrevote.decode(message.value); + }, + toProto(message: QueryAggregatePrevote): Uint8Array { + return QueryAggregatePrevote.encode(message).finish(); + }, + toProtoMsg(message: QueryAggregatePrevote): QueryAggregatePrevoteProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevote", + value: QueryAggregatePrevote.encode(message).finish() + }; } - }; - function createBaseQueryAggregatePrevoteResponse(): QueryAggregatePrevoteResponse { return { - aggregatePrevote: undefined + aggregatePrevote: AggregateExchangeRatePrevote.fromPartial({}) }; } - export const QueryAggregatePrevoteResponse = { - encode(message: QueryAggregatePrevoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevoteResponse", + encode(message: QueryAggregatePrevoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.aggregatePrevote !== undefined) { AggregateExchangeRatePrevote.encode(message.aggregatePrevote, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregatePrevoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregatePrevoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregatePrevoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.aggregatePrevote = AggregateExchangeRatePrevote.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAggregatePrevoteResponse { + fromPartial(object: Partial): QueryAggregatePrevoteResponse { const message = createBaseQueryAggregatePrevoteResponse(); message.aggregatePrevote = object.aggregatePrevote !== undefined && object.aggregatePrevote !== null ? AggregateExchangeRatePrevote.fromPartial(object.aggregatePrevote) : undefined; return message; + }, + fromAmino(object: QueryAggregatePrevoteResponseAmino): QueryAggregatePrevoteResponse { + const message = createBaseQueryAggregatePrevoteResponse(); + if (object.aggregate_prevote !== undefined && object.aggregate_prevote !== null) { + message.aggregatePrevote = AggregateExchangeRatePrevote.fromAmino(object.aggregate_prevote); + } + return message; + }, + toAmino(message: QueryAggregatePrevoteResponse): QueryAggregatePrevoteResponseAmino { + const obj: any = {}; + obj.aggregate_prevote = message.aggregatePrevote ? AggregateExchangeRatePrevote.toAmino(message.aggregatePrevote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAggregatePrevoteResponseAminoMsg): QueryAggregatePrevoteResponse { + return QueryAggregatePrevoteResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAggregatePrevoteResponseProtoMsg): QueryAggregatePrevoteResponse { + return QueryAggregatePrevoteResponse.decode(message.value); + }, + toProto(message: QueryAggregatePrevoteResponse): Uint8Array { + return QueryAggregatePrevoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAggregatePrevoteResponse): QueryAggregatePrevoteResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevoteResponse", + value: QueryAggregatePrevoteResponse.encode(message).finish() + }; } - }; - function createBaseQueryAggregatePrevotes(): QueryAggregatePrevotes { return {}; } - export const QueryAggregatePrevotes = { - encode(_: QueryAggregatePrevotes, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevotes", + encode(_: QueryAggregatePrevotes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregatePrevotes { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregatePrevotes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregatePrevotes(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryAggregatePrevotes { + fromPartial(_: Partial): QueryAggregatePrevotes { + const message = createBaseQueryAggregatePrevotes(); + return message; + }, + fromAmino(_: QueryAggregatePrevotesAmino): QueryAggregatePrevotes { const message = createBaseQueryAggregatePrevotes(); return message; + }, + toAmino(_: QueryAggregatePrevotes): QueryAggregatePrevotesAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryAggregatePrevotesAminoMsg): QueryAggregatePrevotes { + return QueryAggregatePrevotes.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAggregatePrevotesProtoMsg): QueryAggregatePrevotes { + return QueryAggregatePrevotes.decode(message.value); + }, + toProto(message: QueryAggregatePrevotes): Uint8Array { + return QueryAggregatePrevotes.encode(message).finish(); + }, + toProtoMsg(message: QueryAggregatePrevotes): QueryAggregatePrevotesProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevotes", + value: QueryAggregatePrevotes.encode(message).finish() + }; } - }; - function createBaseQueryAggregatePrevotesResponse(): QueryAggregatePrevotesResponse { return { aggregatePrevotes: [] }; } - export const QueryAggregatePrevotesResponse = { - encode(message: QueryAggregatePrevotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevotesResponse", + encode(message: QueryAggregatePrevotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.aggregatePrevotes) { AggregateExchangeRatePrevote.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregatePrevotesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregatePrevotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregatePrevotesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.aggregatePrevotes.push(AggregateExchangeRatePrevote.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAggregatePrevotesResponse { + fromPartial(object: Partial): QueryAggregatePrevotesResponse { const message = createBaseQueryAggregatePrevotesResponse(); message.aggregatePrevotes = object.aggregatePrevotes?.map(e => AggregateExchangeRatePrevote.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryAggregatePrevotesResponseAmino): QueryAggregatePrevotesResponse { + const message = createBaseQueryAggregatePrevotesResponse(); + message.aggregatePrevotes = object.aggregate_prevotes?.map(e => AggregateExchangeRatePrevote.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryAggregatePrevotesResponse): QueryAggregatePrevotesResponseAmino { + const obj: any = {}; + if (message.aggregatePrevotes) { + obj.aggregate_prevotes = message.aggregatePrevotes.map(e => e ? AggregateExchangeRatePrevote.toAmino(e) : undefined); + } else { + obj.aggregate_prevotes = []; + } + return obj; + }, + fromAminoMsg(object: QueryAggregatePrevotesResponseAminoMsg): QueryAggregatePrevotesResponse { + return QueryAggregatePrevotesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAggregatePrevotesResponseProtoMsg): QueryAggregatePrevotesResponse { + return QueryAggregatePrevotesResponse.decode(message.value); + }, + toProto(message: QueryAggregatePrevotesResponse): Uint8Array { + return QueryAggregatePrevotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAggregatePrevotesResponse): QueryAggregatePrevotesResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAggregatePrevotesResponse", + value: QueryAggregatePrevotesResponse.encode(message).finish() + }; } - }; - function createBaseQueryAggregateVote(): QueryAggregateVote { return { validatorAddr: "" }; } - export const QueryAggregateVote = { - encode(message: QueryAggregateVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryAggregateVote", + encode(message: QueryAggregateVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregateVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregateVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregateVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.validatorAddr = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAggregateVote { + fromPartial(object: Partial): QueryAggregateVote { const message = createBaseQueryAggregateVote(); message.validatorAddr = object.validatorAddr ?? ""; return message; + }, + fromAmino(object: QueryAggregateVoteAmino): QueryAggregateVote { + const message = createBaseQueryAggregateVote(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryAggregateVote): QueryAggregateVoteAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryAggregateVoteAminoMsg): QueryAggregateVote { + return QueryAggregateVote.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAggregateVoteProtoMsg): QueryAggregateVote { + return QueryAggregateVote.decode(message.value); + }, + toProto(message: QueryAggregateVote): Uint8Array { + return QueryAggregateVote.encode(message).finish(); + }, + toProtoMsg(message: QueryAggregateVote): QueryAggregateVoteProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAggregateVote", + value: QueryAggregateVote.encode(message).finish() + }; } - }; - function createBaseQueryAggregateVoteResponse(): QueryAggregateVoteResponse { return { - aggregateVote: undefined + aggregateVote: AggregateExchangeRateVote.fromPartial({}) }; } - export const QueryAggregateVoteResponse = { - encode(message: QueryAggregateVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryAggregateVoteResponse", + encode(message: QueryAggregateVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.aggregateVote !== undefined) { AggregateExchangeRateVote.encode(message.aggregateVote, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregateVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregateVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregateVoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.aggregateVote = AggregateExchangeRateVote.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAggregateVoteResponse { + fromPartial(object: Partial): QueryAggregateVoteResponse { const message = createBaseQueryAggregateVoteResponse(); message.aggregateVote = object.aggregateVote !== undefined && object.aggregateVote !== null ? AggregateExchangeRateVote.fromPartial(object.aggregateVote) : undefined; return message; + }, + fromAmino(object: QueryAggregateVoteResponseAmino): QueryAggregateVoteResponse { + const message = createBaseQueryAggregateVoteResponse(); + if (object.aggregate_vote !== undefined && object.aggregate_vote !== null) { + message.aggregateVote = AggregateExchangeRateVote.fromAmino(object.aggregate_vote); + } + return message; + }, + toAmino(message: QueryAggregateVoteResponse): QueryAggregateVoteResponseAmino { + const obj: any = {}; + obj.aggregate_vote = message.aggregateVote ? AggregateExchangeRateVote.toAmino(message.aggregateVote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAggregateVoteResponseAminoMsg): QueryAggregateVoteResponse { + return QueryAggregateVoteResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAggregateVoteResponseProtoMsg): QueryAggregateVoteResponse { + return QueryAggregateVoteResponse.decode(message.value); + }, + toProto(message: QueryAggregateVoteResponse): Uint8Array { + return QueryAggregateVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAggregateVoteResponse): QueryAggregateVoteResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAggregateVoteResponse", + value: QueryAggregateVoteResponse.encode(message).finish() + }; } - }; - function createBaseQueryAggregateVotes(): QueryAggregateVotes { return {}; } - export const QueryAggregateVotes = { - encode(_: QueryAggregateVotes, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryAggregateVotes", + encode(_: QueryAggregateVotes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregateVotes { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregateVotes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregateVotes(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryAggregateVotes { + fromPartial(_: Partial): QueryAggregateVotes { + const message = createBaseQueryAggregateVotes(); + return message; + }, + fromAmino(_: QueryAggregateVotesAmino): QueryAggregateVotes { const message = createBaseQueryAggregateVotes(); return message; + }, + toAmino(_: QueryAggregateVotes): QueryAggregateVotesAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryAggregateVotesAminoMsg): QueryAggregateVotes { + return QueryAggregateVotes.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAggregateVotesProtoMsg): QueryAggregateVotes { + return QueryAggregateVotes.decode(message.value); + }, + toProto(message: QueryAggregateVotes): Uint8Array { + return QueryAggregateVotes.encode(message).finish(); + }, + toProtoMsg(message: QueryAggregateVotes): QueryAggregateVotesProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAggregateVotes", + value: QueryAggregateVotes.encode(message).finish() + }; } - }; - function createBaseQueryAggregateVotesResponse(): QueryAggregateVotesResponse { return { aggregateVotes: [] }; } - export const QueryAggregateVotesResponse = { - encode(message: QueryAggregateVotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryAggregateVotesResponse", + encode(message: QueryAggregateVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.aggregateVotes) { AggregateExchangeRateVote.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryAggregateVotesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregateVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregateVotesResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.aggregateVotes.push(AggregateExchangeRateVote.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryAggregateVotesResponse { + fromPartial(object: Partial): QueryAggregateVotesResponse { const message = createBaseQueryAggregateVotesResponse(); message.aggregateVotes = object.aggregateVotes?.map(e => AggregateExchangeRateVote.fromPartial(e)) || []; return message; + }, + fromAmino(object: QueryAggregateVotesResponseAmino): QueryAggregateVotesResponse { + const message = createBaseQueryAggregateVotesResponse(); + message.aggregateVotes = object.aggregate_votes?.map(e => AggregateExchangeRateVote.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryAggregateVotesResponse): QueryAggregateVotesResponseAmino { + const obj: any = {}; + if (message.aggregateVotes) { + obj.aggregate_votes = message.aggregateVotes.map(e => e ? AggregateExchangeRateVote.toAmino(e) : undefined); + } else { + obj.aggregate_votes = []; + } + return obj; + }, + fromAminoMsg(object: QueryAggregateVotesResponseAminoMsg): QueryAggregateVotesResponse { + return QueryAggregateVotesResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAggregateVotesResponseProtoMsg): QueryAggregateVotesResponse { + return QueryAggregateVotesResponse.decode(message.value); + }, + toProto(message: QueryAggregateVotesResponse): Uint8Array { + return QueryAggregateVotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAggregateVotesResponse): QueryAggregateVotesResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAggregateVotesResponse", + value: QueryAggregateVotesResponse.encode(message).finish() + }; } - }; - function createBaseQueryParams(): QueryParams { return {}; } - export const QueryParams = { - encode(_: QueryParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryParams", + encode(_: QueryParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParams(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): QueryParams { + fromPartial(_: Partial): QueryParams { + const message = createBaseQueryParams(); + return message; + }, + fromAmino(_: QueryParamsAmino): QueryParams { const message = createBaseQueryParams(); return message; + }, + toAmino(_: QueryParams): QueryParamsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsAminoMsg): QueryParams { + return QueryParams.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsProtoMsg): QueryParams { + return QueryParams.decode(message.value); + }, + toProto(message: QueryParams): Uint8Array { + return QueryParams.encode(message).finish(); + }, + toProtoMsg(message: QueryParams): QueryParamsProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryParams", + value: QueryParams.encode(message).finish() + }; } - }; - function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + params: Params.fromPartial({}) }; } - export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryParamsResponse { + fromPartial(object: Partial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; } - }; - function createBaseQueryMedians(): QueryMedians { return { - denom: "" + denom: "", + numStamps: 0 }; } - export const QueryMedians = { - encode(message: QueryMedians, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryMedians", + encode(message: QueryMedians, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } - + if (message.numStamps !== 0) { + writer.uint32(16).uint32(message.numStamps); + } return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryMedians { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryMedians { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMedians(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.denom = reader.string(); break; - + case 2: + message.numStamps = reader.uint32(); + break; default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryMedians { + fromPartial(object: Partial): QueryMedians { const message = createBaseQueryMedians(); message.denom = object.denom ?? ""; + message.numStamps = object.numStamps ?? 0; + return message; + }, + fromAmino(object: QueryMediansAmino): QueryMedians { + const message = createBaseQueryMedians(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.numStamps !== undefined && object.numStamps !== null) { + message.numStamps = object.numStamps; + } return message; + }, + toAmino(message: QueryMedians): QueryMediansAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.numStamps = message.numStamps; + return obj; + }, + fromAminoMsg(object: QueryMediansAminoMsg): QueryMedians { + return QueryMedians.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMediansProtoMsg): QueryMedians { + return QueryMedians.decode(message.value); + }, + toProto(message: QueryMedians): Uint8Array { + return QueryMedians.encode(message).finish(); + }, + toProtoMsg(message: QueryMedians): QueryMediansProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryMedians", + value: QueryMedians.encode(message).finish() + }; } - }; - function createBaseQueryMediansResponse(): QueryMediansResponse { return { medians: [] }; } - export const QueryMediansResponse = { - encode(message: QueryMediansResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.QueryMediansResponse", + encode(message: QueryMediansResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.medians) { - DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + Price.encode(v!, writer.uint32(10).fork()).ldelim(); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): QueryMediansResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): QueryMediansResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMediansResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: - message.medians.push(DecCoin.decode(reader, reader.uint32())); + message.medians.push(Price.decode(reader, reader.uint32())); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): QueryMediansResponse { + fromPartial(object: Partial): QueryMediansResponse { + const message = createBaseQueryMediansResponse(); + message.medians = object.medians?.map(e => Price.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryMediansResponseAmino): QueryMediansResponse { const message = createBaseQueryMediansResponse(); - message.medians = object.medians?.map(e => DecCoin.fromPartial(e)) || []; + message.medians = object.medians?.map(e => Price.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryMediansResponse): QueryMediansResponseAmino { + const obj: any = {}; + if (message.medians) { + obj.medians = message.medians.map(e => e ? Price.toAmino(e) : undefined); + } else { + obj.medians = []; + } + return obj; + }, + fromAminoMsg(object: QueryMediansResponseAminoMsg): QueryMediansResponse { + return QueryMediansResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMediansResponseProtoMsg): QueryMediansResponse { + return QueryMediansResponse.decode(message.value); + }, + toProto(message: QueryMediansResponse): Uint8Array { + return QueryMediansResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryMediansResponse): QueryMediansResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryMediansResponse", + value: QueryMediansResponse.encode(message).finish() + }; + } +}; +function createBaseQueryMedianDeviations(): QueryMedianDeviations { + return { + denom: "" + }; +} +export const QueryMedianDeviations = { + typeUrl: "/umee.oracle.v1.QueryMedianDeviations", + encode(message: QueryMedianDeviations, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMedianDeviations { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMedianDeviations(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMedianDeviations { + const message = createBaseQueryMedianDeviations(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryMedianDeviationsAmino): QueryMedianDeviations { + const message = createBaseQueryMedianDeviations(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryMedianDeviations): QueryMedianDeviationsAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryMedianDeviationsAminoMsg): QueryMedianDeviations { + return QueryMedianDeviations.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMedianDeviationsProtoMsg): QueryMedianDeviations { + return QueryMedianDeviations.decode(message.value); + }, + toProto(message: QueryMedianDeviations): Uint8Array { + return QueryMedianDeviations.encode(message).finish(); + }, + toProtoMsg(message: QueryMedianDeviations): QueryMedianDeviationsProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryMedianDeviations", + value: QueryMedianDeviations.encode(message).finish() + }; + } +}; +function createBaseQueryMedianDeviationsResponse(): QueryMedianDeviationsResponse { + return { + medianDeviations: [] + }; +} +export const QueryMedianDeviationsResponse = { + typeUrl: "/umee.oracle.v1.QueryMedianDeviationsResponse", + encode(message: QueryMedianDeviationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.medianDeviations) { + Price.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMedianDeviationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMedianDeviationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.medianDeviations.push(Price.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMedianDeviationsResponse { + const message = createBaseQueryMedianDeviationsResponse(); + message.medianDeviations = object.medianDeviations?.map(e => Price.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryMedianDeviationsResponseAmino): QueryMedianDeviationsResponse { + const message = createBaseQueryMedianDeviationsResponse(); + message.medianDeviations = object.medianDeviations?.map(e => Price.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryMedianDeviationsResponse): QueryMedianDeviationsResponseAmino { + const obj: any = {}; + if (message.medianDeviations) { + obj.medianDeviations = message.medianDeviations.map(e => e ? Price.toAmino(e) : undefined); + } else { + obj.medianDeviations = []; + } + return obj; + }, + fromAminoMsg(object: QueryMedianDeviationsResponseAminoMsg): QueryMedianDeviationsResponse { + return QueryMedianDeviationsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMedianDeviationsResponseProtoMsg): QueryMedianDeviationsResponse { + return QueryMedianDeviationsResponse.decode(message.value); + }, + toProto(message: QueryMedianDeviationsResponse): Uint8Array { + return QueryMedianDeviationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryMedianDeviationsResponse): QueryMedianDeviationsResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryMedianDeviationsResponse", + value: QueryMedianDeviationsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAvgPrice(): QueryAvgPrice { + return { + denom: "" + }; +} +export const QueryAvgPrice = { + typeUrl: "/umee.oracle.v1.QueryAvgPrice", + encode(message: QueryAvgPrice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAvgPrice { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAvgPrice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryAvgPrice { + const message = createBaseQueryAvgPrice(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryAvgPriceAmino): QueryAvgPrice { + const message = createBaseQueryAvgPrice(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryAvgPrice): QueryAvgPriceAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryAvgPriceAminoMsg): QueryAvgPrice { + return QueryAvgPrice.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAvgPriceProtoMsg): QueryAvgPrice { + return QueryAvgPrice.decode(message.value); + }, + toProto(message: QueryAvgPrice): Uint8Array { + return QueryAvgPrice.encode(message).finish(); + }, + toProtoMsg(message: QueryAvgPrice): QueryAvgPriceProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAvgPrice", + value: QueryAvgPrice.encode(message).finish() + }; + } +}; +function createBaseQueryAvgPriceResponse(): QueryAvgPriceResponse { + return { + price: "" + }; +} +export const QueryAvgPriceResponse = { + typeUrl: "/umee.oracle.v1.QueryAvgPriceResponse", + encode(message: QueryAvgPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.price !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.price, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAvgPriceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAvgPriceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.price = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryAvgPriceResponse { + const message = createBaseQueryAvgPriceResponse(); + message.price = object.price ?? ""; return message; + }, + fromAmino(object: QueryAvgPriceResponseAmino): QueryAvgPriceResponse { + const message = createBaseQueryAvgPriceResponse(); + if (object.price !== undefined && object.price !== null) { + message.price = object.price; + } + return message; + }, + toAmino(message: QueryAvgPriceResponse): QueryAvgPriceResponseAmino { + const obj: any = {}; + obj.price = message.price; + return obj; + }, + fromAminoMsg(object: QueryAvgPriceResponseAminoMsg): QueryAvgPriceResponse { + return QueryAvgPriceResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAvgPriceResponseProtoMsg): QueryAvgPriceResponse { + return QueryAvgPriceResponse.decode(message.value); + }, + toProto(message: QueryAvgPriceResponse): Uint8Array { + return QueryAvgPriceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAvgPriceResponse): QueryAvgPriceResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.QueryAvgPriceResponse", + value: QueryAvgPriceResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/tx.amino.ts b/src/codegen/umee/oracle/v1/tx.amino.ts index a20e697..7e0cb0f 100644 --- a/src/codegen/umee/oracle/v1/tx.amino.ts +++ b/src/codegen/umee/oracle/v1/tx.amino.ts @@ -1,103 +1,18 @@ -import { AminoMsg } from "@cosmjs/amino"; import { MsgAggregateExchangeRatePrevote, MsgAggregateExchangeRateVote, MsgDelegateFeedConsent } from "./tx"; -export interface AminoMsgAggregateExchangeRatePrevote extends AminoMsg { - type: "/umee.oracle.v1.MsgAggregateExchangeRatePrevote"; - value: { - hash: string; - feeder: string; - validator: string; - }; -} -export interface AminoMsgAggregateExchangeRateVote extends AminoMsg { - type: "/umee.oracle.v1.MsgAggregateExchangeRateVote"; - value: { - salt: string; - exchange_rates: string; - feeder: string; - validator: string; - }; -} -export interface AminoMsgDelegateFeedConsent extends AminoMsg { - type: "/umee.oracle.v1.MsgDelegateFeedConsent"; - value: { - operator: string; - delegate: string; - }; -} export const AminoConverter = { "/umee.oracle.v1.MsgAggregateExchangeRatePrevote": { aminoType: "/umee.oracle.v1.MsgAggregateExchangeRatePrevote", - toAmino: ({ - hash, - feeder, - validator - }: MsgAggregateExchangeRatePrevote): AminoMsgAggregateExchangeRatePrevote["value"] => { - return { - hash, - feeder, - validator - }; - }, - fromAmino: ({ - hash, - feeder, - validator - }: AminoMsgAggregateExchangeRatePrevote["value"]): MsgAggregateExchangeRatePrevote => { - return { - hash, - feeder, - validator - }; - } + toAmino: MsgAggregateExchangeRatePrevote.toAmino, + fromAmino: MsgAggregateExchangeRatePrevote.fromAmino }, "/umee.oracle.v1.MsgAggregateExchangeRateVote": { aminoType: "/umee.oracle.v1.MsgAggregateExchangeRateVote", - toAmino: ({ - salt, - exchangeRates, - feeder, - validator - }: MsgAggregateExchangeRateVote): AminoMsgAggregateExchangeRateVote["value"] => { - return { - salt, - exchange_rates: exchangeRates, - feeder, - validator - }; - }, - fromAmino: ({ - salt, - exchange_rates, - feeder, - validator - }: AminoMsgAggregateExchangeRateVote["value"]): MsgAggregateExchangeRateVote => { - return { - salt, - exchangeRates: exchange_rates, - feeder, - validator - }; - } + toAmino: MsgAggregateExchangeRateVote.toAmino, + fromAmino: MsgAggregateExchangeRateVote.fromAmino }, "/umee.oracle.v1.MsgDelegateFeedConsent": { aminoType: "/umee.oracle.v1.MsgDelegateFeedConsent", - toAmino: ({ - operator, - delegate - }: MsgDelegateFeedConsent): AminoMsgDelegateFeedConsent["value"] => { - return { - operator, - delegate - }; - }, - fromAmino: ({ - operator, - delegate - }: AminoMsgDelegateFeedConsent["value"]): MsgDelegateFeedConsent => { - return { - operator, - delegate - }; - } + toAmino: MsgDelegateFeedConsent.toAmino, + fromAmino: MsgDelegateFeedConsent.fromAmino } }; \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/tx.registry.ts b/src/codegen/umee/oracle/v1/tx.registry.ts index 01abc48..be7ca90 100644 --- a/src/codegen/umee/oracle/v1/tx.registry.ts +++ b/src/codegen/umee/oracle/v1/tx.registry.ts @@ -14,21 +14,18 @@ export const MessageComposer = { value: MsgAggregateExchangeRatePrevote.encode(value).finish() }; }, - aggregateExchangeRateVote(value: MsgAggregateExchangeRateVote) { return { typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVote", value: MsgAggregateExchangeRateVote.encode(value).finish() }; }, - delegateFeedConsent(value: MsgDelegateFeedConsent) { return { typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsent", value: MsgDelegateFeedConsent.encode(value).finish() }; } - }, withTypeUrl: { aggregateExchangeRatePrevote(value: MsgAggregateExchangeRatePrevote) { @@ -37,21 +34,18 @@ export const MessageComposer = { value }; }, - aggregateExchangeRateVote(value: MsgAggregateExchangeRateVote) { return { typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVote", value }; }, - delegateFeedConsent(value: MsgDelegateFeedConsent) { return { typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsent", value }; } - }, fromPartial: { aggregateExchangeRatePrevote(value: MsgAggregateExchangeRatePrevote) { @@ -60,20 +54,17 @@ export const MessageComposer = { value: MsgAggregateExchangeRatePrevote.fromPartial(value) }; }, - aggregateExchangeRateVote(value: MsgAggregateExchangeRateVote) { return { typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVote", value: MsgAggregateExchangeRateVote.fromPartial(value) }; }, - delegateFeedConsent(value: MsgDelegateFeedConsent) { return { typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsent", value: MsgDelegateFeedConsent.fromPartial(value) }; } - } }; \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/tx.rpc.msg.ts b/src/codegen/umee/oracle/v1/tx.rpc.msg.ts index 536713e..3240ec4 100644 --- a/src/codegen/umee/oracle/v1/tx.rpc.msg.ts +++ b/src/codegen/umee/oracle/v1/tx.rpc.msg.ts @@ -1,8 +1,7 @@ import { Rpc } from "../../../helpers"; -import * as _m0 from "protobufjs/minimal"; +import { BinaryReader } from "../../../binary"; import { MsgAggregateExchangeRatePrevote, MsgAggregateExchangeRatePrevoteResponse, MsgAggregateExchangeRateVote, MsgAggregateExchangeRateVoteResponse, MsgDelegateFeedConsent, MsgDelegateFeedConsentResponse } from "./tx"; /** Msg defines the oracle Msg service. */ - export interface Msg { /** * AggregateExchangeRatePrevote defines a method for submitting an aggregate @@ -13,38 +12,31 @@ export interface Msg { * AggregateExchangeRateVote defines a method for submitting an aggregate * exchange rate vote. */ - aggregateExchangeRateVote(request: MsgAggregateExchangeRateVote): Promise; /** DelegateFeedConsent defines a method for setting the feeder delegation. */ - delegateFeedConsent(request: MsgDelegateFeedConsent): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; - constructor(rpc: Rpc) { this.rpc = rpc; this.aggregateExchangeRatePrevote = this.aggregateExchangeRatePrevote.bind(this); this.aggregateExchangeRateVote = this.aggregateExchangeRateVote.bind(this); this.delegateFeedConsent = this.delegateFeedConsent.bind(this); } - aggregateExchangeRatePrevote(request: MsgAggregateExchangeRatePrevote): Promise { const data = MsgAggregateExchangeRatePrevote.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Msg", "AggregateExchangeRatePrevote", data); - return promise.then(data => MsgAggregateExchangeRatePrevoteResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgAggregateExchangeRatePrevoteResponse.decode(new BinaryReader(data))); } - aggregateExchangeRateVote(request: MsgAggregateExchangeRateVote): Promise { const data = MsgAggregateExchangeRateVote.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Msg", "AggregateExchangeRateVote", data); - return promise.then(data => MsgAggregateExchangeRateVoteResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgAggregateExchangeRateVoteResponse.decode(new BinaryReader(data))); } - delegateFeedConsent(request: MsgDelegateFeedConsent): Promise { const data = MsgDelegateFeedConsent.encode(request).finish(); const promise = this.rpc.request("umee.oracle.v1.Msg", "DelegateFeedConsent", data); - return promise.then(data => MsgDelegateFeedConsentResponse.decode(new _m0.Reader(data))); + return promise.then(data => MsgDelegateFeedConsentResponse.decode(new BinaryReader(data))); } - } \ No newline at end of file diff --git a/src/codegen/umee/oracle/v1/tx.ts b/src/codegen/umee/oracle/v1/tx.ts index 83ac659..418ba02 100644 --- a/src/codegen/umee/oracle/v1/tx.ts +++ b/src/codegen/umee/oracle/v1/tx.ts @@ -1,26 +1,38 @@ -import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; /** * MsgAggregateExchangeRatePrevote represents a message to submit an aggregate * exchange rate prevote. */ - export interface MsgAggregateExchangeRatePrevote { hash: string; /** Feeder is the author and the signer of the message. */ - feeder: string; validator: string; } +export interface MsgAggregateExchangeRatePrevoteProtoMsg { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRatePrevote"; + value: Uint8Array; +} +/** + * MsgAggregateExchangeRatePrevote represents a message to submit an aggregate + * exchange rate prevote. + */ +export interface MsgAggregateExchangeRatePrevoteAmino { + hash?: string; + /** Feeder is the author and the signer of the message. */ + feeder?: string; + validator?: string; +} +export interface MsgAggregateExchangeRatePrevoteAminoMsg { + type: "/umee.oracle.v1.MsgAggregateExchangeRatePrevote"; + value: MsgAggregateExchangeRatePrevoteAmino; +} /** * MsgAggregateExchangeRatePrevote represents a message to submit an aggregate * exchange rate prevote. */ - export interface MsgAggregateExchangeRatePrevoteSDKType { hash: string; - /** Feeder is the author and the signer of the message. */ - feeder: string; validator: string; } @@ -28,37 +40,62 @@ export interface MsgAggregateExchangeRatePrevoteSDKType { * MsgAggregateExchangeRatePrevoteResponse defines the * Msg/AggregateExchangeRatePrevote response type. */ - export interface MsgAggregateExchangeRatePrevoteResponse {} +export interface MsgAggregateExchangeRatePrevoteResponseProtoMsg { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRatePrevoteResponse"; + value: Uint8Array; +} +/** + * MsgAggregateExchangeRatePrevoteResponse defines the + * Msg/AggregateExchangeRatePrevote response type. + */ +export interface MsgAggregateExchangeRatePrevoteResponseAmino {} +export interface MsgAggregateExchangeRatePrevoteResponseAminoMsg { + type: "/umee.oracle.v1.MsgAggregateExchangeRatePrevoteResponse"; + value: MsgAggregateExchangeRatePrevoteResponseAmino; +} /** * MsgAggregateExchangeRatePrevoteResponse defines the * Msg/AggregateExchangeRatePrevote response type. */ - export interface MsgAggregateExchangeRatePrevoteResponseSDKType {} /** * MsgAggregateExchangeRateVote represents a message to submit anaggregate * exchange rate vote. */ - export interface MsgAggregateExchangeRateVote { salt: string; exchangeRates: string; /** Feeder is the author and the signer of the message. */ - feeder: string; validator: string; } +export interface MsgAggregateExchangeRateVoteProtoMsg { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVote"; + value: Uint8Array; +} +/** + * MsgAggregateExchangeRateVote represents a message to submit anaggregate + * exchange rate vote. + */ +export interface MsgAggregateExchangeRateVoteAmino { + salt?: string; + exchange_rates?: string; + /** Feeder is the author and the signer of the message. */ + feeder?: string; + validator?: string; +} +export interface MsgAggregateExchangeRateVoteAminoMsg { + type: "/umee.oracle.v1.MsgAggregateExchangeRateVote"; + value: MsgAggregateExchangeRateVoteAmino; +} /** * MsgAggregateExchangeRateVote represents a message to submit anaggregate * exchange rate vote. */ - export interface MsgAggregateExchangeRateVoteSDKType { salt: string; exchange_rates: string; - /** Feeder is the author and the signer of the message. */ - feeder: string; validator: string; } @@ -66,31 +103,56 @@ export interface MsgAggregateExchangeRateVoteSDKType { * MsgAggregateExchangeRateVoteResponse defines the * Msg/AggregateExchangeRateVote response type. */ - export interface MsgAggregateExchangeRateVoteResponse {} +export interface MsgAggregateExchangeRateVoteResponseProtoMsg { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVoteResponse"; + value: Uint8Array; +} +/** + * MsgAggregateExchangeRateVoteResponse defines the + * Msg/AggregateExchangeRateVote response type. + */ +export interface MsgAggregateExchangeRateVoteResponseAmino {} +export interface MsgAggregateExchangeRateVoteResponseAminoMsg { + type: "/umee.oracle.v1.MsgAggregateExchangeRateVoteResponse"; + value: MsgAggregateExchangeRateVoteResponseAmino; +} /** * MsgAggregateExchangeRateVoteResponse defines the * Msg/AggregateExchangeRateVote response type. */ - export interface MsgAggregateExchangeRateVoteResponseSDKType {} /** * MsgDelegateFeedConsent represents a message to delegate oracle voting rights * to another address. */ - export interface MsgDelegateFeedConsent { /** Operator is the author and the signer of the message. */ operator: string; delegate: string; } +export interface MsgDelegateFeedConsentProtoMsg { + typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsent"; + value: Uint8Array; +} /** * MsgDelegateFeedConsent represents a message to delegate oracle voting rights * to another address. */ - -export interface MsgDelegateFeedConsentSDKType { +export interface MsgDelegateFeedConsentAmino { /** Operator is the author and the signer of the message. */ + operator?: string; + delegate?: string; +} +export interface MsgDelegateFeedConsentAminoMsg { + type: "/umee.oracle.v1.MsgDelegateFeedConsent"; + value: MsgDelegateFeedConsentAmino; +} +/** + * MsgDelegateFeedConsent represents a message to delegate oracle voting rights + * to another address. + */ +export interface MsgDelegateFeedConsentSDKType { operator: string; delegate: string; } @@ -98,15 +160,25 @@ export interface MsgDelegateFeedConsentSDKType { * MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response * type. */ - export interface MsgDelegateFeedConsentResponse {} +export interface MsgDelegateFeedConsentResponseProtoMsg { + typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsentResponse"; + value: Uint8Array; +} +/** + * MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response + * type. + */ +export interface MsgDelegateFeedConsentResponseAmino {} +export interface MsgDelegateFeedConsentResponseAminoMsg { + type: "/umee.oracle.v1.MsgDelegateFeedConsentResponse"; + value: MsgDelegateFeedConsentResponseAmino; +} /** * MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response * type. */ - export interface MsgDelegateFeedConsentResponseSDKType {} - function createBaseMsgAggregateExchangeRatePrevote(): MsgAggregateExchangeRatePrevote { return { hash: "", @@ -114,98 +186,136 @@ function createBaseMsgAggregateExchangeRatePrevote(): MsgAggregateExchangeRatePr validator: "" }; } - export const MsgAggregateExchangeRatePrevote = { - encode(message: MsgAggregateExchangeRatePrevote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRatePrevote", + encode(message: MsgAggregateExchangeRatePrevote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== "") { writer.uint32(10).string(message.hash); } - if (message.feeder !== "") { writer.uint32(18).string(message.feeder); } - if (message.validator !== "") { writer.uint32(26).string(message.validator); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgAggregateExchangeRatePrevote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRatePrevote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgAggregateExchangeRatePrevote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.hash = reader.string(); break; - case 2: message.feeder = reader.string(); break; - case 3: message.validator = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgAggregateExchangeRatePrevote { + fromPartial(object: Partial): MsgAggregateExchangeRatePrevote { const message = createBaseMsgAggregateExchangeRatePrevote(); message.hash = object.hash ?? ""; message.feeder = object.feeder ?? ""; message.validator = object.validator ?? ""; return message; + }, + fromAmino(object: MsgAggregateExchangeRatePrevoteAmino): MsgAggregateExchangeRatePrevote { + const message = createBaseMsgAggregateExchangeRatePrevote(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + if (object.feeder !== undefined && object.feeder !== null) { + message.feeder = object.feeder; + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = object.validator; + } + return message; + }, + toAmino(message: MsgAggregateExchangeRatePrevote): MsgAggregateExchangeRatePrevoteAmino { + const obj: any = {}; + obj.hash = message.hash; + obj.feeder = message.feeder; + obj.validator = message.validator; + return obj; + }, + fromAminoMsg(object: MsgAggregateExchangeRatePrevoteAminoMsg): MsgAggregateExchangeRatePrevote { + return MsgAggregateExchangeRatePrevote.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAggregateExchangeRatePrevoteProtoMsg): MsgAggregateExchangeRatePrevote { + return MsgAggregateExchangeRatePrevote.decode(message.value); + }, + toProto(message: MsgAggregateExchangeRatePrevote): Uint8Array { + return MsgAggregateExchangeRatePrevote.encode(message).finish(); + }, + toProtoMsg(message: MsgAggregateExchangeRatePrevote): MsgAggregateExchangeRatePrevoteProtoMsg { + return { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRatePrevote", + value: MsgAggregateExchangeRatePrevote.encode(message).finish() + }; } - }; - function createBaseMsgAggregateExchangeRatePrevoteResponse(): MsgAggregateExchangeRatePrevoteResponse { return {}; } - export const MsgAggregateExchangeRatePrevoteResponse = { - encode(_: MsgAggregateExchangeRatePrevoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRatePrevoteResponse", + encode(_: MsgAggregateExchangeRatePrevoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgAggregateExchangeRatePrevoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRatePrevoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgAggregateExchangeRatePrevoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgAggregateExchangeRatePrevoteResponse { + fromPartial(_: Partial): MsgAggregateExchangeRatePrevoteResponse { const message = createBaseMsgAggregateExchangeRatePrevoteResponse(); return message; + }, + fromAmino(_: MsgAggregateExchangeRatePrevoteResponseAmino): MsgAggregateExchangeRatePrevoteResponse { + const message = createBaseMsgAggregateExchangeRatePrevoteResponse(); + return message; + }, + toAmino(_: MsgAggregateExchangeRatePrevoteResponse): MsgAggregateExchangeRatePrevoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgAggregateExchangeRatePrevoteResponseAminoMsg): MsgAggregateExchangeRatePrevoteResponse { + return MsgAggregateExchangeRatePrevoteResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAggregateExchangeRatePrevoteResponseProtoMsg): MsgAggregateExchangeRatePrevoteResponse { + return MsgAggregateExchangeRatePrevoteResponse.decode(message.value); + }, + toProto(message: MsgAggregateExchangeRatePrevoteResponse): Uint8Array { + return MsgAggregateExchangeRatePrevoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAggregateExchangeRatePrevoteResponse): MsgAggregateExchangeRatePrevoteResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRatePrevoteResponse", + value: MsgAggregateExchangeRatePrevoteResponse.encode(message).finish() + }; } - }; - function createBaseMsgAggregateExchangeRateVote(): MsgAggregateExchangeRateVote { return { salt: "", @@ -214,192 +324,269 @@ function createBaseMsgAggregateExchangeRateVote(): MsgAggregateExchangeRateVote validator: "" }; } - export const MsgAggregateExchangeRateVote = { - encode(message: MsgAggregateExchangeRateVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVote", + encode(message: MsgAggregateExchangeRateVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.salt !== "") { writer.uint32(10).string(message.salt); } - if (message.exchangeRates !== "") { writer.uint32(18).string(message.exchangeRates); } - if (message.feeder !== "") { writer.uint32(26).string(message.feeder); } - if (message.validator !== "") { writer.uint32(34).string(message.validator); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgAggregateExchangeRateVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRateVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgAggregateExchangeRateVote(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.salt = reader.string(); break; - case 2: message.exchangeRates = reader.string(); break; - case 3: message.feeder = reader.string(); break; - case 4: message.validator = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgAggregateExchangeRateVote { + fromPartial(object: Partial): MsgAggregateExchangeRateVote { const message = createBaseMsgAggregateExchangeRateVote(); message.salt = object.salt ?? ""; message.exchangeRates = object.exchangeRates ?? ""; message.feeder = object.feeder ?? ""; message.validator = object.validator ?? ""; return message; + }, + fromAmino(object: MsgAggregateExchangeRateVoteAmino): MsgAggregateExchangeRateVote { + const message = createBaseMsgAggregateExchangeRateVote(); + if (object.salt !== undefined && object.salt !== null) { + message.salt = object.salt; + } + if (object.exchange_rates !== undefined && object.exchange_rates !== null) { + message.exchangeRates = object.exchange_rates; + } + if (object.feeder !== undefined && object.feeder !== null) { + message.feeder = object.feeder; + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = object.validator; + } + return message; + }, + toAmino(message: MsgAggregateExchangeRateVote): MsgAggregateExchangeRateVoteAmino { + const obj: any = {}; + obj.salt = message.salt; + obj.exchange_rates = message.exchangeRates; + obj.feeder = message.feeder; + obj.validator = message.validator; + return obj; + }, + fromAminoMsg(object: MsgAggregateExchangeRateVoteAminoMsg): MsgAggregateExchangeRateVote { + return MsgAggregateExchangeRateVote.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAggregateExchangeRateVoteProtoMsg): MsgAggregateExchangeRateVote { + return MsgAggregateExchangeRateVote.decode(message.value); + }, + toProto(message: MsgAggregateExchangeRateVote): Uint8Array { + return MsgAggregateExchangeRateVote.encode(message).finish(); + }, + toProtoMsg(message: MsgAggregateExchangeRateVote): MsgAggregateExchangeRateVoteProtoMsg { + return { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVote", + value: MsgAggregateExchangeRateVote.encode(message).finish() + }; } - }; - function createBaseMsgAggregateExchangeRateVoteResponse(): MsgAggregateExchangeRateVoteResponse { return {}; } - export const MsgAggregateExchangeRateVoteResponse = { - encode(_: MsgAggregateExchangeRateVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVoteResponse", + encode(_: MsgAggregateExchangeRateVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgAggregateExchangeRateVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRateVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgAggregateExchangeRateVoteResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgAggregateExchangeRateVoteResponse { + fromPartial(_: Partial): MsgAggregateExchangeRateVoteResponse { const message = createBaseMsgAggregateExchangeRateVoteResponse(); return message; + }, + fromAmino(_: MsgAggregateExchangeRateVoteResponseAmino): MsgAggregateExchangeRateVoteResponse { + const message = createBaseMsgAggregateExchangeRateVoteResponse(); + return message; + }, + toAmino(_: MsgAggregateExchangeRateVoteResponse): MsgAggregateExchangeRateVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgAggregateExchangeRateVoteResponseAminoMsg): MsgAggregateExchangeRateVoteResponse { + return MsgAggregateExchangeRateVoteResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAggregateExchangeRateVoteResponseProtoMsg): MsgAggregateExchangeRateVoteResponse { + return MsgAggregateExchangeRateVoteResponse.decode(message.value); + }, + toProto(message: MsgAggregateExchangeRateVoteResponse): Uint8Array { + return MsgAggregateExchangeRateVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAggregateExchangeRateVoteResponse): MsgAggregateExchangeRateVoteResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.MsgAggregateExchangeRateVoteResponse", + value: MsgAggregateExchangeRateVoteResponse.encode(message).finish() + }; } - }; - function createBaseMsgDelegateFeedConsent(): MsgDelegateFeedConsent { return { operator: "", delegate: "" }; } - export const MsgDelegateFeedConsent = { - encode(message: MsgDelegateFeedConsent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsent", + encode(message: MsgDelegateFeedConsent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operator !== "") { writer.uint32(10).string(message.operator); } - if (message.delegate !== "") { writer.uint32(18).string(message.delegate); } - return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateFeedConsent { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateFeedConsent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDelegateFeedConsent(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { case 1: message.operator = reader.string(); break; - case 2: message.delegate = reader.string(); break; - default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(object: DeepPartial): MsgDelegateFeedConsent { + fromPartial(object: Partial): MsgDelegateFeedConsent { const message = createBaseMsgDelegateFeedConsent(); message.operator = object.operator ?? ""; message.delegate = object.delegate ?? ""; return message; + }, + fromAmino(object: MsgDelegateFeedConsentAmino): MsgDelegateFeedConsent { + const message = createBaseMsgDelegateFeedConsent(); + if (object.operator !== undefined && object.operator !== null) { + message.operator = object.operator; + } + if (object.delegate !== undefined && object.delegate !== null) { + message.delegate = object.delegate; + } + return message; + }, + toAmino(message: MsgDelegateFeedConsent): MsgDelegateFeedConsentAmino { + const obj: any = {}; + obj.operator = message.operator; + obj.delegate = message.delegate; + return obj; + }, + fromAminoMsg(object: MsgDelegateFeedConsentAminoMsg): MsgDelegateFeedConsent { + return MsgDelegateFeedConsent.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDelegateFeedConsentProtoMsg): MsgDelegateFeedConsent { + return MsgDelegateFeedConsent.decode(message.value); + }, + toProto(message: MsgDelegateFeedConsent): Uint8Array { + return MsgDelegateFeedConsent.encode(message).finish(); + }, + toProtoMsg(message: MsgDelegateFeedConsent): MsgDelegateFeedConsentProtoMsg { + return { + typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsent", + value: MsgDelegateFeedConsent.encode(message).finish() + }; } - }; - function createBaseMsgDelegateFeedConsentResponse(): MsgDelegateFeedConsentResponse { return {}; } - export const MsgDelegateFeedConsentResponse = { - encode(_: MsgDelegateFeedConsentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsentResponse", + encode(_: MsgDelegateFeedConsentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateFeedConsentResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateFeedConsentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDelegateFeedConsentResponse(); - while (reader.pos < end) { const tag = reader.uint32(); - switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } - return message; }, - - fromPartial(_: DeepPartial): MsgDelegateFeedConsentResponse { + fromPartial(_: Partial): MsgDelegateFeedConsentResponse { + const message = createBaseMsgDelegateFeedConsentResponse(); + return message; + }, + fromAmino(_: MsgDelegateFeedConsentResponseAmino): MsgDelegateFeedConsentResponse { const message = createBaseMsgDelegateFeedConsentResponse(); return message; + }, + toAmino(_: MsgDelegateFeedConsentResponse): MsgDelegateFeedConsentResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDelegateFeedConsentResponseAminoMsg): MsgDelegateFeedConsentResponse { + return MsgDelegateFeedConsentResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDelegateFeedConsentResponseProtoMsg): MsgDelegateFeedConsentResponse { + return MsgDelegateFeedConsentResponse.decode(message.value); + }, + toProto(message: MsgDelegateFeedConsentResponse): Uint8Array { + return MsgDelegateFeedConsentResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDelegateFeedConsentResponse): MsgDelegateFeedConsentResponseProtoMsg { + return { + typeUrl: "/umee.oracle.v1.MsgDelegateFeedConsentResponse", + value: MsgDelegateFeedConsentResponse.encode(message).finish() + }; } - }; \ No newline at end of file diff --git a/src/codegen/umee/rpc.query.ts b/src/codegen/umee/rpc.query.ts index ae67b01..62ad94c 100644 --- a/src/codegen/umee/rpc.query.ts +++ b/src/codegen/umee/rpc.query.ts @@ -65,11 +65,23 @@ export const createRPCQueryClient = async ({ } }, umee: { + incentive: { + v1: (await import("./incentive/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, leverage: { v1: (await import("./leverage/v1/query.rpc.Query")).createRpcQueryExtension(client) }, + metoken: { + v1: (await import("./metoken/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, oracle: { v1: (await import("./oracle/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + ugov: { + v1: (await import("./ugov/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + uibc: { + v1: (await import("./uibc/v1/query.rpc.Query")).createRpcQueryExtension(client) } } }; diff --git a/src/codegen/umee/rpc.tx.ts b/src/codegen/umee/rpc.tx.ts index af12ce7..dbb3698 100644 --- a/src/codegen/umee/rpc.tx.ts +++ b/src/codegen/umee/rpc.tx.ts @@ -47,11 +47,23 @@ export const createRPCMsgClient = async ({ } }, umee: { + incentive: { + v1: new (await import("./incentive/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, leverage: { v1: new (await import("./leverage/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, + metoken: { + v1: new (await import("./metoken/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, oracle: { v1: new (await import("./oracle/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + ugov: { + v1: new (await import("./ugov/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + uibc: { + v1: new (await import("./uibc/v1/tx.rpc.msg")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/events.ts b/src/codegen/umee/ugov/v1/events.ts new file mode 100644 index 0000000..f451241 --- /dev/null +++ b/src/codegen/umee/ugov/v1/events.ts @@ -0,0 +1,254 @@ +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { InflationParams, InflationParamsAmino, InflationParamsSDKType } from "./ugov"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** EventMinGasPrice is emitted when MsgGovUpdateMinGasPrice is correctly executed. */ +export interface EventMinGasPrice { + minGasPrices: DecCoin[]; +} +export interface EventMinGasPriceProtoMsg { + typeUrl: "/umee.ugov.v1.EventMinGasPrice"; + value: Uint8Array; +} +/** EventMinGasPrice is emitted when MsgGovUpdateMinGasPrice is correctly executed. */ +export interface EventMinGasPriceAmino { + min_gas_prices?: DecCoinAmino[]; +} +export interface EventMinGasPriceAminoMsg { + type: "/umee.ugov.v1.EventMinGasPrice"; + value: EventMinGasPriceAmino; +} +/** EventMinGasPrice is emitted when MsgGovUpdateMinGasPrice is correctly executed. */ +export interface EventMinGasPriceSDKType { + min_gas_prices: DecCoinSDKType[]; +} +/** EventEmergencyGroup is emitted when MsgGovSetEmergencyGroup is correctly executed. */ +export interface EventEmergencyGroup { + emergencyGroup: string; +} +export interface EventEmergencyGroupProtoMsg { + typeUrl: "/umee.ugov.v1.EventEmergencyGroup"; + value: Uint8Array; +} +/** EventEmergencyGroup is emitted when MsgGovSetEmergencyGroup is correctly executed. */ +export interface EventEmergencyGroupAmino { + emergency_group?: string; +} +export interface EventEmergencyGroupAminoMsg { + type: "/umee.ugov.v1.EventEmergencyGroup"; + value: EventEmergencyGroupAmino; +} +/** EventEmergencyGroup is emitted when MsgGovSetEmergencyGroup is correctly executed. */ +export interface EventEmergencyGroupSDKType { + emergency_group: string; +} +/** EventInflationParams is emitted when GovUpdateInflationParams is correctly executed. */ +export interface EventInflationParams { + params: InflationParams; +} +export interface EventInflationParamsProtoMsg { + typeUrl: "/umee.ugov.v1.EventInflationParams"; + value: Uint8Array; +} +/** EventInflationParams is emitted when GovUpdateInflationParams is correctly executed. */ +export interface EventInflationParamsAmino { + params?: InflationParamsAmino; +} +export interface EventInflationParamsAminoMsg { + type: "/umee.ugov.v1.EventInflationParams"; + value: EventInflationParamsAmino; +} +/** EventInflationParams is emitted when GovUpdateInflationParams is correctly executed. */ +export interface EventInflationParamsSDKType { + params: InflationParamsSDKType; +} +function createBaseEventMinGasPrice(): EventMinGasPrice { + return { + minGasPrices: [] + }; +} +export const EventMinGasPrice = { + typeUrl: "/umee.ugov.v1.EventMinGasPrice", + encode(message: EventMinGasPrice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.minGasPrices) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventMinGasPrice { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventMinGasPrice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minGasPrices.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventMinGasPrice { + const message = createBaseEventMinGasPrice(); + message.minGasPrices = object.minGasPrices?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EventMinGasPriceAmino): EventMinGasPrice { + const message = createBaseEventMinGasPrice(); + message.minGasPrices = object.min_gas_prices?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: EventMinGasPrice): EventMinGasPriceAmino { + const obj: any = {}; + if (message.minGasPrices) { + obj.min_gas_prices = message.minGasPrices.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.min_gas_prices = []; + } + return obj; + }, + fromAminoMsg(object: EventMinGasPriceAminoMsg): EventMinGasPrice { + return EventMinGasPrice.fromAmino(object.value); + }, + fromProtoMsg(message: EventMinGasPriceProtoMsg): EventMinGasPrice { + return EventMinGasPrice.decode(message.value); + }, + toProto(message: EventMinGasPrice): Uint8Array { + return EventMinGasPrice.encode(message).finish(); + }, + toProtoMsg(message: EventMinGasPrice): EventMinGasPriceProtoMsg { + return { + typeUrl: "/umee.ugov.v1.EventMinGasPrice", + value: EventMinGasPrice.encode(message).finish() + }; + } +}; +function createBaseEventEmergencyGroup(): EventEmergencyGroup { + return { + emergencyGroup: "" + }; +} +export const EventEmergencyGroup = { + typeUrl: "/umee.ugov.v1.EventEmergencyGroup", + encode(message: EventEmergencyGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.emergencyGroup !== "") { + writer.uint32(10).string(message.emergencyGroup); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventEmergencyGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventEmergencyGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.emergencyGroup = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventEmergencyGroup { + const message = createBaseEventEmergencyGroup(); + message.emergencyGroup = object.emergencyGroup ?? ""; + return message; + }, + fromAmino(object: EventEmergencyGroupAmino): EventEmergencyGroup { + const message = createBaseEventEmergencyGroup(); + if (object.emergency_group !== undefined && object.emergency_group !== null) { + message.emergencyGroup = object.emergency_group; + } + return message; + }, + toAmino(message: EventEmergencyGroup): EventEmergencyGroupAmino { + const obj: any = {}; + obj.emergency_group = message.emergencyGroup; + return obj; + }, + fromAminoMsg(object: EventEmergencyGroupAminoMsg): EventEmergencyGroup { + return EventEmergencyGroup.fromAmino(object.value); + }, + fromProtoMsg(message: EventEmergencyGroupProtoMsg): EventEmergencyGroup { + return EventEmergencyGroup.decode(message.value); + }, + toProto(message: EventEmergencyGroup): Uint8Array { + return EventEmergencyGroup.encode(message).finish(); + }, + toProtoMsg(message: EventEmergencyGroup): EventEmergencyGroupProtoMsg { + return { + typeUrl: "/umee.ugov.v1.EventEmergencyGroup", + value: EventEmergencyGroup.encode(message).finish() + }; + } +}; +function createBaseEventInflationParams(): EventInflationParams { + return { + params: InflationParams.fromPartial({}) + }; +} +export const EventInflationParams = { + typeUrl: "/umee.ugov.v1.EventInflationParams", + encode(message: EventInflationParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + InflationParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventInflationParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventInflationParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = InflationParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventInflationParams { + const message = createBaseEventInflationParams(); + message.params = object.params !== undefined && object.params !== null ? InflationParams.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: EventInflationParamsAmino): EventInflationParams { + const message = createBaseEventInflationParams(); + if (object.params !== undefined && object.params !== null) { + message.params = InflationParams.fromAmino(object.params); + } + return message; + }, + toAmino(message: EventInflationParams): EventInflationParamsAmino { + const obj: any = {}; + obj.params = message.params ? InflationParams.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: EventInflationParamsAminoMsg): EventInflationParams { + return EventInflationParams.fromAmino(object.value); + }, + fromProtoMsg(message: EventInflationParamsProtoMsg): EventInflationParams { + return EventInflationParams.decode(message.value); + }, + toProto(message: EventInflationParams): Uint8Array { + return EventInflationParams.encode(message).finish(); + }, + toProtoMsg(message: EventInflationParams): EventInflationParamsProtoMsg { + return { + typeUrl: "/umee.ugov.v1.EventInflationParams", + value: EventInflationParams.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/genesis.ts b/src/codegen/umee/ugov/v1/genesis.ts new file mode 100644 index 0000000..3504e7d --- /dev/null +++ b/src/codegen/umee/ugov/v1/genesis.ts @@ -0,0 +1,139 @@ +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { InflationParams, InflationParamsAmino, InflationParamsSDKType } from "./ugov"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +/** GenesisState of the ugov module. */ +export interface GenesisState { + minGasPrice: DecCoin; + /** Emergency Group address */ + emergencyGroup: string; + /** InflationParams is params for inflation rate changes */ + inflationParams: InflationParams; + /** Time when the current inflation cycle will end */ + inflationCycleEnd: Date; +} +export interface GenesisStateProtoMsg { + typeUrl: "/umee.ugov.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState of the ugov module. */ +export interface GenesisStateAmino { + min_gas_price?: DecCoinAmino; + /** Emergency Group address */ + emergency_group?: string; + /** InflationParams is params for inflation rate changes */ + inflation_params?: InflationParamsAmino; + /** Time when the current inflation cycle will end */ + inflation_cycle_end?: string; +} +export interface GenesisStateAminoMsg { + type: "/umee.ugov.v1.GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState of the ugov module. */ +export interface GenesisStateSDKType { + min_gas_price: DecCoinSDKType; + emergency_group: string; + inflation_params: InflationParamsSDKType; + inflation_cycle_end: Date; +} +function createBaseGenesisState(): GenesisState { + return { + minGasPrice: DecCoin.fromPartial({}), + emergencyGroup: "", + inflationParams: InflationParams.fromPartial({}), + inflationCycleEnd: new Date() + }; +} +export const GenesisState = { + typeUrl: "/umee.ugov.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.minGasPrice !== undefined) { + DecCoin.encode(message.minGasPrice, writer.uint32(10).fork()).ldelim(); + } + if (message.emergencyGroup !== "") { + writer.uint32(18).string(message.emergencyGroup); + } + if (message.inflationParams !== undefined) { + InflationParams.encode(message.inflationParams, writer.uint32(26).fork()).ldelim(); + } + if (message.inflationCycleEnd !== undefined) { + Timestamp.encode(toTimestamp(message.inflationCycleEnd), writer.uint32(34).fork()).ldelim(); + } + 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: + message.minGasPrice = DecCoin.decode(reader, reader.uint32()); + break; + case 2: + message.emergencyGroup = reader.string(); + break; + case 3: + message.inflationParams = InflationParams.decode(reader, reader.uint32()); + break; + case 4: + message.inflationCycleEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.minGasPrice = object.minGasPrice !== undefined && object.minGasPrice !== null ? DecCoin.fromPartial(object.minGasPrice) : undefined; + message.emergencyGroup = object.emergencyGroup ?? ""; + message.inflationParams = object.inflationParams !== undefined && object.inflationParams !== null ? InflationParams.fromPartial(object.inflationParams) : undefined; + message.inflationCycleEnd = object.inflationCycleEnd ?? undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.min_gas_price !== undefined && object.min_gas_price !== null) { + message.minGasPrice = DecCoin.fromAmino(object.min_gas_price); + } + if (object.emergency_group !== undefined && object.emergency_group !== null) { + message.emergencyGroup = object.emergency_group; + } + if (object.inflation_params !== undefined && object.inflation_params !== null) { + message.inflationParams = InflationParams.fromAmino(object.inflation_params); + } + if (object.inflation_cycle_end !== undefined && object.inflation_cycle_end !== null) { + message.inflationCycleEnd = fromTimestamp(Timestamp.fromAmino(object.inflation_cycle_end)); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.min_gas_price = message.minGasPrice ? DecCoin.toAmino(message.minGasPrice) : undefined; + obj.emergency_group = message.emergencyGroup; + obj.inflation_params = message.inflationParams ? InflationParams.toAmino(message.inflationParams) : undefined; + obj.inflation_cycle_end = message.inflationCycleEnd ? Timestamp.toAmino(toTimestamp(message.inflationCycleEnd)) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/umee.ugov.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/query.lcd.ts b/src/codegen/umee/ugov/v1/query.lcd.ts new file mode 100644 index 0000000..5f45b47 --- /dev/null +++ b/src/codegen/umee/ugov/v1/query.lcd.ts @@ -0,0 +1,36 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryMinGasPrice, QueryMinGasPriceResponseSDKType, QueryEmergencyGroup, QueryEmergencyGroupResponseSDKType, QueryInflationParams, QueryInflationParamsResponseSDKType, QueryInflationCycleEnd, QueryInflationCycleEndResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.minGasPrice = this.minGasPrice.bind(this); + this.emergencyGroup = this.emergencyGroup.bind(this); + this.inflationParams = this.inflationParams.bind(this); + this.inflationCycleEnd = this.inflationCycleEnd.bind(this); + } + /* MinGasPrice returns minimum transaction fees. */ + async minGasPrice(_params: QueryMinGasPrice = {}): Promise { + const endpoint = `umee/ugov/v1/min_gas_price`; + return await this.req.get(endpoint); + } + /* EmergencyGroup returns emergency group address */ + async emergencyGroup(_params: QueryEmergencyGroup = {}): Promise { + const endpoint = `umee/ugov/v1/emergency_group`; + return await this.req.get(endpoint); + } + /* InflationParams returns params of inflation reduction rates */ + async inflationParams(_params: QueryInflationParams = {}): Promise { + const endpoint = `umee/ugov/v1/inflation_params`; + return await this.req.get(endpoint); + } + /* InflationCycleEnd returns inflation cycle end time */ + async inflationCycleEnd(_params: QueryInflationCycleEnd = {}): Promise { + const endpoint = `umee/ugov/v1/inflation_cycle_end`; + return await this.req.get(endpoint); + } +} \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/query.rpc.Query.ts b/src/codegen/umee/ugov/v1/query.rpc.Query.ts new file mode 100644 index 0000000..72f82d5 --- /dev/null +++ b/src/codegen/umee/ugov/v1/query.rpc.Query.ts @@ -0,0 +1,63 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryMinGasPrice, QueryMinGasPriceResponse, QueryEmergencyGroup, QueryEmergencyGroupResponse, QueryInflationParams, QueryInflationParamsResponse, QueryInflationCycleEnd, QueryInflationCycleEndResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** MinGasPrice returns minimum transaction fees. */ + minGasPrice(request?: QueryMinGasPrice): Promise; + /** EmergencyGroup returns emergency group address */ + emergencyGroup(request?: QueryEmergencyGroup): Promise; + /** InflationParams returns params of inflation reduction rates */ + inflationParams(request?: QueryInflationParams): Promise; + /** InflationCycleEnd returns inflation cycle end time */ + inflationCycleEnd(request?: QueryInflationCycleEnd): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.minGasPrice = this.minGasPrice.bind(this); + this.emergencyGroup = this.emergencyGroup.bind(this); + this.inflationParams = this.inflationParams.bind(this); + this.inflationCycleEnd = this.inflationCycleEnd.bind(this); + } + minGasPrice(request: QueryMinGasPrice = {}): Promise { + const data = QueryMinGasPrice.encode(request).finish(); + const promise = this.rpc.request("umee.ugov.v1.Query", "MinGasPrice", data); + return promise.then(data => QueryMinGasPriceResponse.decode(new BinaryReader(data))); + } + emergencyGroup(request: QueryEmergencyGroup = {}): Promise { + const data = QueryEmergencyGroup.encode(request).finish(); + const promise = this.rpc.request("umee.ugov.v1.Query", "EmergencyGroup", data); + return promise.then(data => QueryEmergencyGroupResponse.decode(new BinaryReader(data))); + } + inflationParams(request: QueryInflationParams = {}): Promise { + const data = QueryInflationParams.encode(request).finish(); + const promise = this.rpc.request("umee.ugov.v1.Query", "InflationParams", data); + return promise.then(data => QueryInflationParamsResponse.decode(new BinaryReader(data))); + } + inflationCycleEnd(request: QueryInflationCycleEnd = {}): Promise { + const data = QueryInflationCycleEnd.encode(request).finish(); + const promise = this.rpc.request("umee.ugov.v1.Query", "InflationCycleEnd", data); + return promise.then(data => QueryInflationCycleEndResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + minGasPrice(request?: QueryMinGasPrice): Promise { + return queryService.minGasPrice(request); + }, + emergencyGroup(request?: QueryEmergencyGroup): Promise { + return queryService.emergencyGroup(request); + }, + inflationParams(request?: QueryInflationParams): Promise { + return queryService.inflationParams(request); + }, + inflationCycleEnd(request?: QueryInflationCycleEnd): Promise { + return queryService.inflationCycleEnd(request); + } + }; +}; \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/query.ts b/src/codegen/umee/ugov/v1/query.ts new file mode 100644 index 0000000..ee12c63 --- /dev/null +++ b/src/codegen/umee/ugov/v1/query.ts @@ -0,0 +1,593 @@ +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { InflationParams, InflationParamsAmino, InflationParamsSDKType } from "./ugov"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +/** QueryMinGasPrice is a request type. */ +export interface QueryMinGasPrice {} +export interface QueryMinGasPriceProtoMsg { + typeUrl: "/umee.ugov.v1.QueryMinGasPrice"; + value: Uint8Array; +} +/** QueryMinGasPrice is a request type. */ +export interface QueryMinGasPriceAmino {} +export interface QueryMinGasPriceAminoMsg { + type: "/umee.ugov.v1.QueryMinGasPrice"; + value: QueryMinGasPriceAmino; +} +/** QueryMinGasPrice is a request type. */ +export interface QueryMinGasPriceSDKType {} +/** QueryMinGasPriceResponse response type. */ +export interface QueryMinGasPriceResponse { + minGasPrice: DecCoin; +} +export interface QueryMinGasPriceResponseProtoMsg { + typeUrl: "/umee.ugov.v1.QueryMinGasPriceResponse"; + value: Uint8Array; +} +/** QueryMinGasPriceResponse response type. */ +export interface QueryMinGasPriceResponseAmino { + min_gas_price?: DecCoinAmino; +} +export interface QueryMinGasPriceResponseAminoMsg { + type: "/umee.ugov.v1.QueryMinGasPriceResponse"; + value: QueryMinGasPriceResponseAmino; +} +/** QueryMinGasPriceResponse response type. */ +export interface QueryMinGasPriceResponseSDKType { + min_gas_price: DecCoinSDKType; +} +/** QueryEmergencyGroup request type. */ +export interface QueryEmergencyGroup {} +export interface QueryEmergencyGroupProtoMsg { + typeUrl: "/umee.ugov.v1.QueryEmergencyGroup"; + value: Uint8Array; +} +/** QueryEmergencyGroup request type. */ +export interface QueryEmergencyGroupAmino {} +export interface QueryEmergencyGroupAminoMsg { + type: "/umee.ugov.v1.QueryEmergencyGroup"; + value: QueryEmergencyGroupAmino; +} +/** QueryEmergencyGroup request type. */ +export interface QueryEmergencyGroupSDKType {} +/** QueryEmergencyGroupResponse response type. */ +export interface QueryEmergencyGroupResponse { + emergencyGroup: string; +} +export interface QueryEmergencyGroupResponseProtoMsg { + typeUrl: "/umee.ugov.v1.QueryEmergencyGroupResponse"; + value: Uint8Array; +} +/** QueryEmergencyGroupResponse response type. */ +export interface QueryEmergencyGroupResponseAmino { + emergency_group?: string; +} +export interface QueryEmergencyGroupResponseAminoMsg { + type: "/umee.ugov.v1.QueryEmergencyGroupResponse"; + value: QueryEmergencyGroupResponseAmino; +} +/** QueryEmergencyGroupResponse response type. */ +export interface QueryEmergencyGroupResponseSDKType { + emergency_group: string; +} +/** QueryInflationParams request type. */ +export interface QueryInflationParams {} +export interface QueryInflationParamsProtoMsg { + typeUrl: "/umee.ugov.v1.QueryInflationParams"; + value: Uint8Array; +} +/** QueryInflationParams request type. */ +export interface QueryInflationParamsAmino {} +export interface QueryInflationParamsAminoMsg { + type: "/umee.ugov.v1.QueryInflationParams"; + value: QueryInflationParamsAmino; +} +/** QueryInflationParams request type. */ +export interface QueryInflationParamsSDKType {} +/** QueryInflationParamsResponse response type. */ +export interface QueryInflationParamsResponse { + params: InflationParams; +} +export interface QueryInflationParamsResponseProtoMsg { + typeUrl: "/umee.ugov.v1.QueryInflationParamsResponse"; + value: Uint8Array; +} +/** QueryInflationParamsResponse response type. */ +export interface QueryInflationParamsResponseAmino { + params?: InflationParamsAmino; +} +export interface QueryInflationParamsResponseAminoMsg { + type: "/umee.ugov.v1.QueryInflationParamsResponse"; + value: QueryInflationParamsResponseAmino; +} +/** QueryInflationParamsResponse response type. */ +export interface QueryInflationParamsResponseSDKType { + params: InflationParamsSDKType; +} +/** QueryInflationCycleEnd request type. */ +export interface QueryInflationCycleEnd {} +export interface QueryInflationCycleEndProtoMsg { + typeUrl: "/umee.ugov.v1.QueryInflationCycleEnd"; + value: Uint8Array; +} +/** QueryInflationCycleEnd request type. */ +export interface QueryInflationCycleEndAmino {} +export interface QueryInflationCycleEndAminoMsg { + type: "/umee.ugov.v1.QueryInflationCycleEnd"; + value: QueryInflationCycleEndAmino; +} +/** QueryInflationCycleEnd request type. */ +export interface QueryInflationCycleEndSDKType {} +/** QueryInflationCycleEndResponse response type. */ +export interface QueryInflationCycleEndResponse { + end?: Date; +} +export interface QueryInflationCycleEndResponseProtoMsg { + typeUrl: "/umee.ugov.v1.QueryInflationCycleEndResponse"; + value: Uint8Array; +} +/** QueryInflationCycleEndResponse response type. */ +export interface QueryInflationCycleEndResponseAmino { + end?: string; +} +export interface QueryInflationCycleEndResponseAminoMsg { + type: "/umee.ugov.v1.QueryInflationCycleEndResponse"; + value: QueryInflationCycleEndResponseAmino; +} +/** QueryInflationCycleEndResponse response type. */ +export interface QueryInflationCycleEndResponseSDKType { + end?: Date; +} +function createBaseQueryMinGasPrice(): QueryMinGasPrice { + return {}; +} +export const QueryMinGasPrice = { + typeUrl: "/umee.ugov.v1.QueryMinGasPrice", + encode(_: QueryMinGasPrice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMinGasPrice { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMinGasPrice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryMinGasPrice { + const message = createBaseQueryMinGasPrice(); + return message; + }, + fromAmino(_: QueryMinGasPriceAmino): QueryMinGasPrice { + const message = createBaseQueryMinGasPrice(); + return message; + }, + toAmino(_: QueryMinGasPrice): QueryMinGasPriceAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryMinGasPriceAminoMsg): QueryMinGasPrice { + return QueryMinGasPrice.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMinGasPriceProtoMsg): QueryMinGasPrice { + return QueryMinGasPrice.decode(message.value); + }, + toProto(message: QueryMinGasPrice): Uint8Array { + return QueryMinGasPrice.encode(message).finish(); + }, + toProtoMsg(message: QueryMinGasPrice): QueryMinGasPriceProtoMsg { + return { + typeUrl: "/umee.ugov.v1.QueryMinGasPrice", + value: QueryMinGasPrice.encode(message).finish() + }; + } +}; +function createBaseQueryMinGasPriceResponse(): QueryMinGasPriceResponse { + return { + minGasPrice: DecCoin.fromPartial({}) + }; +} +export const QueryMinGasPriceResponse = { + typeUrl: "/umee.ugov.v1.QueryMinGasPriceResponse", + encode(message: QueryMinGasPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.minGasPrice !== undefined) { + DecCoin.encode(message.minGasPrice, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMinGasPriceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMinGasPriceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minGasPrice = DecCoin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryMinGasPriceResponse { + const message = createBaseQueryMinGasPriceResponse(); + message.minGasPrice = object.minGasPrice !== undefined && object.minGasPrice !== null ? DecCoin.fromPartial(object.minGasPrice) : undefined; + return message; + }, + fromAmino(object: QueryMinGasPriceResponseAmino): QueryMinGasPriceResponse { + const message = createBaseQueryMinGasPriceResponse(); + if (object.min_gas_price !== undefined && object.min_gas_price !== null) { + message.minGasPrice = DecCoin.fromAmino(object.min_gas_price); + } + return message; + }, + toAmino(message: QueryMinGasPriceResponse): QueryMinGasPriceResponseAmino { + const obj: any = {}; + obj.min_gas_price = message.minGasPrice ? DecCoin.toAmino(message.minGasPrice) : undefined; + return obj; + }, + fromAminoMsg(object: QueryMinGasPriceResponseAminoMsg): QueryMinGasPriceResponse { + return QueryMinGasPriceResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryMinGasPriceResponseProtoMsg): QueryMinGasPriceResponse { + return QueryMinGasPriceResponse.decode(message.value); + }, + toProto(message: QueryMinGasPriceResponse): Uint8Array { + return QueryMinGasPriceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryMinGasPriceResponse): QueryMinGasPriceResponseProtoMsg { + return { + typeUrl: "/umee.ugov.v1.QueryMinGasPriceResponse", + value: QueryMinGasPriceResponse.encode(message).finish() + }; + } +}; +function createBaseQueryEmergencyGroup(): QueryEmergencyGroup { + return {}; +} +export const QueryEmergencyGroup = { + typeUrl: "/umee.ugov.v1.QueryEmergencyGroup", + encode(_: QueryEmergencyGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryEmergencyGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEmergencyGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryEmergencyGroup { + const message = createBaseQueryEmergencyGroup(); + return message; + }, + fromAmino(_: QueryEmergencyGroupAmino): QueryEmergencyGroup { + const message = createBaseQueryEmergencyGroup(); + return message; + }, + toAmino(_: QueryEmergencyGroup): QueryEmergencyGroupAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryEmergencyGroupAminoMsg): QueryEmergencyGroup { + return QueryEmergencyGroup.fromAmino(object.value); + }, + fromProtoMsg(message: QueryEmergencyGroupProtoMsg): QueryEmergencyGroup { + return QueryEmergencyGroup.decode(message.value); + }, + toProto(message: QueryEmergencyGroup): Uint8Array { + return QueryEmergencyGroup.encode(message).finish(); + }, + toProtoMsg(message: QueryEmergencyGroup): QueryEmergencyGroupProtoMsg { + return { + typeUrl: "/umee.ugov.v1.QueryEmergencyGroup", + value: QueryEmergencyGroup.encode(message).finish() + }; + } +}; +function createBaseQueryEmergencyGroupResponse(): QueryEmergencyGroupResponse { + return { + emergencyGroup: "" + }; +} +export const QueryEmergencyGroupResponse = { + typeUrl: "/umee.ugov.v1.QueryEmergencyGroupResponse", + encode(message: QueryEmergencyGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.emergencyGroup !== "") { + writer.uint32(10).string(message.emergencyGroup); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryEmergencyGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEmergencyGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.emergencyGroup = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryEmergencyGroupResponse { + const message = createBaseQueryEmergencyGroupResponse(); + message.emergencyGroup = object.emergencyGroup ?? ""; + return message; + }, + fromAmino(object: QueryEmergencyGroupResponseAmino): QueryEmergencyGroupResponse { + const message = createBaseQueryEmergencyGroupResponse(); + if (object.emergency_group !== undefined && object.emergency_group !== null) { + message.emergencyGroup = object.emergency_group; + } + return message; + }, + toAmino(message: QueryEmergencyGroupResponse): QueryEmergencyGroupResponseAmino { + const obj: any = {}; + obj.emergency_group = message.emergencyGroup; + return obj; + }, + fromAminoMsg(object: QueryEmergencyGroupResponseAminoMsg): QueryEmergencyGroupResponse { + return QueryEmergencyGroupResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryEmergencyGroupResponseProtoMsg): QueryEmergencyGroupResponse { + return QueryEmergencyGroupResponse.decode(message.value); + }, + toProto(message: QueryEmergencyGroupResponse): Uint8Array { + return QueryEmergencyGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryEmergencyGroupResponse): QueryEmergencyGroupResponseProtoMsg { + return { + typeUrl: "/umee.ugov.v1.QueryEmergencyGroupResponse", + value: QueryEmergencyGroupResponse.encode(message).finish() + }; + } +}; +function createBaseQueryInflationParams(): QueryInflationParams { + return {}; +} +export const QueryInflationParams = { + typeUrl: "/umee.ugov.v1.QueryInflationParams", + encode(_: QueryInflationParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryInflationParams { + const message = createBaseQueryInflationParams(); + return message; + }, + fromAmino(_: QueryInflationParamsAmino): QueryInflationParams { + const message = createBaseQueryInflationParams(); + return message; + }, + toAmino(_: QueryInflationParams): QueryInflationParamsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryInflationParamsAminoMsg): QueryInflationParams { + return QueryInflationParams.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInflationParamsProtoMsg): QueryInflationParams { + return QueryInflationParams.decode(message.value); + }, + toProto(message: QueryInflationParams): Uint8Array { + return QueryInflationParams.encode(message).finish(); + }, + toProtoMsg(message: QueryInflationParams): QueryInflationParamsProtoMsg { + return { + typeUrl: "/umee.ugov.v1.QueryInflationParams", + value: QueryInflationParams.encode(message).finish() + }; + } +}; +function createBaseQueryInflationParamsResponse(): QueryInflationParamsResponse { + return { + params: InflationParams.fromPartial({}) + }; +} +export const QueryInflationParamsResponse = { + typeUrl: "/umee.ugov.v1.QueryInflationParamsResponse", + encode(message: QueryInflationParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + InflationParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = InflationParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryInflationParamsResponse { + const message = createBaseQueryInflationParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? InflationParams.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryInflationParamsResponseAmino): QueryInflationParamsResponse { + const message = createBaseQueryInflationParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = InflationParams.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryInflationParamsResponse): QueryInflationParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? InflationParams.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryInflationParamsResponseAminoMsg): QueryInflationParamsResponse { + return QueryInflationParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInflationParamsResponseProtoMsg): QueryInflationParamsResponse { + return QueryInflationParamsResponse.decode(message.value); + }, + toProto(message: QueryInflationParamsResponse): Uint8Array { + return QueryInflationParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryInflationParamsResponse): QueryInflationParamsResponseProtoMsg { + return { + typeUrl: "/umee.ugov.v1.QueryInflationParamsResponse", + value: QueryInflationParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryInflationCycleEnd(): QueryInflationCycleEnd { + return {}; +} +export const QueryInflationCycleEnd = { + typeUrl: "/umee.ugov.v1.QueryInflationCycleEnd", + encode(_: QueryInflationCycleEnd, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationCycleEnd { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationCycleEnd(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryInflationCycleEnd { + const message = createBaseQueryInflationCycleEnd(); + return message; + }, + fromAmino(_: QueryInflationCycleEndAmino): QueryInflationCycleEnd { + const message = createBaseQueryInflationCycleEnd(); + return message; + }, + toAmino(_: QueryInflationCycleEnd): QueryInflationCycleEndAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryInflationCycleEndAminoMsg): QueryInflationCycleEnd { + return QueryInflationCycleEnd.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInflationCycleEndProtoMsg): QueryInflationCycleEnd { + return QueryInflationCycleEnd.decode(message.value); + }, + toProto(message: QueryInflationCycleEnd): Uint8Array { + return QueryInflationCycleEnd.encode(message).finish(); + }, + toProtoMsg(message: QueryInflationCycleEnd): QueryInflationCycleEndProtoMsg { + return { + typeUrl: "/umee.ugov.v1.QueryInflationCycleEnd", + value: QueryInflationCycleEnd.encode(message).finish() + }; + } +}; +function createBaseQueryInflationCycleEndResponse(): QueryInflationCycleEndResponse { + return { + end: undefined + }; +} +export const QueryInflationCycleEndResponse = { + typeUrl: "/umee.ugov.v1.QueryInflationCycleEndResponse", + encode(message: QueryInflationCycleEndResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.end !== undefined) { + Timestamp.encode(toTimestamp(message.end), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationCycleEndResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationCycleEndResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.end = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryInflationCycleEndResponse { + const message = createBaseQueryInflationCycleEndResponse(); + message.end = object.end ?? undefined; + return message; + }, + fromAmino(object: QueryInflationCycleEndResponseAmino): QueryInflationCycleEndResponse { + const message = createBaseQueryInflationCycleEndResponse(); + if (object.end !== undefined && object.end !== null) { + message.end = fromTimestamp(Timestamp.fromAmino(object.end)); + } + return message; + }, + toAmino(message: QueryInflationCycleEndResponse): QueryInflationCycleEndResponseAmino { + const obj: any = {}; + obj.end = message.end ? Timestamp.toAmino(toTimestamp(message.end)) : undefined; + return obj; + }, + fromAminoMsg(object: QueryInflationCycleEndResponseAminoMsg): QueryInflationCycleEndResponse { + return QueryInflationCycleEndResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInflationCycleEndResponseProtoMsg): QueryInflationCycleEndResponse { + return QueryInflationCycleEndResponse.decode(message.value); + }, + toProto(message: QueryInflationCycleEndResponse): Uint8Array { + return QueryInflationCycleEndResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryInflationCycleEndResponse): QueryInflationCycleEndResponseProtoMsg { + return { + typeUrl: "/umee.ugov.v1.QueryInflationCycleEndResponse", + value: QueryInflationCycleEndResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/tx.amino.ts b/src/codegen/umee/ugov/v1/tx.amino.ts new file mode 100644 index 0000000..82646be --- /dev/null +++ b/src/codegen/umee/ugov/v1/tx.amino.ts @@ -0,0 +1,18 @@ +import { MsgGovUpdateMinGasPrice, MsgGovSetEmergencyGroup, MsgGovUpdateInflationParams } from "./tx"; +export const AminoConverter = { + "/umee.ugov.v1.MsgGovUpdateMinGasPrice": { + aminoType: "/umee.ugov.v1.MsgGovUpdateMinGasPrice", + toAmino: MsgGovUpdateMinGasPrice.toAmino, + fromAmino: MsgGovUpdateMinGasPrice.fromAmino + }, + "/umee.ugov.v1.MsgGovSetEmergencyGroup": { + aminoType: "/umee.ugov.v1.MsgGovSetEmergencyGroup", + toAmino: MsgGovSetEmergencyGroup.toAmino, + fromAmino: MsgGovSetEmergencyGroup.fromAmino + }, + "/umee.ugov.v1.MsgGovUpdateInflationParams": { + aminoType: "/umee.ugov.v1.MsgGovUpdateInflationParams", + toAmino: MsgGovUpdateInflationParams.toAmino, + fromAmino: MsgGovUpdateInflationParams.fromAmino + } +}; \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/tx.registry.ts b/src/codegen/umee/ugov/v1/tx.registry.ts new file mode 100644 index 0000000..0a2c42e --- /dev/null +++ b/src/codegen/umee/ugov/v1/tx.registry.ts @@ -0,0 +1,70 @@ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgGovUpdateMinGasPrice, MsgGovSetEmergencyGroup, MsgGovUpdateInflationParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/umee.ugov.v1.MsgGovUpdateMinGasPrice", MsgGovUpdateMinGasPrice], ["/umee.ugov.v1.MsgGovSetEmergencyGroup", MsgGovSetEmergencyGroup], ["/umee.ugov.v1.MsgGovUpdateInflationParams", MsgGovUpdateInflationParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + govUpdateMinGasPrice(value: MsgGovUpdateMinGasPrice) { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPrice", + value: MsgGovUpdateMinGasPrice.encode(value).finish() + }; + }, + govSetEmergencyGroup(value: MsgGovSetEmergencyGroup) { + return { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroup", + value: MsgGovSetEmergencyGroup.encode(value).finish() + }; + }, + govUpdateInflationParams(value: MsgGovUpdateInflationParams) { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateInflationParams", + value: MsgGovUpdateInflationParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + govUpdateMinGasPrice(value: MsgGovUpdateMinGasPrice) { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPrice", + value + }; + }, + govSetEmergencyGroup(value: MsgGovSetEmergencyGroup) { + return { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroup", + value + }; + }, + govUpdateInflationParams(value: MsgGovUpdateInflationParams) { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateInflationParams", + value + }; + } + }, + fromPartial: { + govUpdateMinGasPrice(value: MsgGovUpdateMinGasPrice) { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPrice", + value: MsgGovUpdateMinGasPrice.fromPartial(value) + }; + }, + govSetEmergencyGroup(value: MsgGovSetEmergencyGroup) { + return { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroup", + value: MsgGovSetEmergencyGroup.fromPartial(value) + }; + }, + govUpdateInflationParams(value: MsgGovUpdateInflationParams) { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateInflationParams", + value: MsgGovUpdateInflationParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/tx.rpc.msg.ts b/src/codegen/umee/ugov/v1/tx.rpc.msg.ts new file mode 100644 index 0000000..3bb9d95 --- /dev/null +++ b/src/codegen/umee/ugov/v1/tx.rpc.msg.ts @@ -0,0 +1,36 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgGovUpdateMinGasPrice, MsgGovUpdateMinGasPriceResponse, MsgGovSetEmergencyGroup, MsgGovSetEmergencyGroupResponse, MsgGovUpdateInflationParams, GovUpdateInflationParamsResponse } from "./tx"; +/** Msg defines the x/ugov module's Msg service. */ +export interface Msg { + /** GovUpdateMinGasPrice sets protocol controlled tx min fees. */ + govUpdateMinGasPrice(request: MsgGovUpdateMinGasPrice): Promise; + /** GovSetEmergencyGroup sets emergency group address. */ + govSetEmergencyGroup(request: MsgGovSetEmergencyGroup): Promise; + /** GovUpdateInflationParams sets new params for inflation rate change. */ + govUpdateInflationParams(request: MsgGovUpdateInflationParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.govUpdateMinGasPrice = this.govUpdateMinGasPrice.bind(this); + this.govSetEmergencyGroup = this.govSetEmergencyGroup.bind(this); + this.govUpdateInflationParams = this.govUpdateInflationParams.bind(this); + } + govUpdateMinGasPrice(request: MsgGovUpdateMinGasPrice): Promise { + const data = MsgGovUpdateMinGasPrice.encode(request).finish(); + const promise = this.rpc.request("umee.ugov.v1.Msg", "GovUpdateMinGasPrice", data); + return promise.then(data => MsgGovUpdateMinGasPriceResponse.decode(new BinaryReader(data))); + } + govSetEmergencyGroup(request: MsgGovSetEmergencyGroup): Promise { + const data = MsgGovSetEmergencyGroup.encode(request).finish(); + const promise = this.rpc.request("umee.ugov.v1.Msg", "GovSetEmergencyGroup", data); + return promise.then(data => MsgGovSetEmergencyGroupResponse.decode(new BinaryReader(data))); + } + govUpdateInflationParams(request: MsgGovUpdateInflationParams): Promise { + const data = MsgGovUpdateInflationParams.encode(request).finish(); + const promise = this.rpc.request("umee.ugov.v1.Msg", "GovUpdateInflationParams", data); + return promise.then(data => GovUpdateInflationParamsResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/tx.ts b/src/codegen/umee/ugov/v1/tx.ts new file mode 100644 index 0000000..9055e4b --- /dev/null +++ b/src/codegen/umee/ugov/v1/tx.ts @@ -0,0 +1,495 @@ +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { InflationParams, InflationParamsAmino, InflationParamsSDKType } from "./ugov"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** MsgGovUpdateMinGasPrice request type. */ +export interface MsgGovUpdateMinGasPrice { + /** authority must be the address of the governance account. */ + authority: string; + minGasPrice: DecCoin; +} +export interface MsgGovUpdateMinGasPriceProtoMsg { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPrice"; + value: Uint8Array; +} +/** MsgGovUpdateMinGasPrice request type. */ +export interface MsgGovUpdateMinGasPriceAmino { + /** authority must be the address of the governance account. */ + authority?: string; + min_gas_price?: DecCoinAmino; +} +export interface MsgGovUpdateMinGasPriceAminoMsg { + type: "/umee.ugov.v1.MsgGovUpdateMinGasPrice"; + value: MsgGovUpdateMinGasPriceAmino; +} +/** MsgGovUpdateMinGasPrice request type. */ +export interface MsgGovUpdateMinGasPriceSDKType { + authority: string; + min_gas_price: DecCoinSDKType; +} +/** MsgGovUpdateMinGasPriceResponse response type. */ +export interface MsgGovUpdateMinGasPriceResponse {} +export interface MsgGovUpdateMinGasPriceResponseProtoMsg { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPriceResponse"; + value: Uint8Array; +} +/** MsgGovUpdateMinGasPriceResponse response type. */ +export interface MsgGovUpdateMinGasPriceResponseAmino {} +export interface MsgGovUpdateMinGasPriceResponseAminoMsg { + type: "/umee.ugov.v1.MsgGovUpdateMinGasPriceResponse"; + value: MsgGovUpdateMinGasPriceResponseAmino; +} +/** MsgGovUpdateMinGasPriceResponse response type. */ +export interface MsgGovUpdateMinGasPriceResponseSDKType {} +/** MsgGovSetEmergencyGroup request type. */ +export interface MsgGovSetEmergencyGroup { + /** authority must be the address of the governance account. */ + authority: string; + emergencyGroup: string; +} +export interface MsgGovSetEmergencyGroupProtoMsg { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroup"; + value: Uint8Array; +} +/** MsgGovSetEmergencyGroup request type. */ +export interface MsgGovSetEmergencyGroupAmino { + /** authority must be the address of the governance account. */ + authority?: string; + emergency_group?: string; +} +export interface MsgGovSetEmergencyGroupAminoMsg { + type: "/umee.ugov.v1.MsgGovSetEmergencyGroup"; + value: MsgGovSetEmergencyGroupAmino; +} +/** MsgGovSetEmergencyGroup request type. */ +export interface MsgGovSetEmergencyGroupSDKType { + authority: string; + emergency_group: string; +} +/** MsgGovSetEmergencyGroupResponse response type. */ +export interface MsgGovSetEmergencyGroupResponse {} +export interface MsgGovSetEmergencyGroupResponseProtoMsg { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroupResponse"; + value: Uint8Array; +} +/** MsgGovSetEmergencyGroupResponse response type. */ +export interface MsgGovSetEmergencyGroupResponseAmino {} +export interface MsgGovSetEmergencyGroupResponseAminoMsg { + type: "/umee.ugov.v1.MsgGovSetEmergencyGroupResponse"; + value: MsgGovSetEmergencyGroupResponseAmino; +} +/** MsgGovSetEmergencyGroupResponse response type. */ +export interface MsgGovSetEmergencyGroupResponseSDKType {} +/** MsgGovUpdateInflationParams request type. */ +export interface MsgGovUpdateInflationParams { + /** authority must be the address of the governance account. */ + authority: string; + params: InflationParams; +} +export interface MsgGovUpdateInflationParamsProtoMsg { + typeUrl: "/umee.ugov.v1.MsgGovUpdateInflationParams"; + value: Uint8Array; +} +/** MsgGovUpdateInflationParams request type. */ +export interface MsgGovUpdateInflationParamsAmino { + /** authority must be the address of the governance account. */ + authority?: string; + params?: InflationParamsAmino; +} +export interface MsgGovUpdateInflationParamsAminoMsg { + type: "/umee.ugov.v1.MsgGovUpdateInflationParams"; + value: MsgGovUpdateInflationParamsAmino; +} +/** MsgGovUpdateInflationParams request type. */ +export interface MsgGovUpdateInflationParamsSDKType { + authority: string; + params: InflationParamsSDKType; +} +/** GovUpdateInflationParamsResponse response type. */ +export interface GovUpdateInflationParamsResponse {} +export interface GovUpdateInflationParamsResponseProtoMsg { + typeUrl: "/umee.ugov.v1.GovUpdateInflationParamsResponse"; + value: Uint8Array; +} +/** GovUpdateInflationParamsResponse response type. */ +export interface GovUpdateInflationParamsResponseAmino {} +export interface GovUpdateInflationParamsResponseAminoMsg { + type: "/umee.ugov.v1.GovUpdateInflationParamsResponse"; + value: GovUpdateInflationParamsResponseAmino; +} +/** GovUpdateInflationParamsResponse response type. */ +export interface GovUpdateInflationParamsResponseSDKType {} +function createBaseMsgGovUpdateMinGasPrice(): MsgGovUpdateMinGasPrice { + return { + authority: "", + minGasPrice: DecCoin.fromPartial({}) + }; +} +export const MsgGovUpdateMinGasPrice = { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPrice", + encode(message: MsgGovUpdateMinGasPrice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.minGasPrice !== undefined) { + DecCoin.encode(message.minGasPrice, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateMinGasPrice { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateMinGasPrice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.minGasPrice = DecCoin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovUpdateMinGasPrice { + const message = createBaseMsgGovUpdateMinGasPrice(); + message.authority = object.authority ?? ""; + message.minGasPrice = object.minGasPrice !== undefined && object.minGasPrice !== null ? DecCoin.fromPartial(object.minGasPrice) : undefined; + return message; + }, + fromAmino(object: MsgGovUpdateMinGasPriceAmino): MsgGovUpdateMinGasPrice { + const message = createBaseMsgGovUpdateMinGasPrice(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.min_gas_price !== undefined && object.min_gas_price !== null) { + message.minGasPrice = DecCoin.fromAmino(object.min_gas_price); + } + return message; + }, + toAmino(message: MsgGovUpdateMinGasPrice): MsgGovUpdateMinGasPriceAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.min_gas_price = message.minGasPrice ? DecCoin.toAmino(message.minGasPrice) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGovUpdateMinGasPriceAminoMsg): MsgGovUpdateMinGasPrice { + return MsgGovUpdateMinGasPrice.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateMinGasPriceProtoMsg): MsgGovUpdateMinGasPrice { + return MsgGovUpdateMinGasPrice.decode(message.value); + }, + toProto(message: MsgGovUpdateMinGasPrice): Uint8Array { + return MsgGovUpdateMinGasPrice.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateMinGasPrice): MsgGovUpdateMinGasPriceProtoMsg { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPrice", + value: MsgGovUpdateMinGasPrice.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateMinGasPriceResponse(): MsgGovUpdateMinGasPriceResponse { + return {}; +} +export const MsgGovUpdateMinGasPriceResponse = { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPriceResponse", + encode(_: MsgGovUpdateMinGasPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateMinGasPriceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateMinGasPriceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovUpdateMinGasPriceResponse { + const message = createBaseMsgGovUpdateMinGasPriceResponse(); + return message; + }, + fromAmino(_: MsgGovUpdateMinGasPriceResponseAmino): MsgGovUpdateMinGasPriceResponse { + const message = createBaseMsgGovUpdateMinGasPriceResponse(); + return message; + }, + toAmino(_: MsgGovUpdateMinGasPriceResponse): MsgGovUpdateMinGasPriceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovUpdateMinGasPriceResponseAminoMsg): MsgGovUpdateMinGasPriceResponse { + return MsgGovUpdateMinGasPriceResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateMinGasPriceResponseProtoMsg): MsgGovUpdateMinGasPriceResponse { + return MsgGovUpdateMinGasPriceResponse.decode(message.value); + }, + toProto(message: MsgGovUpdateMinGasPriceResponse): Uint8Array { + return MsgGovUpdateMinGasPriceResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateMinGasPriceResponse): MsgGovUpdateMinGasPriceResponseProtoMsg { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateMinGasPriceResponse", + value: MsgGovUpdateMinGasPriceResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetEmergencyGroup(): MsgGovSetEmergencyGroup { + return { + authority: "", + emergencyGroup: "" + }; +} +export const MsgGovSetEmergencyGroup = { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroup", + encode(message: MsgGovSetEmergencyGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.emergencyGroup !== "") { + writer.uint32(18).string(message.emergencyGroup); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetEmergencyGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetEmergencyGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.emergencyGroup = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovSetEmergencyGroup { + const message = createBaseMsgGovSetEmergencyGroup(); + message.authority = object.authority ?? ""; + message.emergencyGroup = object.emergencyGroup ?? ""; + return message; + }, + fromAmino(object: MsgGovSetEmergencyGroupAmino): MsgGovSetEmergencyGroup { + const message = createBaseMsgGovSetEmergencyGroup(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.emergency_group !== undefined && object.emergency_group !== null) { + message.emergencyGroup = object.emergency_group; + } + return message; + }, + toAmino(message: MsgGovSetEmergencyGroup): MsgGovSetEmergencyGroupAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.emergency_group = message.emergencyGroup; + return obj; + }, + fromAminoMsg(object: MsgGovSetEmergencyGroupAminoMsg): MsgGovSetEmergencyGroup { + return MsgGovSetEmergencyGroup.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetEmergencyGroupProtoMsg): MsgGovSetEmergencyGroup { + return MsgGovSetEmergencyGroup.decode(message.value); + }, + toProto(message: MsgGovSetEmergencyGroup): Uint8Array { + return MsgGovSetEmergencyGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetEmergencyGroup): MsgGovSetEmergencyGroupProtoMsg { + return { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroup", + value: MsgGovSetEmergencyGroup.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetEmergencyGroupResponse(): MsgGovSetEmergencyGroupResponse { + return {}; +} +export const MsgGovSetEmergencyGroupResponse = { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroupResponse", + encode(_: MsgGovSetEmergencyGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetEmergencyGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetEmergencyGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovSetEmergencyGroupResponse { + const message = createBaseMsgGovSetEmergencyGroupResponse(); + return message; + }, + fromAmino(_: MsgGovSetEmergencyGroupResponseAmino): MsgGovSetEmergencyGroupResponse { + const message = createBaseMsgGovSetEmergencyGroupResponse(); + return message; + }, + toAmino(_: MsgGovSetEmergencyGroupResponse): MsgGovSetEmergencyGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovSetEmergencyGroupResponseAminoMsg): MsgGovSetEmergencyGroupResponse { + return MsgGovSetEmergencyGroupResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetEmergencyGroupResponseProtoMsg): MsgGovSetEmergencyGroupResponse { + return MsgGovSetEmergencyGroupResponse.decode(message.value); + }, + toProto(message: MsgGovSetEmergencyGroupResponse): Uint8Array { + return MsgGovSetEmergencyGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetEmergencyGroupResponse): MsgGovSetEmergencyGroupResponseProtoMsg { + return { + typeUrl: "/umee.ugov.v1.MsgGovSetEmergencyGroupResponse", + value: MsgGovSetEmergencyGroupResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateInflationParams(): MsgGovUpdateInflationParams { + return { + authority: "", + params: InflationParams.fromPartial({}) + }; +} +export const MsgGovUpdateInflationParams = { + typeUrl: "/umee.ugov.v1.MsgGovUpdateInflationParams", + encode(message: MsgGovUpdateInflationParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + InflationParams.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateInflationParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateInflationParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = InflationParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovUpdateInflationParams { + const message = createBaseMsgGovUpdateInflationParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? InflationParams.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgGovUpdateInflationParamsAmino): MsgGovUpdateInflationParams { + const message = createBaseMsgGovUpdateInflationParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = InflationParams.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgGovUpdateInflationParams): MsgGovUpdateInflationParamsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.params = message.params ? InflationParams.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGovUpdateInflationParamsAminoMsg): MsgGovUpdateInflationParams { + return MsgGovUpdateInflationParams.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateInflationParamsProtoMsg): MsgGovUpdateInflationParams { + return MsgGovUpdateInflationParams.decode(message.value); + }, + toProto(message: MsgGovUpdateInflationParams): Uint8Array { + return MsgGovUpdateInflationParams.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateInflationParams): MsgGovUpdateInflationParamsProtoMsg { + return { + typeUrl: "/umee.ugov.v1.MsgGovUpdateInflationParams", + value: MsgGovUpdateInflationParams.encode(message).finish() + }; + } +}; +function createBaseGovUpdateInflationParamsResponse(): GovUpdateInflationParamsResponse { + return {}; +} +export const GovUpdateInflationParamsResponse = { + typeUrl: "/umee.ugov.v1.GovUpdateInflationParamsResponse", + encode(_: GovUpdateInflationParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GovUpdateInflationParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGovUpdateInflationParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): GovUpdateInflationParamsResponse { + const message = createBaseGovUpdateInflationParamsResponse(); + return message; + }, + fromAmino(_: GovUpdateInflationParamsResponseAmino): GovUpdateInflationParamsResponse { + const message = createBaseGovUpdateInflationParamsResponse(); + return message; + }, + toAmino(_: GovUpdateInflationParamsResponse): GovUpdateInflationParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GovUpdateInflationParamsResponseAminoMsg): GovUpdateInflationParamsResponse { + return GovUpdateInflationParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: GovUpdateInflationParamsResponseProtoMsg): GovUpdateInflationParamsResponse { + return GovUpdateInflationParamsResponse.decode(message.value); + }, + toProto(message: GovUpdateInflationParamsResponse): Uint8Array { + return GovUpdateInflationParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: GovUpdateInflationParamsResponse): GovUpdateInflationParamsResponseProtoMsg { + return { + typeUrl: "/umee.ugov.v1.GovUpdateInflationParamsResponse", + value: GovUpdateInflationParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/ugov/v1/ugov.ts b/src/codegen/umee/ugov/v1/ugov.ts new file mode 100644 index 0000000..7ebf370 --- /dev/null +++ b/src/codegen/umee/ugov/v1/ugov.ts @@ -0,0 +1,122 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** InflationParams params for changing the inflation min rate and max rate of mint module params. */ +export interface InflationParams { + /** max_supply is the maximum supply. Inflation will not increase the UMEE supply above this value. */ + maxSupply: Coin; + /** inflation_cycle duration after which inflation rates are changed. */ + inflationCycle: Duration; + /** inflation_reduction_rate for every inflation cycle in basis points. */ + inflationReductionRate: number; +} +export interface InflationParamsProtoMsg { + typeUrl: "/umee.ugov.v1.InflationParams"; + value: Uint8Array; +} +/** InflationParams params for changing the inflation min rate and max rate of mint module params. */ +export interface InflationParamsAmino { + /** max_supply is the maximum supply. Inflation will not increase the UMEE supply above this value. */ + max_supply?: CoinAmino; + /** inflation_cycle duration after which inflation rates are changed. */ + inflation_cycle?: DurationAmino; + /** inflation_reduction_rate for every inflation cycle in basis points. */ + inflation_reduction_rate?: number; +} +export interface InflationParamsAminoMsg { + type: "/umee.ugov.v1.InflationParams"; + value: InflationParamsAmino; +} +/** InflationParams params for changing the inflation min rate and max rate of mint module params. */ +export interface InflationParamsSDKType { + max_supply: CoinSDKType; + inflation_cycle: DurationSDKType; + inflation_reduction_rate: number; +} +function createBaseInflationParams(): InflationParams { + return { + maxSupply: Coin.fromPartial({}), + inflationCycle: Duration.fromPartial({}), + inflationReductionRate: 0 + }; +} +export const InflationParams = { + typeUrl: "/umee.ugov.v1.InflationParams", + encode(message: InflationParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxSupply !== undefined) { + Coin.encode(message.maxSupply, writer.uint32(10).fork()).ldelim(); + } + if (message.inflationCycle !== undefined) { + Duration.encode(message.inflationCycle, writer.uint32(18).fork()).ldelim(); + } + if (message.inflationReductionRate !== 0) { + writer.uint32(24).uint32(message.inflationReductionRate); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InflationParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInflationParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxSupply = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.inflationCycle = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.inflationReductionRate = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): InflationParams { + const message = createBaseInflationParams(); + message.maxSupply = object.maxSupply !== undefined && object.maxSupply !== null ? Coin.fromPartial(object.maxSupply) : undefined; + message.inflationCycle = object.inflationCycle !== undefined && object.inflationCycle !== null ? Duration.fromPartial(object.inflationCycle) : undefined; + message.inflationReductionRate = object.inflationReductionRate ?? 0; + return message; + }, + fromAmino(object: InflationParamsAmino): InflationParams { + const message = createBaseInflationParams(); + if (object.max_supply !== undefined && object.max_supply !== null) { + message.maxSupply = Coin.fromAmino(object.max_supply); + } + if (object.inflation_cycle !== undefined && object.inflation_cycle !== null) { + message.inflationCycle = Duration.fromAmino(object.inflation_cycle); + } + if (object.inflation_reduction_rate !== undefined && object.inflation_reduction_rate !== null) { + message.inflationReductionRate = object.inflation_reduction_rate; + } + return message; + }, + toAmino(message: InflationParams): InflationParamsAmino { + const obj: any = {}; + obj.max_supply = message.maxSupply ? Coin.toAmino(message.maxSupply) : undefined; + obj.inflation_cycle = message.inflationCycle ? Duration.toAmino(message.inflationCycle) : undefined; + obj.inflation_reduction_rate = message.inflationReductionRate; + return obj; + }, + fromAminoMsg(object: InflationParamsAminoMsg): InflationParams { + return InflationParams.fromAmino(object.value); + }, + fromProtoMsg(message: InflationParamsProtoMsg): InflationParams { + return InflationParams.decode(message.value); + }, + toProto(message: InflationParams): Uint8Array { + return InflationParams.encode(message).finish(); + }, + toProtoMsg(message: InflationParams): InflationParamsProtoMsg { + return { + typeUrl: "/umee.ugov.v1.InflationParams", + value: InflationParams.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/events.ts b/src/codegen/umee/uibc/v1/events.ts new file mode 100644 index 0000000..5514a7a --- /dev/null +++ b/src/codegen/umee/uibc/v1/events.ts @@ -0,0 +1,187 @@ +import { IBCTransferStatus, iBCTransferStatusFromJSON, iBCTransferStatusToJSON } from "./quota"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** EventBadRevert is emitted on failure of ibc-transfer quota. */ +export interface EventBadRevert { + /** failure event type */ + failureType: string; + /** ibc packet data */ + packet: string; +} +export interface EventBadRevertProtoMsg { + typeUrl: "/umee.uibc.v1.EventBadRevert"; + value: Uint8Array; +} +/** EventBadRevert is emitted on failure of ibc-transfer quota. */ +export interface EventBadRevertAmino { + /** failure event type */ + failure_type?: string; + /** ibc packet data */ + packet?: string; +} +export interface EventBadRevertAminoMsg { + type: "/umee.uibc.v1.EventBadRevert"; + value: EventBadRevertAmino; +} +/** EventBadRevert is emitted on failure of ibc-transfer quota. */ +export interface EventBadRevertSDKType { + failure_type: string; + packet: string; +} +/** EventIBCTransferStatus is emitted on quota tracking pause status change. */ +export interface EventIBCTransferStatus { + status: IBCTransferStatus; +} +export interface EventIBCTransferStatusProtoMsg { + typeUrl: "/umee.uibc.v1.EventIBCTransferStatus"; + value: Uint8Array; +} +/** EventIBCTransferStatus is emitted on quota tracking pause status change. */ +export interface EventIBCTransferStatusAmino { + status?: IBCTransferStatus; +} +export interface EventIBCTransferStatusAminoMsg { + type: "/umee.uibc.v1.EventIBCTransferStatus"; + value: EventIBCTransferStatusAmino; +} +/** EventIBCTransferStatus is emitted on quota tracking pause status change. */ +export interface EventIBCTransferStatusSDKType { + status: IBCTransferStatus; +} +function createBaseEventBadRevert(): EventBadRevert { + return { + failureType: "", + packet: "" + }; +} +export const EventBadRevert = { + typeUrl: "/umee.uibc.v1.EventBadRevert", + encode(message: EventBadRevert, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.failureType !== "") { + writer.uint32(10).string(message.failureType); + } + if (message.packet !== "") { + writer.uint32(18).string(message.packet); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventBadRevert { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBadRevert(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.failureType = reader.string(); + break; + case 2: + message.packet = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventBadRevert { + const message = createBaseEventBadRevert(); + message.failureType = object.failureType ?? ""; + message.packet = object.packet ?? ""; + return message; + }, + fromAmino(object: EventBadRevertAmino): EventBadRevert { + const message = createBaseEventBadRevert(); + if (object.failure_type !== undefined && object.failure_type !== null) { + message.failureType = object.failure_type; + } + if (object.packet !== undefined && object.packet !== null) { + message.packet = object.packet; + } + return message; + }, + toAmino(message: EventBadRevert): EventBadRevertAmino { + const obj: any = {}; + obj.failure_type = message.failureType; + obj.packet = message.packet; + return obj; + }, + fromAminoMsg(object: EventBadRevertAminoMsg): EventBadRevert { + return EventBadRevert.fromAmino(object.value); + }, + fromProtoMsg(message: EventBadRevertProtoMsg): EventBadRevert { + return EventBadRevert.decode(message.value); + }, + toProto(message: EventBadRevert): Uint8Array { + return EventBadRevert.encode(message).finish(); + }, + toProtoMsg(message: EventBadRevert): EventBadRevertProtoMsg { + return { + typeUrl: "/umee.uibc.v1.EventBadRevert", + value: EventBadRevert.encode(message).finish() + }; + } +}; +function createBaseEventIBCTransferStatus(): EventIBCTransferStatus { + return { + status: 0 + }; +} +export const EventIBCTransferStatus = { + typeUrl: "/umee.uibc.v1.EventIBCTransferStatus", + encode(message: EventIBCTransferStatus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventIBCTransferStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventIBCTransferStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventIBCTransferStatus { + const message = createBaseEventIBCTransferStatus(); + message.status = object.status ?? 0; + return message; + }, + fromAmino(object: EventIBCTransferStatusAmino): EventIBCTransferStatus { + const message = createBaseEventIBCTransferStatus(); + if (object.status !== undefined && object.status !== null) { + message.status = iBCTransferStatusFromJSON(object.status); + } + return message; + }, + toAmino(message: EventIBCTransferStatus): EventIBCTransferStatusAmino { + const obj: any = {}; + obj.status = iBCTransferStatusToJSON(message.status); + return obj; + }, + fromAminoMsg(object: EventIBCTransferStatusAminoMsg): EventIBCTransferStatus { + return EventIBCTransferStatus.fromAmino(object.value); + }, + fromProtoMsg(message: EventIBCTransferStatusProtoMsg): EventIBCTransferStatus { + return EventIBCTransferStatus.decode(message.value); + }, + toProto(message: EventIBCTransferStatus): Uint8Array { + return EventIBCTransferStatus.encode(message).finish(); + }, + toProtoMsg(message: EventIBCTransferStatus): EventIBCTransferStatusProtoMsg { + return { + typeUrl: "/umee.uibc.v1.EventIBCTransferStatus", + value: EventIBCTransferStatus.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/genesis.ts b/src/codegen/umee/uibc/v1/genesis.ts new file mode 100644 index 0000000..1a6e408 --- /dev/null +++ b/src/codegen/umee/uibc/v1/genesis.ts @@ -0,0 +1,176 @@ +import { Params, ParamsAmino, ParamsSDKType } from "./quota"; +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +/** GenesisState defines the uibc module's genesis state. */ +export interface GenesisState { + params: Params; + outflows: DecCoin[]; + /** outflow_sum defines the total outflow sum of ibc-transfer in USD. */ + outflowSum: string; + /** quota_expires defines quota expire time (as unix timestamp) for ibc-transfer denom. */ + quotaExpires: Date; + /** inflows tracks IBC inflow transfers (in USD) for each denom during quota period. */ + inflows: DecCoin[]; + /** inflow_sum defines tracks total sum of IBC inflow transfers (in USD) during quota period. */ + inflowSum: string; +} +export interface GenesisStateProtoMsg { + typeUrl: "/umee.uibc.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the uibc module's genesis state. */ +export interface GenesisStateAmino { + params?: ParamsAmino; + outflows?: DecCoinAmino[]; + /** outflow_sum defines the total outflow sum of ibc-transfer in USD. */ + outflow_sum?: string; + /** quota_expires defines quota expire time (as unix timestamp) for ibc-transfer denom. */ + quota_expires?: string; + /** inflows tracks IBC inflow transfers (in USD) for each denom during quota period. */ + inflows?: DecCoinAmino[]; + /** inflow_sum defines tracks total sum of IBC inflow transfers (in USD) during quota period. */ + inflow_sum?: string; +} +export interface GenesisStateAminoMsg { + type: "/umee.uibc.v1.GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the uibc module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + outflows: DecCoinSDKType[]; + outflow_sum: string; + quota_expires: Date; + inflows: DecCoinSDKType[]; + inflow_sum: string; +} +function createBaseGenesisState(): GenesisState { + return { + params: Params.fromPartial({}), + outflows: [], + outflowSum: "", + quotaExpires: new Date(), + inflows: [], + inflowSum: "" + }; +} +export const GenesisState = { + typeUrl: "/umee.uibc.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.outflows) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.outflowSum !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.outflowSum, 18).atomics); + } + if (message.quotaExpires !== undefined) { + Timestamp.encode(toTimestamp(message.quotaExpires), writer.uint32(34).fork()).ldelim(); + } + for (const v of message.inflows) { + DecCoin.encode(v!, writer.uint32(42).fork()).ldelim(); + } + if (message.inflowSum !== "") { + writer.uint32(50).string(Decimal.fromUserInput(message.inflowSum, 18).atomics); + } + 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: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.outflows.push(DecCoin.decode(reader, reader.uint32())); + break; + case 3: + message.outflowSum = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 4: + message.quotaExpires = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.inflows.push(DecCoin.decode(reader, reader.uint32())); + break; + case 6: + message.inflowSum = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.outflows = object.outflows?.map(e => DecCoin.fromPartial(e)) || []; + message.outflowSum = object.outflowSum ?? ""; + message.quotaExpires = object.quotaExpires ?? undefined; + message.inflows = object.inflows?.map(e => DecCoin.fromPartial(e)) || []; + message.inflowSum = object.inflowSum ?? ""; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.outflows = object.outflows?.map(e => DecCoin.fromAmino(e)) || []; + if (object.outflow_sum !== undefined && object.outflow_sum !== null) { + message.outflowSum = object.outflow_sum; + } + if (object.quota_expires !== undefined && object.quota_expires !== null) { + message.quotaExpires = fromTimestamp(Timestamp.fromAmino(object.quota_expires)); + } + message.inflows = object.inflows?.map(e => DecCoin.fromAmino(e)) || []; + if (object.inflow_sum !== undefined && object.inflow_sum !== null) { + message.inflowSum = object.inflow_sum; + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.outflows) { + obj.outflows = message.outflows.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.outflows = []; + } + obj.outflow_sum = message.outflowSum; + obj.quota_expires = message.quotaExpires ? Timestamp.toAmino(toTimestamp(message.quotaExpires)) : undefined; + if (message.inflows) { + obj.inflows = message.inflows.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.inflows = []; + } + obj.inflow_sum = message.inflowSum; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/umee.uibc.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/query.lcd.ts b/src/codegen/umee/uibc/v1/query.lcd.ts new file mode 100644 index 0000000..fe0d904 --- /dev/null +++ b/src/codegen/umee/uibc/v1/query.lcd.ts @@ -0,0 +1,56 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryParams, QueryParamsResponseSDKType, QueryOutflows, QueryOutflowsResponseSDKType, QueryAllOutflows, QueryAllOutflowsResponseSDKType, QueryInflows, QueryInflowsResponseSDKType, QueryQuotaExpires, QueryQuotaExpiresResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.params = this.params.bind(this); + this.outflows = this.outflows.bind(this); + this.allOutflows = this.allOutflows.bind(this); + this.inflows = this.inflows.bind(this); + this.quotaExpires = this.quotaExpires.bind(this); + } + /* Params queries the parameters of the x/uibc module. */ + async params(_params: QueryParams = {}): Promise { + const endpoint = `umee/uibc/v1/params`; + return await this.req.get(endpoint); + } + /* Outflow returns IBC denom outflows in the current quota period. + If denom is not specified, returns sum of all registered outflows. */ + async outflows(params: QueryOutflows): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/uibc/v1/outflows`; + return await this.req.get(endpoint, options); + } + /* AllOutflow returns outflows for each denom in the current quota period. */ + async allOutflows(_params: QueryAllOutflows = {}): Promise { + const endpoint = `umee/uibc/v1/all_outflows`; + return await this.req.get(endpoint); + } + /* Inflows returns registered IBC denoms inflows in the current quota period. + If denom is not specified, returns sum of all registered inflows. */ + async inflows(params: QueryInflows): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `umee/uibc/v1/inflows`; + return await this.req.get(endpoint, options); + } + /* QuotaExpires returns when current ibc quota will end. */ + async quotaExpires(_params: QueryQuotaExpires = {}): Promise { + const endpoint = `umee/uibc/v1/quota_expires`; + return await this.req.get(endpoint); + } +} \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/query.rpc.Query.ts b/src/codegen/umee/uibc/v1/query.rpc.Query.ts new file mode 100644 index 0000000..b810b98 --- /dev/null +++ b/src/codegen/umee/uibc/v1/query.rpc.Query.ts @@ -0,0 +1,80 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParams, QueryParamsResponse, QueryOutflows, QueryOutflowsResponse, QueryAllOutflows, QueryAllOutflowsResponse, QueryInflows, QueryInflowsResponse, QueryQuotaExpires, QueryQuotaExpiresResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of the x/uibc module. */ + params(request?: QueryParams): Promise; + /** + * Outflow returns IBC denom outflows in the current quota period. + * If denom is not specified, returns sum of all registered outflows. + */ + outflows(request: QueryOutflows): Promise; + /** AllOutflow returns outflows for each denom in the current quota period. */ + allOutflows(request?: QueryAllOutflows): Promise; + /** + * Inflows returns registered IBC denoms inflows in the current quota period. + * If denom is not specified, returns sum of all registered inflows. + */ + inflows(request: QueryInflows): Promise; + /** QuotaExpires returns when current ibc quota will end. */ + quotaExpires(request?: QueryQuotaExpires): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.params = this.params.bind(this); + this.outflows = this.outflows.bind(this); + this.allOutflows = this.allOutflows.bind(this); + this.inflows = this.inflows.bind(this); + this.quotaExpires = this.quotaExpires.bind(this); + } + params(request: QueryParams = {}): Promise { + const data = QueryParams.encode(request).finish(); + const promise = this.rpc.request("umee.uibc.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + } + outflows(request: QueryOutflows): Promise { + const data = QueryOutflows.encode(request).finish(); + const promise = this.rpc.request("umee.uibc.v1.Query", "Outflows", data); + return promise.then(data => QueryOutflowsResponse.decode(new BinaryReader(data))); + } + allOutflows(request: QueryAllOutflows = {}): Promise { + const data = QueryAllOutflows.encode(request).finish(); + const promise = this.rpc.request("umee.uibc.v1.Query", "AllOutflows", data); + return promise.then(data => QueryAllOutflowsResponse.decode(new BinaryReader(data))); + } + inflows(request: QueryInflows): Promise { + const data = QueryInflows.encode(request).finish(); + const promise = this.rpc.request("umee.uibc.v1.Query", "Inflows", data); + return promise.then(data => QueryInflowsResponse.decode(new BinaryReader(data))); + } + quotaExpires(request: QueryQuotaExpires = {}): Promise { + const data = QueryQuotaExpires.encode(request).finish(); + const promise = this.rpc.request("umee.uibc.v1.Query", "QuotaExpires", data); + return promise.then(data => QueryQuotaExpiresResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParams): Promise { + return queryService.params(request); + }, + outflows(request: QueryOutflows): Promise { + return queryService.outflows(request); + }, + allOutflows(request?: QueryAllOutflows): Promise { + return queryService.allOutflows(request); + }, + inflows(request: QueryInflows): Promise { + return queryService.inflows(request); + }, + quotaExpires(request?: QueryQuotaExpires): Promise { + return queryService.quotaExpires(request); + } + }; +}; \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/query.ts b/src/codegen/umee/uibc/v1/query.ts new file mode 100644 index 0000000..f302dc1 --- /dev/null +++ b/src/codegen/umee/uibc/v1/query.ts @@ -0,0 +1,816 @@ +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsAmino, ParamsSDKType } from "./quota"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +import { Decimal } from "@cosmjs/math"; +/** QueryAllInflows defines request type for query the inflow quota of registered denoms. */ +export interface QueryQuotaExpires {} +export interface QueryQuotaExpiresProtoMsg { + typeUrl: "/umee.uibc.v1.QueryQuotaExpires"; + value: Uint8Array; +} +/** QueryAllInflows defines request type for query the inflow quota of registered denoms. */ +export interface QueryQuotaExpiresAmino {} +export interface QueryQuotaExpiresAminoMsg { + type: "/umee.uibc.v1.QueryQuotaExpires"; + value: QueryQuotaExpiresAmino; +} +/** QueryAllInflows defines request type for query the inflow quota of registered denoms. */ +export interface QueryQuotaExpiresSDKType {} +/** QueryAllInflowsResponse defines response type of Query/AllInflows */ +export interface QueryQuotaExpiresResponse { + endTime: Date; +} +export interface QueryQuotaExpiresResponseProtoMsg { + typeUrl: "/umee.uibc.v1.QueryQuotaExpiresResponse"; + value: Uint8Array; +} +/** QueryAllInflowsResponse defines response type of Query/AllInflows */ +export interface QueryQuotaExpiresResponseAmino { + end_time?: string; +} +export interface QueryQuotaExpiresResponseAminoMsg { + type: "/umee.uibc.v1.QueryQuotaExpiresResponse"; + value: QueryQuotaExpiresResponseAmino; +} +/** QueryAllInflowsResponse defines response type of Query/AllInflows */ +export interface QueryQuotaExpiresResponseSDKType { + end_time: Date; +} +/** QueryInflows defines request type for query the inflow quota of denoms */ +export interface QueryInflows { + denom: string; +} +export interface QueryInflowsProtoMsg { + typeUrl: "/umee.uibc.v1.QueryInflows"; + value: Uint8Array; +} +/** QueryInflows defines request type for query the inflow quota of denoms */ +export interface QueryInflowsAmino { + denom?: string; +} +export interface QueryInflowsAminoMsg { + type: "/umee.uibc.v1.QueryInflows"; + value: QueryInflowsAmino; +} +/** QueryInflows defines request type for query the inflow quota of denoms */ +export interface QueryInflowsSDKType { + denom: string; +} +/** QueryInflowsResponse defines response type of Query/Inflows */ +export interface QueryInflowsResponse { + sum: string; + inflows: DecCoin[]; +} +export interface QueryInflowsResponseProtoMsg { + typeUrl: "/umee.uibc.v1.QueryInflowsResponse"; + value: Uint8Array; +} +/** QueryInflowsResponse defines response type of Query/Inflows */ +export interface QueryInflowsResponseAmino { + sum?: string; + inflows?: DecCoinAmino[]; +} +export interface QueryInflowsResponseAminoMsg { + type: "/umee.uibc.v1.QueryInflowsResponse"; + value: QueryInflowsResponseAmino; +} +/** QueryInflowsResponse defines response type of Query/Inflows */ +export interface QueryInflowsResponseSDKType { + sum: string; + inflows: DecCoinSDKType[]; +} +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParams {} +export interface QueryParamsProtoMsg { + typeUrl: "/umee.uibc.v1.QueryParams"; + value: Uint8Array; +} +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParamsAmino {} +export interface QueryParamsAminoMsg { + type: "/umee.uibc.v1.QueryParams"; + value: QueryParamsAmino; +} +/** + * QueryParams defines the request structure for the Params gRPC service + * handler. + */ +export interface QueryParamsSDKType {} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponse { + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/umee.uibc.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "/umee.uibc.v1.QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** + * QueryParamsResponse defines the response structure for the Params gRPC + * service handler. + */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +/** QueryOutflow defines request type for query the quota of denoms */ +export interface QueryOutflows { + denom: string; +} +export interface QueryOutflowsProtoMsg { + typeUrl: "/umee.uibc.v1.QueryOutflows"; + value: Uint8Array; +} +/** QueryOutflow defines request type for query the quota of denoms */ +export interface QueryOutflowsAmino { + denom?: string; +} +export interface QueryOutflowsAminoMsg { + type: "/umee.uibc.v1.QueryOutflows"; + value: QueryOutflowsAmino; +} +/** QueryOutflow defines request type for query the quota of denoms */ +export interface QueryOutflowsSDKType { + denom: string; +} +/** QueryOutflowResponse defines response type of Query/Outflow */ +export interface QueryOutflowsResponse { + amount: string; +} +export interface QueryOutflowsResponseProtoMsg { + typeUrl: "/umee.uibc.v1.QueryOutflowsResponse"; + value: Uint8Array; +} +/** QueryOutflowResponse defines response type of Query/Outflow */ +export interface QueryOutflowsResponseAmino { + amount?: string; +} +export interface QueryOutflowsResponseAminoMsg { + type: "/umee.uibc.v1.QueryOutflowsResponse"; + value: QueryOutflowsResponseAmino; +} +/** QueryOutflowResponse defines response type of Query/Outflow */ +export interface QueryOutflowsResponseSDKType { + amount: string; +} +/** QueryOutflow defines request type for query the quota of denoms */ +export interface QueryAllOutflows {} +export interface QueryAllOutflowsProtoMsg { + typeUrl: "/umee.uibc.v1.QueryAllOutflows"; + value: Uint8Array; +} +/** QueryOutflow defines request type for query the quota of denoms */ +export interface QueryAllOutflowsAmino {} +export interface QueryAllOutflowsAminoMsg { + type: "/umee.uibc.v1.QueryAllOutflows"; + value: QueryAllOutflowsAmino; +} +/** QueryOutflow defines request type for query the quota of denoms */ +export interface QueryAllOutflowsSDKType {} +/** QueryOutflowResponse defines response type of Query/Outflow */ +export interface QueryAllOutflowsResponse { + outflows: DecCoin[]; +} +export interface QueryAllOutflowsResponseProtoMsg { + typeUrl: "/umee.uibc.v1.QueryAllOutflowsResponse"; + value: Uint8Array; +} +/** QueryOutflowResponse defines response type of Query/Outflow */ +export interface QueryAllOutflowsResponseAmino { + outflows?: DecCoinAmino[]; +} +export interface QueryAllOutflowsResponseAminoMsg { + type: "/umee.uibc.v1.QueryAllOutflowsResponse"; + value: QueryAllOutflowsResponseAmino; +} +/** QueryOutflowResponse defines response type of Query/Outflow */ +export interface QueryAllOutflowsResponseSDKType { + outflows: DecCoinSDKType[]; +} +function createBaseQueryQuotaExpires(): QueryQuotaExpires { + return {}; +} +export const QueryQuotaExpires = { + typeUrl: "/umee.uibc.v1.QueryQuotaExpires", + encode(_: QueryQuotaExpires, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryQuotaExpires { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryQuotaExpires(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryQuotaExpires { + const message = createBaseQueryQuotaExpires(); + return message; + }, + fromAmino(_: QueryQuotaExpiresAmino): QueryQuotaExpires { + const message = createBaseQueryQuotaExpires(); + return message; + }, + toAmino(_: QueryQuotaExpires): QueryQuotaExpiresAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryQuotaExpiresAminoMsg): QueryQuotaExpires { + return QueryQuotaExpires.fromAmino(object.value); + }, + fromProtoMsg(message: QueryQuotaExpiresProtoMsg): QueryQuotaExpires { + return QueryQuotaExpires.decode(message.value); + }, + toProto(message: QueryQuotaExpires): Uint8Array { + return QueryQuotaExpires.encode(message).finish(); + }, + toProtoMsg(message: QueryQuotaExpires): QueryQuotaExpiresProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryQuotaExpires", + value: QueryQuotaExpires.encode(message).finish() + }; + } +}; +function createBaseQueryQuotaExpiresResponse(): QueryQuotaExpiresResponse { + return { + endTime: new Date() + }; +} +export const QueryQuotaExpiresResponse = { + typeUrl: "/umee.uibc.v1.QueryQuotaExpiresResponse", + encode(message: QueryQuotaExpiresResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.endTime !== undefined) { + Timestamp.encode(toTimestamp(message.endTime), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryQuotaExpiresResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryQuotaExpiresResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryQuotaExpiresResponse { + const message = createBaseQueryQuotaExpiresResponse(); + message.endTime = object.endTime ?? undefined; + return message; + }, + fromAmino(object: QueryQuotaExpiresResponseAmino): QueryQuotaExpiresResponse { + const message = createBaseQueryQuotaExpiresResponse(); + if (object.end_time !== undefined && object.end_time !== null) { + message.endTime = fromTimestamp(Timestamp.fromAmino(object.end_time)); + } + return message; + }, + toAmino(message: QueryQuotaExpiresResponse): QueryQuotaExpiresResponseAmino { + const obj: any = {}; + obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; + return obj; + }, + fromAminoMsg(object: QueryQuotaExpiresResponseAminoMsg): QueryQuotaExpiresResponse { + return QueryQuotaExpiresResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryQuotaExpiresResponseProtoMsg): QueryQuotaExpiresResponse { + return QueryQuotaExpiresResponse.decode(message.value); + }, + toProto(message: QueryQuotaExpiresResponse): Uint8Array { + return QueryQuotaExpiresResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryQuotaExpiresResponse): QueryQuotaExpiresResponseProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryQuotaExpiresResponse", + value: QueryQuotaExpiresResponse.encode(message).finish() + }; + } +}; +function createBaseQueryInflows(): QueryInflows { + return { + denom: "" + }; +} +export const QueryInflows = { + typeUrl: "/umee.uibc.v1.QueryInflows", + encode(message: QueryInflows, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryInflows { + const message = createBaseQueryInflows(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryInflowsAmino): QueryInflows { + const message = createBaseQueryInflows(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryInflows): QueryInflowsAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryInflowsAminoMsg): QueryInflows { + return QueryInflows.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInflowsProtoMsg): QueryInflows { + return QueryInflows.decode(message.value); + }, + toProto(message: QueryInflows): Uint8Array { + return QueryInflows.encode(message).finish(); + }, + toProtoMsg(message: QueryInflows): QueryInflowsProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryInflows", + value: QueryInflows.encode(message).finish() + }; + } +}; +function createBaseQueryInflowsResponse(): QueryInflowsResponse { + return { + sum: "", + inflows: [] + }; +} +export const QueryInflowsResponse = { + typeUrl: "/umee.uibc.v1.QueryInflowsResponse", + encode(message: QueryInflowsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sum !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.sum, 18).atomics); + } + for (const v of message.inflows) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflowsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflowsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sum = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 2: + message.inflows.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryInflowsResponse { + const message = createBaseQueryInflowsResponse(); + message.sum = object.sum ?? ""; + message.inflows = object.inflows?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryInflowsResponseAmino): QueryInflowsResponse { + const message = createBaseQueryInflowsResponse(); + if (object.sum !== undefined && object.sum !== null) { + message.sum = object.sum; + } + message.inflows = object.inflows?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryInflowsResponse): QueryInflowsResponseAmino { + const obj: any = {}; + obj.sum = message.sum; + if (message.inflows) { + obj.inflows = message.inflows.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.inflows = []; + } + return obj; + }, + fromAminoMsg(object: QueryInflowsResponseAminoMsg): QueryInflowsResponse { + return QueryInflowsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryInflowsResponseProtoMsg): QueryInflowsResponse { + return QueryInflowsResponse.decode(message.value); + }, + toProto(message: QueryInflowsResponse): Uint8Array { + return QueryInflowsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryInflowsResponse): QueryInflowsResponseProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryInflowsResponse", + value: QueryInflowsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParams(): QueryParams { + return {}; +} +export const QueryParams = { + typeUrl: "/umee.uibc.v1.QueryParams", + encode(_: QueryParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryParams { + const message = createBaseQueryParams(); + return message; + }, + fromAmino(_: QueryParamsAmino): QueryParams { + const message = createBaseQueryParams(); + return message; + }, + toAmino(_: QueryParams): QueryParamsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsAminoMsg): QueryParams { + return QueryParams.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsProtoMsg): QueryParams { + return QueryParams.decode(message.value); + }, + toProto(message: QueryParams): Uint8Array { + return QueryParams.encode(message).finish(); + }, + toProtoMsg(message: QueryParams): QueryParamsProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryParams", + value: QueryParams.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/umee.uibc.v1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryOutflows(): QueryOutflows { + return { + denom: "" + }; +} +export const QueryOutflows = { + typeUrl: "/umee.uibc.v1.QueryOutflows", + encode(message: QueryOutflows, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryOutflows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOutflows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryOutflows { + const message = createBaseQueryOutflows(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryOutflowsAmino): QueryOutflows { + const message = createBaseQueryOutflows(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryOutflows): QueryOutflowsAmino { + const obj: any = {}; + obj.denom = message.denom; + return obj; + }, + fromAminoMsg(object: QueryOutflowsAminoMsg): QueryOutflows { + return QueryOutflows.fromAmino(object.value); + }, + fromProtoMsg(message: QueryOutflowsProtoMsg): QueryOutflows { + return QueryOutflows.decode(message.value); + }, + toProto(message: QueryOutflows): Uint8Array { + return QueryOutflows.encode(message).finish(); + }, + toProtoMsg(message: QueryOutflows): QueryOutflowsProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryOutflows", + value: QueryOutflows.encode(message).finish() + }; + } +}; +function createBaseQueryOutflowsResponse(): QueryOutflowsResponse { + return { + amount: "" + }; +} +export const QueryOutflowsResponse = { + typeUrl: "/umee.uibc.v1.QueryOutflowsResponse", + encode(message: QueryOutflowsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.amount !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.amount, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryOutflowsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOutflowsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryOutflowsResponse { + const message = createBaseQueryOutflowsResponse(); + message.amount = object.amount ?? ""; + return message; + }, + fromAmino(object: QueryOutflowsResponseAmino): QueryOutflowsResponse { + const message = createBaseQueryOutflowsResponse(); + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + return message; + }, + toAmino(message: QueryOutflowsResponse): QueryOutflowsResponseAmino { + const obj: any = {}; + obj.amount = message.amount; + return obj; + }, + fromAminoMsg(object: QueryOutflowsResponseAminoMsg): QueryOutflowsResponse { + return QueryOutflowsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryOutflowsResponseProtoMsg): QueryOutflowsResponse { + return QueryOutflowsResponse.decode(message.value); + }, + toProto(message: QueryOutflowsResponse): Uint8Array { + return QueryOutflowsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryOutflowsResponse): QueryOutflowsResponseProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryOutflowsResponse", + value: QueryOutflowsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAllOutflows(): QueryAllOutflows { + return {}; +} +export const QueryAllOutflows = { + typeUrl: "/umee.uibc.v1.QueryAllOutflows", + encode(_: QueryAllOutflows, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllOutflows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllOutflows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryAllOutflows { + const message = createBaseQueryAllOutflows(); + return message; + }, + fromAmino(_: QueryAllOutflowsAmino): QueryAllOutflows { + const message = createBaseQueryAllOutflows(); + return message; + }, + toAmino(_: QueryAllOutflows): QueryAllOutflowsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryAllOutflowsAminoMsg): QueryAllOutflows { + return QueryAllOutflows.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAllOutflowsProtoMsg): QueryAllOutflows { + return QueryAllOutflows.decode(message.value); + }, + toProto(message: QueryAllOutflows): Uint8Array { + return QueryAllOutflows.encode(message).finish(); + }, + toProtoMsg(message: QueryAllOutflows): QueryAllOutflowsProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryAllOutflows", + value: QueryAllOutflows.encode(message).finish() + }; + } +}; +function createBaseQueryAllOutflowsResponse(): QueryAllOutflowsResponse { + return { + outflows: [] + }; +} +export const QueryAllOutflowsResponse = { + typeUrl: "/umee.uibc.v1.QueryAllOutflowsResponse", + encode(message: QueryAllOutflowsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.outflows) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllOutflowsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllOutflowsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.outflows.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryAllOutflowsResponse { + const message = createBaseQueryAllOutflowsResponse(); + message.outflows = object.outflows?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryAllOutflowsResponseAmino): QueryAllOutflowsResponse { + const message = createBaseQueryAllOutflowsResponse(); + message.outflows = object.outflows?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryAllOutflowsResponse): QueryAllOutflowsResponseAmino { + const obj: any = {}; + if (message.outflows) { + obj.outflows = message.outflows.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.outflows = []; + } + return obj; + }, + fromAminoMsg(object: QueryAllOutflowsResponseAminoMsg): QueryAllOutflowsResponse { + return QueryAllOutflowsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryAllOutflowsResponseProtoMsg): QueryAllOutflowsResponse { + return QueryAllOutflowsResponse.decode(message.value); + }, + toProto(message: QueryAllOutflowsResponse): Uint8Array { + return QueryAllOutflowsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllOutflowsResponse): QueryAllOutflowsResponseProtoMsg { + return { + typeUrl: "/umee.uibc.v1.QueryAllOutflowsResponse", + value: QueryAllOutflowsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/quota.ts b/src/codegen/umee/uibc/v1/quota.ts new file mode 100644 index 0000000..ffb7d78 --- /dev/null +++ b/src/codegen/umee/uibc/v1/quota.ts @@ -0,0 +1,253 @@ +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +/** IBCTransferStatus status of ibc-transfer quota check for inflow and outflow */ +export enum IBCTransferStatus { + /** IBC_TRANSFER_STATUS_UNSPECIFIED - UNSPECIFIED defines a no-op status. */ + IBC_TRANSFER_STATUS_UNSPECIFIED = 0, + /** IBC_TRANSFER_STATUS_QUOTA_DISABLED - DISABLED: all inflow and outflow quota checks are disabled. */ + IBC_TRANSFER_STATUS_QUOTA_DISABLED = 1, + /** IBC_TRANSFER_STATUS_QUOTA_ENABLED - ENABLED: all inflow and outflow quota checks are enabled. */ + IBC_TRANSFER_STATUS_QUOTA_ENABLED = 2, + /** IBC_TRANSFER_STATUS_QUOTA_OUT_DISABLED - DISABLED OUT: outflow quota check is disabled, while the inflow quota check is enabled. */ + IBC_TRANSFER_STATUS_QUOTA_OUT_DISABLED = 3, + /** IBC_TRANSFER_STATUS_QUOTA_IN_DISABLED - DISABLED IN: inflow quota check is disabled, while the outflow quota check is enabled. */ + IBC_TRANSFER_STATUS_QUOTA_IN_DISABLED = 4, + /** IBC_TRANSFER_STATUS_TRANSFERS_PAUSED - PAUSED: all IBC transfers are paused. */ + IBC_TRANSFER_STATUS_TRANSFERS_PAUSED = 5, + UNRECOGNIZED = -1, +} +export const IBCTransferStatusSDKType = IBCTransferStatus; +export const IBCTransferStatusAmino = IBCTransferStatus; +export function iBCTransferStatusFromJSON(object: any): IBCTransferStatus { + switch (object) { + case 0: + case "IBC_TRANSFER_STATUS_UNSPECIFIED": + return IBCTransferStatus.IBC_TRANSFER_STATUS_UNSPECIFIED; + case 1: + case "IBC_TRANSFER_STATUS_QUOTA_DISABLED": + return IBCTransferStatus.IBC_TRANSFER_STATUS_QUOTA_DISABLED; + case 2: + case "IBC_TRANSFER_STATUS_QUOTA_ENABLED": + return IBCTransferStatus.IBC_TRANSFER_STATUS_QUOTA_ENABLED; + case 3: + case "IBC_TRANSFER_STATUS_QUOTA_OUT_DISABLED": + return IBCTransferStatus.IBC_TRANSFER_STATUS_QUOTA_OUT_DISABLED; + case 4: + case "IBC_TRANSFER_STATUS_QUOTA_IN_DISABLED": + return IBCTransferStatus.IBC_TRANSFER_STATUS_QUOTA_IN_DISABLED; + case 5: + case "IBC_TRANSFER_STATUS_TRANSFERS_PAUSED": + return IBCTransferStatus.IBC_TRANSFER_STATUS_TRANSFERS_PAUSED; + case -1: + case "UNRECOGNIZED": + default: + return IBCTransferStatus.UNRECOGNIZED; + } +} +export function iBCTransferStatusToJSON(object: IBCTransferStatus): string { + switch (object) { + case IBCTransferStatus.IBC_TRANSFER_STATUS_UNSPECIFIED: + return "IBC_TRANSFER_STATUS_UNSPECIFIED"; + case IBCTransferStatus.IBC_TRANSFER_STATUS_QUOTA_DISABLED: + return "IBC_TRANSFER_STATUS_QUOTA_DISABLED"; + case IBCTransferStatus.IBC_TRANSFER_STATUS_QUOTA_ENABLED: + return "IBC_TRANSFER_STATUS_QUOTA_ENABLED"; + case IBCTransferStatus.IBC_TRANSFER_STATUS_QUOTA_OUT_DISABLED: + return "IBC_TRANSFER_STATUS_QUOTA_OUT_DISABLED"; + case IBCTransferStatus.IBC_TRANSFER_STATUS_QUOTA_IN_DISABLED: + return "IBC_TRANSFER_STATUS_QUOTA_IN_DISABLED"; + case IBCTransferStatus.IBC_TRANSFER_STATUS_TRANSFERS_PAUSED: + return "IBC_TRANSFER_STATUS_TRANSFERS_PAUSED"; + case IBCTransferStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Params of x/uibc module */ +export interface Params { + /** ibc_status defines the IBC ICS20 status (transfer quota or transfers disabled). */ + ibcStatus: IBCTransferStatus; + /** total_quota defines the total outflow limit of ibc-transfer in USD */ + totalQuota: string; + /** token_quota defines the outflow limit per token in USD */ + tokenQuota: string; + /** quota_duration defines quota expires for each ibc-transfer denom in seconds */ + quotaDuration: Duration; + /** inflow_outflow_quota_base defines the inflow outflow quota base of ibc-transfer in USD */ + inflowOutflowQuotaBase: string; + /** inflow_outflow_quota_rate defines the rate of total inflows */ + inflowOutflowQuotaRate: string; + /** inflow_outflow_token_quota_base defines the inflow outflow quota base for token */ + inflowOutflowTokenQuotaBase: string; +} +export interface ParamsProtoMsg { + typeUrl: "/umee.uibc.v1.Params"; + value: Uint8Array; +} +/** Params of x/uibc module */ +export interface ParamsAmino { + /** ibc_status defines the IBC ICS20 status (transfer quota or transfers disabled). */ + ibc_status?: IBCTransferStatus; + /** total_quota defines the total outflow limit of ibc-transfer in USD */ + total_quota?: string; + /** token_quota defines the outflow limit per token in USD */ + token_quota?: string; + /** quota_duration defines quota expires for each ibc-transfer denom in seconds */ + quota_duration?: DurationAmino; + /** inflow_outflow_quota_base defines the inflow outflow quota base of ibc-transfer in USD */ + inflow_outflow_quota_base?: string; + /** inflow_outflow_quota_rate defines the rate of total inflows */ + inflow_outflow_quota_rate?: string; + /** inflow_outflow_token_quota_base defines the inflow outflow quota base for token */ + inflow_outflow_token_quota_base?: string; +} +export interface ParamsAminoMsg { + type: "/umee.uibc.v1.Params"; + value: ParamsAmino; +} +/** Params of x/uibc module */ +export interface ParamsSDKType { + ibc_status: IBCTransferStatus; + total_quota: string; + token_quota: string; + quota_duration: DurationSDKType; + inflow_outflow_quota_base: string; + inflow_outflow_quota_rate: string; + inflow_outflow_token_quota_base: string; +} +function createBaseParams(): Params { + return { + ibcStatus: 0, + totalQuota: "", + tokenQuota: "", + quotaDuration: Duration.fromPartial({}), + inflowOutflowQuotaBase: "", + inflowOutflowQuotaRate: "", + inflowOutflowTokenQuotaBase: "" + }; +} +export const Params = { + typeUrl: "/umee.uibc.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.ibcStatus !== 0) { + writer.uint32(8).int32(message.ibcStatus); + } + if (message.totalQuota !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.totalQuota, 18).atomics); + } + if (message.tokenQuota !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.tokenQuota, 18).atomics); + } + if (message.quotaDuration !== undefined) { + Duration.encode(message.quotaDuration, writer.uint32(34).fork()).ldelim(); + } + if (message.inflowOutflowQuotaBase !== "") { + writer.uint32(42).string(Decimal.fromUserInput(message.inflowOutflowQuotaBase, 18).atomics); + } + if (message.inflowOutflowQuotaRate !== "") { + writer.uint32(50).string(Decimal.fromUserInput(message.inflowOutflowQuotaRate, 18).atomics); + } + if (message.inflowOutflowTokenQuotaBase !== "") { + writer.uint32(58).string(Decimal.fromUserInput(message.inflowOutflowTokenQuotaBase, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ibcStatus = (reader.int32() as any); + break; + case 2: + message.totalQuota = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.tokenQuota = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 4: + message.quotaDuration = Duration.decode(reader, reader.uint32()); + break; + case 5: + message.inflowOutflowQuotaBase = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 6: + message.inflowOutflowQuotaRate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 7: + message.inflowOutflowTokenQuotaBase = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.ibcStatus = object.ibcStatus ?? 0; + message.totalQuota = object.totalQuota ?? ""; + message.tokenQuota = object.tokenQuota ?? ""; + message.quotaDuration = object.quotaDuration !== undefined && object.quotaDuration !== null ? Duration.fromPartial(object.quotaDuration) : undefined; + message.inflowOutflowQuotaBase = object.inflowOutflowQuotaBase ?? ""; + message.inflowOutflowQuotaRate = object.inflowOutflowQuotaRate ?? ""; + message.inflowOutflowTokenQuotaBase = object.inflowOutflowTokenQuotaBase ?? ""; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.ibc_status !== undefined && object.ibc_status !== null) { + message.ibcStatus = iBCTransferStatusFromJSON(object.ibc_status); + } + if (object.total_quota !== undefined && object.total_quota !== null) { + message.totalQuota = object.total_quota; + } + if (object.token_quota !== undefined && object.token_quota !== null) { + message.tokenQuota = object.token_quota; + } + if (object.quota_duration !== undefined && object.quota_duration !== null) { + message.quotaDuration = Duration.fromAmino(object.quota_duration); + } + if (object.inflow_outflow_quota_base !== undefined && object.inflow_outflow_quota_base !== null) { + message.inflowOutflowQuotaBase = object.inflow_outflow_quota_base; + } + if (object.inflow_outflow_quota_rate !== undefined && object.inflow_outflow_quota_rate !== null) { + message.inflowOutflowQuotaRate = object.inflow_outflow_quota_rate; + } + if (object.inflow_outflow_token_quota_base !== undefined && object.inflow_outflow_token_quota_base !== null) { + message.inflowOutflowTokenQuotaBase = object.inflow_outflow_token_quota_base; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.ibc_status = iBCTransferStatusToJSON(message.ibcStatus); + obj.total_quota = message.totalQuota; + obj.token_quota = message.tokenQuota; + obj.quota_duration = message.quotaDuration ? Duration.toAmino(message.quotaDuration) : undefined; + obj.inflow_outflow_quota_base = message.inflowOutflowQuotaBase; + obj.inflow_outflow_quota_rate = message.inflowOutflowQuotaRate; + obj.inflow_outflow_token_quota_base = message.inflowOutflowTokenQuotaBase; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/umee.uibc.v1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/tx.amino.ts b/src/codegen/umee/uibc/v1/tx.amino.ts new file mode 100644 index 0000000..5e438dc --- /dev/null +++ b/src/codegen/umee/uibc/v1/tx.amino.ts @@ -0,0 +1,13 @@ +import { MsgGovUpdateQuota, MsgGovSetIBCStatus } from "./tx"; +export const AminoConverter = { + "/umee.uibc.v1.MsgGovUpdateQuota": { + aminoType: "/umee.uibc.v1.MsgGovUpdateQuota", + toAmino: MsgGovUpdateQuota.toAmino, + fromAmino: MsgGovUpdateQuota.fromAmino + }, + "/umee.uibc.v1.MsgGovSetIBCStatus": { + aminoType: "/umee.uibc.v1.MsgGovSetIBCStatus", + toAmino: MsgGovSetIBCStatus.toAmino, + fromAmino: MsgGovSetIBCStatus.fromAmino + } +}; \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/tx.registry.ts b/src/codegen/umee/uibc/v1/tx.registry.ts new file mode 100644 index 0000000..fd08f7c --- /dev/null +++ b/src/codegen/umee/uibc/v1/tx.registry.ts @@ -0,0 +1,52 @@ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgGovUpdateQuota, MsgGovSetIBCStatus } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/umee.uibc.v1.MsgGovUpdateQuota", MsgGovUpdateQuota], ["/umee.uibc.v1.MsgGovSetIBCStatus", MsgGovSetIBCStatus]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + govUpdateQuota(value: MsgGovUpdateQuota) { + return { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuota", + value: MsgGovUpdateQuota.encode(value).finish() + }; + }, + govSetIBCStatus(value: MsgGovSetIBCStatus) { + return { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatus", + value: MsgGovSetIBCStatus.encode(value).finish() + }; + } + }, + withTypeUrl: { + govUpdateQuota(value: MsgGovUpdateQuota) { + return { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuota", + value + }; + }, + govSetIBCStatus(value: MsgGovSetIBCStatus) { + return { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatus", + value + }; + } + }, + fromPartial: { + govUpdateQuota(value: MsgGovUpdateQuota) { + return { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuota", + value: MsgGovUpdateQuota.fromPartial(value) + }; + }, + govSetIBCStatus(value: MsgGovSetIBCStatus) { + return { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatus", + value: MsgGovSetIBCStatus.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/tx.rpc.msg.ts b/src/codegen/umee/uibc/v1/tx.rpc.msg.ts new file mode 100644 index 0000000..96bcae9 --- /dev/null +++ b/src/codegen/umee/uibc/v1/tx.rpc.msg.ts @@ -0,0 +1,31 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgGovUpdateQuota, MsgGovUpdateQuotaResponse, MsgGovSetIBCStatus, MsgGovSetIBCStatusResponse } from "./tx"; +/** Msg defines the x/uibc module's Msg service. */ +export interface Msg { + /** + * GovUpdateQuota adds new quota for ibc denoms or + * updates the quota for existed ibc denoms. + */ + govUpdateQuota(request: MsgGovUpdateQuota): Promise; + /** GovSetIBCStatus sets IBC ICS20 status. Must be called by x/gov. */ + govSetIBCStatus(request: MsgGovSetIBCStatus): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.govUpdateQuota = this.govUpdateQuota.bind(this); + this.govSetIBCStatus = this.govSetIBCStatus.bind(this); + } + govUpdateQuota(request: MsgGovUpdateQuota): Promise { + const data = MsgGovUpdateQuota.encode(request).finish(); + const promise = this.rpc.request("umee.uibc.v1.Msg", "GovUpdateQuota", data); + return promise.then(data => MsgGovUpdateQuotaResponse.decode(new BinaryReader(data))); + } + govSetIBCStatus(request: MsgGovSetIBCStatus): Promise { + const data = MsgGovSetIBCStatus.encode(request).finish(); + const promise = this.rpc.request("umee.uibc.v1.Msg", "GovSetIBCStatus", data); + return promise.then(data => MsgGovSetIBCStatusResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/src/codegen/umee/uibc/v1/tx.ts b/src/codegen/umee/uibc/v1/tx.ts new file mode 100644 index 0000000..8ecf86a --- /dev/null +++ b/src/codegen/umee/uibc/v1/tx.ts @@ -0,0 +1,416 @@ +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { IBCTransferStatus, iBCTransferStatusFromJSON, iBCTransferStatusToJSON } from "./quota"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +/** MsgGovUpdateQuota defines the Msg/GovUpdateQuota request type. */ +export interface MsgGovUpdateQuota { + /** authority is the address of the governance account or the Emergency Group. */ + authority: string; + /** + * description motivating the change. Should be used only when executing by the + * Emergency Group. Otherwise the x/gov Proposal metadata should be used. + */ + description: string; + /** total quota defines the total outflow of ibc-transfer in USD */ + total: string; + /** per_denom quota for outflows per denom. All denoms have the same quota size. */ + perDenom: string; + /** quota_duration defines quota expires per denom, All denoms have the same expire time. */ + quotaDuration: Duration; +} +export interface MsgGovUpdateQuotaProtoMsg { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuota"; + value: Uint8Array; +} +/** MsgGovUpdateQuota defines the Msg/GovUpdateQuota request type. */ +export interface MsgGovUpdateQuotaAmino { + /** authority is the address of the governance account or the Emergency Group. */ + authority?: string; + /** + * description motivating the change. Should be used only when executing by the + * Emergency Group. Otherwise the x/gov Proposal metadata should be used. + */ + description?: string; + /** total quota defines the total outflow of ibc-transfer in USD */ + total?: string; + /** per_denom quota for outflows per denom. All denoms have the same quota size. */ + per_denom?: string; + /** quota_duration defines quota expires per denom, All denoms have the same expire time. */ + quota_duration?: DurationAmino; +} +export interface MsgGovUpdateQuotaAminoMsg { + type: "/umee.uibc.v1.MsgGovUpdateQuota"; + value: MsgGovUpdateQuotaAmino; +} +/** MsgGovUpdateQuota defines the Msg/GovUpdateQuota request type. */ +export interface MsgGovUpdateQuotaSDKType { + authority: string; + description: string; + total: string; + per_denom: string; + quota_duration: DurationSDKType; +} +/** MsgGovUpdateQuotaResponse defines response type for the Msg/GovUpdateQuota for with x/gov proposals. */ +export interface MsgGovUpdateQuotaResponse {} +export interface MsgGovUpdateQuotaResponseProtoMsg { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuotaResponse"; + value: Uint8Array; +} +/** MsgGovUpdateQuotaResponse defines response type for the Msg/GovUpdateQuota for with x/gov proposals. */ +export interface MsgGovUpdateQuotaResponseAmino {} +export interface MsgGovUpdateQuotaResponseAminoMsg { + type: "/umee.uibc.v1.MsgGovUpdateQuotaResponse"; + value: MsgGovUpdateQuotaResponseAmino; +} +/** MsgGovUpdateQuotaResponse defines response type for the Msg/GovUpdateQuota for with x/gov proposals. */ +export interface MsgGovUpdateQuotaResponseSDKType {} +/** MsgGovSetIBCStatus defines the request type for setting the IBC quota status. */ +export interface MsgGovSetIBCStatus { + /** authority is the address of the governance account or the Emergency Group. */ + authority: string; + /** + * description motivating the change. Should be used only when executing by the + * Emergency Group. Otherwise the x/gov Proposal metadata should be used. + */ + description: string; + /** ibc_status defines status for ibc transfers */ + ibcStatus: IBCTransferStatus; +} +export interface MsgGovSetIBCStatusProtoMsg { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatus"; + value: Uint8Array; +} +/** MsgGovSetIBCStatus defines the request type for setting the IBC quota status. */ +export interface MsgGovSetIBCStatusAmino { + /** authority is the address of the governance account or the Emergency Group. */ + authority?: string; + /** + * description motivating the change. Should be used only when executing by the + * Emergency Group. Otherwise the x/gov Proposal metadata should be used. + */ + description?: string; + /** ibc_status defines status for ibc transfers */ + ibc_status?: IBCTransferStatus; +} +export interface MsgGovSetIBCStatusAminoMsg { + type: "/umee.uibc.v1.MsgGovSetIBCStatus"; + value: MsgGovSetIBCStatusAmino; +} +/** MsgGovSetIBCStatus defines the request type for setting the IBC quota status. */ +export interface MsgGovSetIBCStatusSDKType { + authority: string; + description: string; + ibc_status: IBCTransferStatus; +} +/** MsgGovSetIBCStatusResponse define the response type for Msg/MsgGovSetIBCStatus with x/gov proposals. */ +export interface MsgGovSetIBCStatusResponse {} +export interface MsgGovSetIBCStatusResponseProtoMsg { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatusResponse"; + value: Uint8Array; +} +/** MsgGovSetIBCStatusResponse define the response type for Msg/MsgGovSetIBCStatus with x/gov proposals. */ +export interface MsgGovSetIBCStatusResponseAmino {} +export interface MsgGovSetIBCStatusResponseAminoMsg { + type: "/umee.uibc.v1.MsgGovSetIBCStatusResponse"; + value: MsgGovSetIBCStatusResponseAmino; +} +/** MsgGovSetIBCStatusResponse define the response type for Msg/MsgGovSetIBCStatus with x/gov proposals. */ +export interface MsgGovSetIBCStatusResponseSDKType {} +function createBaseMsgGovUpdateQuota(): MsgGovUpdateQuota { + return { + authority: "", + description: "", + total: "", + perDenom: "", + quotaDuration: Duration.fromPartial({}) + }; +} +export const MsgGovUpdateQuota = { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuota", + encode(message: MsgGovUpdateQuota, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.description !== "") { + writer.uint32(26).string(message.description); + } + if (message.total !== "") { + writer.uint32(34).string(Decimal.fromUserInput(message.total, 18).atomics); + } + if (message.perDenom !== "") { + writer.uint32(42).string(Decimal.fromUserInput(message.perDenom, 18).atomics); + } + if (message.quotaDuration !== undefined) { + Duration.encode(message.quotaDuration, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateQuota { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateQuota(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.total = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 5: + message.perDenom = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 6: + message.quotaDuration = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovUpdateQuota { + const message = createBaseMsgGovUpdateQuota(); + message.authority = object.authority ?? ""; + message.description = object.description ?? ""; + message.total = object.total ?? ""; + message.perDenom = object.perDenom ?? ""; + message.quotaDuration = object.quotaDuration !== undefined && object.quotaDuration !== null ? Duration.fromPartial(object.quotaDuration) : undefined; + return message; + }, + fromAmino(object: MsgGovUpdateQuotaAmino): MsgGovUpdateQuota { + const message = createBaseMsgGovUpdateQuota(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.total !== undefined && object.total !== null) { + message.total = object.total; + } + if (object.per_denom !== undefined && object.per_denom !== null) { + message.perDenom = object.per_denom; + } + if (object.quota_duration !== undefined && object.quota_duration !== null) { + message.quotaDuration = Duration.fromAmino(object.quota_duration); + } + return message; + }, + toAmino(message: MsgGovUpdateQuota): MsgGovUpdateQuotaAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.description = message.description; + obj.total = message.total; + obj.per_denom = message.perDenom; + obj.quota_duration = message.quotaDuration ? Duration.toAmino(message.quotaDuration) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGovUpdateQuotaAminoMsg): MsgGovUpdateQuota { + return MsgGovUpdateQuota.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateQuotaProtoMsg): MsgGovUpdateQuota { + return MsgGovUpdateQuota.decode(message.value); + }, + toProto(message: MsgGovUpdateQuota): Uint8Array { + return MsgGovUpdateQuota.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateQuota): MsgGovUpdateQuotaProtoMsg { + return { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuota", + value: MsgGovUpdateQuota.encode(message).finish() + }; + } +}; +function createBaseMsgGovUpdateQuotaResponse(): MsgGovUpdateQuotaResponse { + return {}; +} +export const MsgGovUpdateQuotaResponse = { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuotaResponse", + encode(_: MsgGovUpdateQuotaResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateQuotaResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovUpdateQuotaResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovUpdateQuotaResponse { + const message = createBaseMsgGovUpdateQuotaResponse(); + return message; + }, + fromAmino(_: MsgGovUpdateQuotaResponseAmino): MsgGovUpdateQuotaResponse { + const message = createBaseMsgGovUpdateQuotaResponse(); + return message; + }, + toAmino(_: MsgGovUpdateQuotaResponse): MsgGovUpdateQuotaResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovUpdateQuotaResponseAminoMsg): MsgGovUpdateQuotaResponse { + return MsgGovUpdateQuotaResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovUpdateQuotaResponseProtoMsg): MsgGovUpdateQuotaResponse { + return MsgGovUpdateQuotaResponse.decode(message.value); + }, + toProto(message: MsgGovUpdateQuotaResponse): Uint8Array { + return MsgGovUpdateQuotaResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovUpdateQuotaResponse): MsgGovUpdateQuotaResponseProtoMsg { + return { + typeUrl: "/umee.uibc.v1.MsgGovUpdateQuotaResponse", + value: MsgGovUpdateQuotaResponse.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetIBCStatus(): MsgGovSetIBCStatus { + return { + authority: "", + description: "", + ibcStatus: 0 + }; +} +export const MsgGovSetIBCStatus = { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatus", + encode(message: MsgGovSetIBCStatus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.description !== "") { + writer.uint32(26).string(message.description); + } + if (message.ibcStatus !== 0) { + writer.uint32(32).int32(message.ibcStatus); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetIBCStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetIBCStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.ibcStatus = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgGovSetIBCStatus { + const message = createBaseMsgGovSetIBCStatus(); + message.authority = object.authority ?? ""; + message.description = object.description ?? ""; + message.ibcStatus = object.ibcStatus ?? 0; + return message; + }, + fromAmino(object: MsgGovSetIBCStatusAmino): MsgGovSetIBCStatus { + const message = createBaseMsgGovSetIBCStatus(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.ibc_status !== undefined && object.ibc_status !== null) { + message.ibcStatus = iBCTransferStatusFromJSON(object.ibc_status); + } + return message; + }, + toAmino(message: MsgGovSetIBCStatus): MsgGovSetIBCStatusAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.description = message.description; + obj.ibc_status = iBCTransferStatusToJSON(message.ibcStatus); + return obj; + }, + fromAminoMsg(object: MsgGovSetIBCStatusAminoMsg): MsgGovSetIBCStatus { + return MsgGovSetIBCStatus.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetIBCStatusProtoMsg): MsgGovSetIBCStatus { + return MsgGovSetIBCStatus.decode(message.value); + }, + toProto(message: MsgGovSetIBCStatus): Uint8Array { + return MsgGovSetIBCStatus.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetIBCStatus): MsgGovSetIBCStatusProtoMsg { + return { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatus", + value: MsgGovSetIBCStatus.encode(message).finish() + }; + } +}; +function createBaseMsgGovSetIBCStatusResponse(): MsgGovSetIBCStatusResponse { + return {}; +} +export const MsgGovSetIBCStatusResponse = { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatusResponse", + encode(_: MsgGovSetIBCStatusResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGovSetIBCStatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGovSetIBCStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgGovSetIBCStatusResponse { + const message = createBaseMsgGovSetIBCStatusResponse(); + return message; + }, + fromAmino(_: MsgGovSetIBCStatusResponseAmino): MsgGovSetIBCStatusResponse { + const message = createBaseMsgGovSetIBCStatusResponse(); + return message; + }, + toAmino(_: MsgGovSetIBCStatusResponse): MsgGovSetIBCStatusResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGovSetIBCStatusResponseAminoMsg): MsgGovSetIBCStatusResponse { + return MsgGovSetIBCStatusResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGovSetIBCStatusResponseProtoMsg): MsgGovSetIBCStatusResponse { + return MsgGovSetIBCStatusResponse.decode(message.value); + }, + toProto(message: MsgGovSetIBCStatusResponse): Uint8Array { + return MsgGovSetIBCStatusResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGovSetIBCStatusResponse): MsgGovSetIBCStatusResponseProtoMsg { + return { + typeUrl: "/umee.uibc.v1.MsgGovSetIBCStatusResponse", + value: MsgGovSetIBCStatusResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/src/codegen/utf8.ts b/src/codegen/utf8.ts new file mode 100644 index 0000000..8558e2f --- /dev/null +++ b/src/codegen/utf8.ts @@ -0,0 +1,148 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.3.2 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright (c) 2016, Daniel Wirtz All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of its author, nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"use strict"; + +/** + * Calculates the UTF8 byte length of a string. + * @param {string} string String + * @returns {number} Byte length + */ +export function utf8Length(str: string) { + let len = 0, + c = 0; + for (let i = 0; i < str.length; ++i) { + c = str.charCodeAt(i); + if (c < 128) len += 1; + else if (c < 2048) len += 2; + else if ( + (c & 0xfc00) === 0xd800 && + (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00 + ) { + ++i; + len += 4; + } else len += 3; + } + return len; +} + +/** + * Reads UTF8 bytes as a string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} String read + */ +export function utf8Read( + buffer: ArrayLike, + start: number, + end: number +) { + const len = end - start; + if (len < 1) return ""; + const chunk = []; + let parts: string[] = [], + i = 0, // char offset + t; // temporary + while (start < end) { + t = buffer[start++]; + if (t < 128) chunk[i++] = t; + else if (t > 191 && t < 224) + chunk[i++] = ((t & 31) << 6) | (buffer[start++] & 63); + else if (t > 239 && t < 365) { + t = + (((t & 7) << 18) | + ((buffer[start++] & 63) << 12) | + ((buffer[start++] & 63) << 6) | + (buffer[start++] & 63)) - + 0x10000; + chunk[i++] = 0xd800 + (t >> 10); + chunk[i++] = 0xdc00 + (t & 1023); + } else + chunk[i++] = + ((t & 15) << 12) | + ((buffer[start++] & 63) << 6) | + (buffer[start++] & 63); + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode(...chunk)); + i = 0; + } + } + if (parts) { + if (i) parts.push(String.fromCharCode(...chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode(...chunk.slice(0, i)); +} + +/** + * Writes a string as UTF8 bytes. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Bytes written + */ +export function utf8Write( + str: string, + buffer: Uint8Array | Array, + offset: number +) { + const start = offset; + let c1, // character 1 + c2; // character 2 + for (let i = 0; i < str.length; ++i) { + c1 = str.charCodeAt(i); + if (c1 < 128) { + buffer[offset++] = c1; + } else if (c1 < 2048) { + buffer[offset++] = (c1 >> 6) | 192; + buffer[offset++] = (c1 & 63) | 128; + } else if ( + (c1 & 0xfc00) === 0xd800 && + ((c2 = str.charCodeAt(i + 1)) & 0xfc00) === 0xdc00 + ) { + c1 = 0x10000 + ((c1 & 0x03ff) << 10) + (c2 & 0x03ff); + ++i; + buffer[offset++] = (c1 >> 18) | 240; + buffer[offset++] = ((c1 >> 12) & 63) | 128; + buffer[offset++] = ((c1 >> 6) & 63) | 128; + buffer[offset++] = (c1 & 63) | 128; + } else { + buffer[offset++] = (c1 >> 12) | 224; + buffer[offset++] = ((c1 >> 6) & 63) | 128; + buffer[offset++] = (c1 & 63) | 128; + } + } + return offset - start; +} diff --git a/src/codegen/varint.ts b/src/codegen/varint.ts new file mode 100644 index 0000000..9389c1f --- /dev/null +++ b/src/codegen/varint.ts @@ -0,0 +1,488 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.3.2 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright 2008 Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Code generated by the Protocol Buffer compiler is owned by the owner +// of the input file used when generating it. This code is not +// standalone and requires a support library to be linked with it. This +// support library is itself covered by the above license. + +/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */ + +/** + * Read a 64 bit varint as two JS numbers. + * + * Returns tuple: + * [0]: low bits + * [1]: high bits + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175 + */ +export function varint64read(this: ReaderLike): [number, number] { + let lowBits = 0; + let highBits = 0; + + for (let shift = 0; shift < 28; shift += 7) { + let b = this.buf[this.pos++]; + lowBits |= (b & 0x7f) << shift; + if ((b & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + + let middleByte = this.buf[this.pos++]; + + // last four bits of the first 32 bit number + lowBits |= (middleByte & 0x0f) << 28; + + // 3 upper bits are part of the next 32 bit number + highBits = (middleByte & 0x70) >> 4; + + if ((middleByte & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + + for (let shift = 3; shift <= 31; shift += 7) { + let b = this.buf[this.pos++]; + highBits |= (b & 0x7f) << shift; + if ((b & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + + throw new Error("invalid varint"); +} + +/** + * Write a 64 bit varint, given as two JS numbers, to the given bytes array. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344 + */ +export function varint64write(lo: number, hi: number, bytes: number[]): void { + for (let i = 0; i < 28; i = i + 7) { + const shift = lo >>> i; + const hasNext = !(shift >>> 7 == 0 && hi == 0); + const byte = (hasNext ? shift | 0x80 : shift) & 0xff; + bytes.push(byte); + if (!hasNext) { + return; + } + } + + const splitBits = ((lo >>> 28) & 0x0f) | ((hi & 0x07) << 4); + const hasMoreBits = !(hi >> 3 == 0); + bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xff); + + if (!hasMoreBits) { + return; + } + + for (let i = 3; i < 31; i = i + 7) { + const shift = hi >>> i; + const hasNext = !(shift >>> 7 == 0); + const byte = (hasNext ? shift | 0x80 : shift) & 0xff; + bytes.push(byte); + if (!hasNext) { + return; + } + } + + bytes.push((hi >>> 31) & 0x01); +} + +// constants for binary math +const TWO_PWR_32_DBL = 0x100000000; + +/** + * Parse decimal string of 64 bit integer value as two JS numbers. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function int64FromString(dec: string): { lo: number; hi: number } { + // Check for minus sign. + const minus = dec[0] === "-"; + if (minus) { + dec = dec.slice(1); + } + + // Work 6 decimal digits at a time, acting like we're converting base 1e6 + // digits to binary. This is safe to do with floating point math because + // Number.isSafeInteger(ALL_32_BITS * 1e6) == true. + const base = 1e6; + let lowBits = 0; + let highBits = 0; + + function add1e6digit(begin: number, end?: number) { + // Note: Number('') is 0. + const digit1e6 = Number(dec.slice(begin, end)); + highBits *= base; + lowBits = lowBits * base + digit1e6; + // Carry bits from lowBits to + if (lowBits >= TWO_PWR_32_DBL) { + highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0); + lowBits = lowBits % TWO_PWR_32_DBL; + } + } + + add1e6digit(-24, -18); + add1e6digit(-18, -12); + add1e6digit(-12, -6); + add1e6digit(-6); + return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits); +} + +/** + * Losslessly converts a 64-bit signed integer in 32:32 split representation + * into a decimal string. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function int64ToString(lo: number, hi: number): string { + let bits = newBits(lo, hi); + // If we're treating the input as a signed value and the high bit is set, do + // a manual two's complement conversion before the decimal conversion. + const negative = bits.hi & 0x80000000; + if (negative) { + bits = negate(bits.lo, bits.hi); + } + const result = uInt64ToString(bits.lo, bits.hi); + return negative ? "-" + result : result; +} + +/** + * Losslessly converts a 64-bit unsigned integer in 32:32 split representation + * into a decimal string. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function uInt64ToString(lo: number, hi: number): string { + ({ lo, hi } = toUnsigned(lo, hi)); + // Skip the expensive conversion if the number is small enough to use the + // built-in conversions. + // Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with + // highBits <= 0x1FFFFF can be safely expressed with a double and retain + // integer precision. + // Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true. + if (hi <= 0x1fffff) { + return String(TWO_PWR_32_DBL * hi + lo); + } + + // What this code is doing is essentially converting the input number from + // base-2 to base-1e7, which allows us to represent the 64-bit range with + // only 3 (very large) digits. Those digits are then trivial to convert to + // a base-10 string. + + // The magic numbers used here are - + // 2^24 = 16777216 = (1,6777216) in base-1e7. + // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7. + + // Split 32:32 representation into 16:24:24 representation so our + // intermediate digits don't overflow. + const low = lo & 0xffffff; + const mid = ((lo >>> 24) | (hi << 8)) & 0xffffff; + const high = (hi >> 16) & 0xffff; + + // Assemble our three base-1e7 digits, ignoring carries. The maximum + // value in a digit at this step is representable as a 48-bit integer, which + // can be stored in a 64-bit floating point number. + let digitA = low + mid * 6777216 + high * 6710656; + let digitB = mid + high * 8147497; + let digitC = high * 2; + + // Apply carries from A to B and from B to C. + const base = 10000000; + if (digitA >= base) { + digitB += Math.floor(digitA / base); + digitA %= base; + } + + if (digitB >= base) { + digitC += Math.floor(digitB / base); + digitB %= base; + } + + // If digitC is 0, then we should have returned in the trivial code path + // at the top for non-safe integers. Given this, we can assume both digitB + // and digitA need leading zeros. + return ( + digitC.toString() + + decimalFrom1e7WithLeadingZeros(digitB) + + decimalFrom1e7WithLeadingZeros(digitA) + ); +} + +function toUnsigned(lo: number, hi: number): { lo: number; hi: number } { + return { lo: lo >>> 0, hi: hi >>> 0 }; +} + +function newBits(lo: number, hi: number): { lo: number; hi: number } { + return { lo: lo | 0, hi: hi | 0 }; +} + +/** + * Returns two's compliment negation of input. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers + */ +function negate(lowBits: number, highBits: number) { + highBits = ~highBits; + if (lowBits) { + lowBits = ~lowBits + 1; + } else { + // If lowBits is 0, then bitwise-not is 0xFFFFFFFF, + // adding 1 to that, results in 0x100000000, which leaves + // the low bits 0x0 and simply adds one to the high bits. + highBits += 1; + } + return newBits(lowBits, highBits); +} + +/** + * Returns decimal representation of digit1e7 with leading zeros. + */ +const decimalFrom1e7WithLeadingZeros = (digit1e7: number) => { + const partial = String(digit1e7); + return "0000000".slice(partial.length) + partial; +}; + +/** + * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)` + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144 + */ +export function varint32write(value: number, bytes: number[]): void { + if (value >= 0) { + // write value as varint 32 + while (value > 0x7f) { + bytes.push((value & 0x7f) | 0x80); + value = value >>> 7; + } + bytes.push(value); + } else { + for (let i = 0; i < 9; i++) { + bytes.push((value & 127) | 128); + value = value >> 7; + } + bytes.push(1); + } +} + +/** + * Read an unsigned 32 bit varint. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220 + */ +export function varint32read(this: ReaderLike): number { + let b = this.buf[this.pos++]; + let result = b & 0x7f; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 7; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 14; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 21; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + // Extract only last 4 bits + b = this.buf[this.pos++]; + result |= (b & 0x0f) << 28; + + for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++) + b = this.buf[this.pos++]; + + if ((b & 0x80) != 0) throw new Error("invalid varint"); + + this.assertBounds(); + + // Result can have 32 bits, convert it to unsigned + return result >>> 0; +} + +type ReaderLike = { + buf: Uint8Array; + pos: number; + len: number; + assertBounds(): void; +}; + +/** + * encode zig zag + */ +export function zzEncode(lo: number, hi: number) { + let mask = hi >> 31; + hi = (((hi << 1) | (lo >>> 31)) ^ mask) >>> 0; + lo = ((lo << 1) ^ mask) >>> 0; + return [lo, hi]; +} + +/** + * decode zig zag + */ +export function zzDecode(lo: number, hi: number) { + let mask = -(lo & 1); + lo = (((lo >>> 1) | (hi << 31)) ^ mask) >>> 0; + hi = ((hi >>> 1) ^ mask) >>> 0; + return [lo, hi]; +} + +/** + * unsigned int32 without moving pos. + */ +export function readUInt32(buf: Uint8Array, pos: number) { + return ( + (buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16)) + + buf[pos + 3] * 0x1000000 + ); +} + +/** + * signed int32 without moving pos. + */ +export function readInt32(buf: Uint8Array, pos: number) { + return ( + (buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16)) + + (buf[pos + 3] << 24) + ); +} + +/** + * writing varint32 to pos + */ +export function writeVarint32( + val: number, + buf: Uint8Array | number[], + pos: number +) { + while (val > 127) { + buf[pos++] = (val & 127) | 128; + val >>>= 7; + } + buf[pos] = val; +} + +/** + * writing varint64 to pos + */ +export function writeVarint64( + val: { lo: number; hi: number }, + buf: Uint8Array | number[], + pos: number +) { + while (val.hi) { + buf[pos++] = (val.lo & 127) | 128; + val.lo = ((val.lo >>> 7) | (val.hi << 25)) >>> 0; + val.hi >>>= 7; + } + while (val.lo > 127) { + buf[pos++] = (val.lo & 127) | 128; + val.lo = val.lo >>> 7; + } + buf[pos++] = val.lo; +} + +export function int64Length(lo: number, hi: number) { + let part0 = lo, + part1 = ((lo >>> 28) | (hi << 4)) >>> 0, + part2 = hi >>> 24; + return part2 === 0 + ? part1 === 0 + ? part0 < 16384 + ? part0 < 128 + ? 1 + : 2 + : part0 < 2097152 + ? 3 + : 4 + : part1 < 16384 + ? part1 < 128 + ? 5 + : 6 + : part1 < 2097152 + ? 7 + : 8 + : part2 < 128 + ? 9 + : 10; +} + +export function writeFixed32( + val: number, + buf: Uint8Array | number[], + pos: number +) { + buf[pos] = val & 255; + buf[pos + 1] = (val >>> 8) & 255; + buf[pos + 2] = (val >>> 16) & 255; + buf[pos + 3] = val >>> 24; +} + +export function writeByte( + val: number, + buf: Uint8Array | number[], + pos: number +) { + buf[pos] = val & 255; +}